2007-08-01 17:06:04 +03:00
|
|
|
#ifndef STARTINFO_H
|
|
|
|
#define STARTINFO_H
|
|
|
|
|
|
|
|
#include "global.h"
|
2007-08-07 16:49:15 +03:00
|
|
|
#include <vector>
|
2007-08-01 17:06:04 +03:00
|
|
|
|
|
|
|
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
|
2007-08-04 00:47:34 +03:00
|
|
|
heroPortrait; //-1 if default, else ID
|
2007-08-01 17:06:04 +03:00
|
|
|
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
|
2007-08-01 17:06:04 +03:00
|
|
|
std::string name;
|
2008-02-06 09:33:53 +02:00
|
|
|
bool human;
|
2008-07-09 20:22:28 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2008-07-25 20:28:28 +03:00
|
|
|
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
|
|
|
}
|
2007-08-01 17:06:04 +03:00
|
|
|
};
|
2008-07-09 20:22:28 +03:00
|
|
|
si32 difficulty; //0=easy; 4=impossible
|
2007-08-01 17:06:04 +03:00
|
|
|
std::vector<PlayerSettings> playerInfos;
|
2008-07-09 20:22:28 +03:00
|
|
|
ui8 turnTime; //in minutes, 0=unlimited
|
|
|
|
std::string mapname;
|
2007-08-04 22:01:22 +03:00
|
|
|
PlayerSettings & getIthPlayersSettings(int no)
|
|
|
|
{
|
2008-07-09 20:22:28 +03:00
|
|
|
for(unsigned int i=0; i<playerInfos.size(); ++i)
|
2007-08-04 22:01:22 +03:00
|
|
|
if(playerInfos[i].color == no)
|
|
|
|
return playerInfos[i];
|
2008-08-02 18:08:03 +03:00
|
|
|
#ifndef __GNUC__
|
2007-12-06 20:32:06 +02:00
|
|
|
throw new std::exception("Cannot find info about player");
|
2008-08-02 18:08:03 +03:00
|
|
|
#else
|
|
|
|
throw new std::exception();
|
|
|
|
#endif
|
2007-08-04 22:01:22 +03:00
|
|
|
}
|
2008-07-25 20:28:28 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
2008-07-09 20:22:28 +03:00
|
|
|
{
|
2008-07-25 20:28:28 +03:00
|
|
|
h & difficulty;
|
2008-07-09 20:22:28 +03:00
|
|
|
h & playerInfos;
|
2008-07-25 20:28:28 +03:00
|
|
|
h & turnTime;
|
|
|
|
h & mapname;
|
2008-07-09 20:22:28 +03:00
|
|
|
}
|
2007-08-01 17:06:04 +03:00
|
|
|
};
|
|
|
|
|
2008-07-25 20:28:28 +03:00
|
|
|
#endif
|