1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

wczytywanie zdarzeń globalnych

This commit is contained in:
mateuszb 2007-06-18 20:05:42 +00:00
parent 14715a22c8
commit e491be6041
4 changed files with 52 additions and 3 deletions

View File

@ -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)
{

View File

@ -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();

View File

@ -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
map.h
View File

@ -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