Jelajahi Sumber

wczytywanie zdarzeń globalnych

mateuszb 18 tahun lalu
induk
melakukan
e491be6041
4 mengubah file dengan 52 tambahan dan 3 penghapusan
  1. 33 1
      CAmbarCendamo.cpp
  2. 1 1
      CMT.cpp
  3. 1 1
      global.h
  4. 17 0
      map.h

+ 33 - 1
CAmbarCendamo.cpp

@@ -1624,7 +1624,39 @@ void CAmbarCendamo::deh3m()
 		//TODO - dokoñczyæ, du¿o do zrobienia - trzeba patrzeæ, co def niesie
 	}//*/ //end of loading objects; commented to make application work until it will be finished
 	////objects loaded
-	//todo: read events
+
+	//loading events
+	int numberOfEvents = readNormalNr(i); i+=4;
+	for(int yyoo=0; yyoo<numberOfEvents; ++yyoo)
+	{
+		CMapEvent ne;
+		ne.name = std::string();
+		ne.message = std::string();
+		int nameLen = readNormalNr(i); i+=4;
+		for(int qq=0; qq<nameLen; ++qq)
+		{
+			ne.name += bufor[i]; ++i;
+		}
+		int messLen = readNormalNr(i); i+=4;
+		for(int qq=0; qq<messLen; ++qq)
+		{
+			ne.message +=bufor[i]; ++i;
+		}
+		ne.wood = readNormalNr(i); i+=4;
+		ne.mercury = readNormalNr(i); i+=4;
+		ne.ore = readNormalNr(i); i+=4;
+		ne.sulfur = readNormalNr(i); i+=4;
+		ne.crystal = readNormalNr(i); i+=4;
+		ne.gems = readNormalNr(i); i+=4;
+		ne.gold = readNormalNr(i); i+=4;
+		ne.players = bufor[i]; ++i;
+		ne.humanAffected = bufor[i]; ++i;
+		ne.computerAffected = bufor[i]; ++i;
+		ne.firstOccurence = bufor[i]; ++i;
+		ne.nextOccurence = bufor[i]; ++i;
+		i+=18;
+		map.events.push_back(ne);
+	}
 }
 int CAmbarCendamo::readNormalNr (int pos, int bytCon, bool cyclic)
 {

+ 1 - 1
CMT.cpp

@@ -258,7 +258,7 @@ int _tmain(int argc, _TCHAR* argv[])
 		CObjectHandler * objh = new CObjectHandler;
 		objh->loadObjects();
 		cgi->objh = objh;
-		CAmbarCendamo * ac = new CAmbarCendamo("4gryf"); //4gryf
+		CAmbarCendamo * ac = new CAmbarCendamo("Arrogance"); //4gryf
 		cgi->ac = ac;
 		THC std::cout<<"Wczytywanie pliku: "<<tmh.getDif()<<std::endl;
 		ac->deh3m();

+ 1 - 1
global.h

@@ -10,7 +10,7 @@
 #endif
 enum EterrainType {dirt, sand, grass, snow, swamp, rough, subterranean, lava, water, rock};
 enum Eriver {clearRiver=1, icyRiver, muddyRiver, lavaRiver};
-enum Eroad {dirtRoad=1, gravelRoad, cobblestoneRoad};
+enum Eroad {dirtRoad=1, grazvelRoad, cobblestoneRoad};
 enum Eformat { WoG=0x33, AB=0x15, RoE=0x0e,  SoD=0x1c};
 enum EvictoryConditions {artifact, gatherTroop, gatherResource, buildCity, buildGrail, beatHero, 
 captureCity, beatMonster, takeDwellings, takeMines, transportItem, winStandard=255};

+ 17 - 0
map.h

@@ -146,6 +146,20 @@ struct Rumor
 {
 	std::string name, text;
 };
+
+
+class CMapEvent
+{
+public:
+	std::string name, message;
+	int wood, mercury, ore, sulfur, crystal, gems, gold; //gained / taken resources
+	unsigned char players; //affected players
+	bool humanAffected;
+	bool computerAffected;
+	int firstOccurence;
+	int nextOccurence; //after nextOccurance day event will occure; if it it 0, event occures only one time;
+};
+
 struct Mapa
 {
 	Eformat version; // version of map Eformat
@@ -166,5 +180,8 @@ struct Mapa
 	EvictoryConditions victoryCondition; //victory conditions
 	CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
 	int howManyTeams;
+	std::vector<CMapEvent> events;
 };
+
+
 #endif //MAPD