2008-07-26 09:39:44 +03:00
|
|
|
#include "../global.h"
|
2008-07-26 16:57:32 +03:00
|
|
|
struct IPack
|
|
|
|
{
|
|
|
|
virtual ui16 getType()=0;
|
|
|
|
};
|
|
|
|
template <typename T> struct CPack
|
|
|
|
:public IPack
|
|
|
|
{
|
|
|
|
ui16 type;
|
|
|
|
ui16 getType(){return type;}
|
|
|
|
T* This(){return static_cast<T*>(this);};
|
|
|
|
};
|
|
|
|
struct NewTurn : public CPack<NewTurn> //101
|
2008-07-26 09:39:44 +03:00
|
|
|
{
|
|
|
|
struct Hero
|
|
|
|
{
|
|
|
|
ui32 id, move, mana; //id is a general serial id
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2008-07-26 16:57:32 +03:00
|
|
|
h & id & move & mana;
|
2008-07-26 09:39:44 +03:00
|
|
|
}
|
2008-07-26 16:57:32 +03:00
|
|
|
bool operator<(const Hero&h)const{return id < h.id;}
|
2008-07-26 09:39:44 +03:00
|
|
|
};
|
|
|
|
struct Resources
|
|
|
|
{
|
|
|
|
ui8 player;
|
|
|
|
si32 resources[RESOURCE_QUANTITY];
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2008-07-26 16:57:32 +03:00
|
|
|
h & player & resources;
|
2008-07-26 09:39:44 +03:00
|
|
|
}
|
2008-07-26 16:57:32 +03:00
|
|
|
bool operator<(const Resources&h)const{return player < h.player;}
|
2008-07-26 09:39:44 +03:00
|
|
|
};
|
|
|
|
|
2008-07-26 16:57:32 +03:00
|
|
|
std::set<Hero> heroes; //updates movement and mana points
|
|
|
|
std::set<Resources> res;//resource list
|
|
|
|
ui32 day;
|
|
|
|
bool resetBuilded;
|
2008-07-26 09:39:44 +03:00
|
|
|
|
2008-07-26 16:57:32 +03:00
|
|
|
NewTurn(){type = 101;};
|
2008-07-26 09:39:44 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2008-07-26 16:57:32 +03:00
|
|
|
h & heroes & res & day & resetBuilded;
|
2008-07-26 09:39:44 +03:00
|
|
|
}
|
|
|
|
};
|