1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Base for netcode

This commit is contained in:
Michał W. Urbańczyk
2008-07-09 17:22:28 +00:00
parent 9422b0d9ca
commit 358ab062eb
10 changed files with 345 additions and 95 deletions

View File

@@ -10,26 +10,47 @@ struct StartInfo
{
struct PlayerSettings
{
int castle, hero, //ID, if -1 then random, if -2 then none
si32 castle, hero, //ID, if -1 then random, if -2 then none
heroPortrait; //-1 if default, else ID
std::string heroName;
Ebonus bonus;
Ecolor color; //from 0 -
int serial;
int handicap;//0-no, 1-mild, 2-severe
si8 bonus; //usees enum type Ebonus
ui8 color; //from 0 -
ui8 serial;
ui8 handicap;//0-no, 1-mild, 2-severe
std::string name;
bool human;
template <typename Handler> void serialize(Handler &h, const int version)
{
h && castle;
h && hero;
h && heroPortrait;
h && heroName;
h && bonus;
h && color;
h && serial;
h && handicap;
h && name;
h && human;
}
};
int difficulty; //0=easy; 4=impossible
si32 difficulty; //0=easy; 4=impossible
std::vector<PlayerSettings> playerInfos;
int turnTime; //in minutes, 0=unlimited
ui8 turnTime; //in minutes, 0=unlimited
std::string mapname;
PlayerSettings & getIthPlayersSettings(int no)
{
for(int i=0; i<playerInfos.size(); ++i)
for(unsigned int i=0; i<playerInfos.size(); ++i)
if(playerInfos[i].color == no)
return playerInfos[i];
throw new std::exception("Cannot find info about player");
}
template <typename Handler> void serialize(Handler &h, const int version)
{
h && difficulty;
h & playerInfos;
h && turnTime;
h && mapname;
}
};
#endif