1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/StartInfo.h

61 lines
1.3 KiB
C
Raw Normal View History

#ifndef STARTINFO_H
#define STARTINFO_H
#include "global.h"
#include <vector>
enum Ebonus {brandom=-1,bartifact, bgold, bresource};
struct StartInfo
{
struct PlayerSettings
{
2008-07-09 20:22:28 +03:00
si32 castle, hero, //ID, if -1 then random, if -2 then none
heroPortrait; //-1 if default, else ID
std::string heroName;
2008-07-09 20:22:28 +03:00
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;
2008-07-09 20:22:28 +03:00
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;
2008-07-09 20:22:28 +03:00
}
};
2008-07-09 20:22:28 +03:00
si32 difficulty; //0=easy; 4=impossible
std::vector<PlayerSettings> playerInfos;
2008-07-09 20:22:28 +03:00
ui8 turnTime; //in minutes, 0=unlimited
std::string mapname;
PlayerSettings & getIthPlayersSettings(int no)
{
2008-07-09 20:22:28 +03:00
for(unsigned int i=0; i<playerInfos.size(); ++i)
if(playerInfos[i].color == no)
return playerInfos[i];
#ifndef __GNUC__
throw new std::exception("Cannot find info about player");
#else
throw new std::exception();
#endif
}
template <typename Handler> void serialize(Handler &h, const int version)
2008-07-09 20:22:28 +03:00
{
h & difficulty;
2008-07-09 20:22:28 +03:00
h & playerInfos;
h & turnTime;
h & mapname;
2008-07-09 20:22:28 +03:00
}
};
#endif