mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
some 'retarded' fixes for compatibility (lib only)
This commit is contained in:
parent
4373f211f1
commit
eaa7ea643a
@ -200,7 +200,7 @@ CTypeList::CTypeList()
|
||||
registerTypes(*this);
|
||||
}
|
||||
|
||||
ui16 CTypeList::registerType( const type_info *type )
|
||||
ui16 CTypeList::registerType( const std::type_info *type )
|
||||
{
|
||||
TTypeMap::const_iterator i = types.find(type);
|
||||
if(i != types.end())
|
||||
@ -212,7 +212,7 @@ ui16 CTypeList::registerType( const type_info *type )
|
||||
return id;
|
||||
}
|
||||
|
||||
ui16 CTypeList::getTypeID( const type_info *type )
|
||||
ui16 CTypeList::getTypeID( const std::type_info *type )
|
||||
{
|
||||
TTypeMap::const_iterator i = types.find(type);
|
||||
if(i != types.end())
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <typeinfo>
|
||||
#include <typeinfo> //XXX this is in namespace std if you want w/o use typeinfo.h?
|
||||
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
@ -56,7 +56,7 @@ enum SerializationLvl
|
||||
|
||||
struct TypeComparer
|
||||
{
|
||||
bool operator()(const type_info *a, const type_info *b) const
|
||||
bool operator()(const std::type_info *a, const std::type_info *b) const
|
||||
{
|
||||
return a->before(*b);
|
||||
}
|
||||
@ -64,24 +64,24 @@ struct TypeComparer
|
||||
|
||||
class DLL_EXPORT CTypeList
|
||||
{
|
||||
typedef std::multimap<const type_info *,ui16,TypeComparer> TTypeMap;
|
||||
typedef std::multimap<const std::type_info *,ui16,TypeComparer> TTypeMap;
|
||||
TTypeMap types;
|
||||
public:
|
||||
CTypeList();
|
||||
ui16 registerType(const type_info *type);
|
||||
ui16 registerType(const std::type_info *type);
|
||||
template <typename T> ui16 registerType(const T * t = NULL)
|
||||
{
|
||||
return registerType(getTypeInfo(t));
|
||||
}
|
||||
|
||||
ui16 getTypeID(const type_info *type);
|
||||
ui16 getTypeID(const std::type_info *type);
|
||||
template <typename T> ui16 getTypeID(const T * t)
|
||||
{
|
||||
return getTypeID(getTypeInfo(t));
|
||||
}
|
||||
|
||||
|
||||
template <typename T> const type_info * getTypeInfo(const T * t = NULL)
|
||||
template <typename T> const std::type_info * getTypeInfo(const T * t = NULL)
|
||||
{
|
||||
if(t)
|
||||
return &typeid(*t);
|
||||
|
@ -2,12 +2,126 @@
|
||||
#include "Connection.h"
|
||||
#include "NetPacks.h"
|
||||
#include "VCMI_Lib.h"
|
||||
#include "../hch./CObjectHandler.h"
|
||||
#include "../hch/CObjectHandler.h"
|
||||
#include "../hch/CHeroHandler.h"
|
||||
#include "../hch/CTownHandler.h"
|
||||
#include "RegisterTypes.h"
|
||||
|
||||
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes1(Serializer &s)
|
||||
{
|
||||
s.registerType<CGHeroInstance>();
|
||||
s.registerType<CGTownInstance>();
|
||||
s.registerType<CGEvent>();
|
||||
s.registerType<CGVisitableOPH>();
|
||||
s.registerType<CGVisitableOPW>();
|
||||
s.registerType<CGTeleport>();
|
||||
s.registerType<CGPickable>();
|
||||
s.registerType<CGCreature>();
|
||||
s.registerType<CGSignBottle>();
|
||||
s.registerType<CGSeerHut>();
|
||||
s.registerType<CGWitchHut>();
|
||||
s.registerType<CGScholar>();
|
||||
s.registerType<CGGarrison>();
|
||||
s.registerType<CGArtifact>();
|
||||
s.registerType<CGResource>();
|
||||
s.registerType<CGMine>();
|
||||
s.registerType<CGShrine>();
|
||||
s.registerType<CGPandoraBox>();
|
||||
s.registerType<CGQuestGuard>();
|
||||
s.registerType<CGBonusingObject>();
|
||||
s.registerType<CGMagicWell>();
|
||||
s.registerType<CGObservatory>();
|
||||
s.registerType<CGObjectInstance>();
|
||||
}
|
||||
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes2(Serializer &s)
|
||||
{
|
||||
s.registerType<SystemMessage>();
|
||||
s.registerType<YourTurn>();
|
||||
s.registerType<SetResource>();
|
||||
s.registerType<SetResources>();
|
||||
s.registerType<SetPrimSkill>();
|
||||
s.registerType<SetSecSkill>();
|
||||
s.registerType<HeroVisitCastle>();
|
||||
s.registerType<ChangeSpells>();
|
||||
s.registerType<SetMana>();
|
||||
s.registerType<SetMovePoints>();
|
||||
s.registerType<FoWChange>();
|
||||
s.registerType<SetAvailableHeroes>();
|
||||
s.registerType<GiveBonus>();
|
||||
s.registerType<ChangeObjPos>();
|
||||
s.registerType<RemoveObject>();
|
||||
s.registerType<TryMoveHero>();
|
||||
s.registerType<SetGarrisons>();
|
||||
s.registerType<NewStructures>();
|
||||
s.registerType<SetAvailableCreatures>();
|
||||
s.registerType<SetHeroesInTown>();
|
||||
s.registerType<SetHeroArtifacts>();
|
||||
s.registerType<HeroRecruited>();
|
||||
s.registerType<GiveHero>();
|
||||
s.registerType<NewTurn>();
|
||||
s.registerType<InfoWindow>();
|
||||
s.registerType<SetObjectProperty>();
|
||||
s.registerType<SetHoverName>();
|
||||
s.registerType<HeroLevelUp>();
|
||||
s.registerType<SelectionDialog>();
|
||||
s.registerType<YesNoDialog>();
|
||||
s.registerType<BattleStart>();
|
||||
s.registerType<BattleNextRound>();
|
||||
s.registerType<BattleSetActiveStack>();
|
||||
s.registerType<BattleResult>();
|
||||
s.registerType<BattleStackMoved>();
|
||||
s.registerType<BattleStackAttacked>();
|
||||
s.registerType<BattleAttack>();
|
||||
s.registerType<StartAction>();
|
||||
s.registerType<EndAction>();
|
||||
s.registerType<SpellCasted>();
|
||||
s.registerType<SetStackEffect>();
|
||||
s.registerType<ShowInInfobox>();
|
||||
|
||||
s.registerType<SetSelection>();
|
||||
s.registerType<PlayerMessage>();
|
||||
}
|
||||
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes3(Serializer &s)
|
||||
{
|
||||
s.registerType<SaveGame>();
|
||||
s.registerType<CloseServer>();
|
||||
s.registerType<EndTurn>();
|
||||
s.registerType<DismissHero>();
|
||||
s.registerType<MoveHero>();
|
||||
s.registerType<ArrangeStacks>();
|
||||
s.registerType<DisbandCreature>();
|
||||
s.registerType<BuildStructure>();
|
||||
s.registerType<RecruitCreatures>();
|
||||
s.registerType<UpgradeCreature>();
|
||||
s.registerType<GarrisonHeroSwap>();
|
||||
s.registerType<ExchangeArtifacts>();
|
||||
s.registerType<BuyArtifact>();
|
||||
s.registerType<TradeOnMarketplace>();
|
||||
s.registerType<SetFormation>();
|
||||
s.registerType<HireHero>();
|
||||
s.registerType<QueryReply>();
|
||||
s.registerType<MakeAction>();
|
||||
s.registerType<MakeCustomAction>();
|
||||
|
||||
s.registerType<SetSelection>();
|
||||
s.registerType<PlayerMessage>();
|
||||
}
|
||||
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes(Serializer &s)
|
||||
{
|
||||
registerTypes1(s);
|
||||
registerTypes2(s);
|
||||
registerTypes3(s);
|
||||
}
|
||||
|
||||
|
||||
void foofoofoo()
|
||||
{
|
||||
//never called function to force instantation of templates
|
||||
|
@ -2,114 +2,17 @@
|
||||
//templates for registering object types
|
||||
|
||||
//first set of types - derivatives of CGObjectInstance
|
||||
template<typename Serializer> DLL_EXPORT void registerTypes1(Serializer &s)
|
||||
{
|
||||
s.registerType<CGHeroInstance>();
|
||||
s.registerType<CGTownInstance>();
|
||||
s.registerType<CGEvent>();
|
||||
s.registerType<CGVisitableOPH>();
|
||||
s.registerType<CGVisitableOPW>();
|
||||
s.registerType<CGTeleport>();
|
||||
s.registerType<CGPickable>();
|
||||
s.registerType<CGCreature>();
|
||||
s.registerType<CGSignBottle>();
|
||||
s.registerType<CGSeerHut>();
|
||||
s.registerType<CGWitchHut>();
|
||||
s.registerType<CGScholar>();
|
||||
s.registerType<CGGarrison>();
|
||||
s.registerType<CGArtifact>();
|
||||
s.registerType<CGResource>();
|
||||
s.registerType<CGMine>();
|
||||
s.registerType<CGShrine>();
|
||||
s.registerType<CGPandoraBox>();
|
||||
s.registerType<CGQuestGuard>();
|
||||
s.registerType<CGBonusingObject>();
|
||||
s.registerType<CGMagicWell>();
|
||||
s.registerType<CGObservatory>();
|
||||
s.registerType<CGObjectInstance>();
|
||||
}
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes1(Serializer &s);
|
||||
|
||||
|
||||
//second set of types - derivatives of CPack for client (network VCMI packages)
|
||||
template<typename Serializer> DLL_EXPORT void registerTypes2(Serializer &s)
|
||||
{
|
||||
s.registerType<SystemMessage>();
|
||||
s.registerType<YourTurn>();
|
||||
s.registerType<SetResource>();
|
||||
s.registerType<SetResources>();
|
||||
s.registerType<SetPrimSkill>();
|
||||
s.registerType<SetSecSkill>();
|
||||
s.registerType<HeroVisitCastle>();
|
||||
s.registerType<ChangeSpells>();
|
||||
s.registerType<SetMana>();
|
||||
s.registerType<SetMovePoints>();
|
||||
s.registerType<FoWChange>();
|
||||
s.registerType<SetAvailableHeroes>();
|
||||
s.registerType<GiveBonus>();
|
||||
s.registerType<ChangeObjPos>();
|
||||
s.registerType<RemoveObject>();
|
||||
s.registerType<TryMoveHero>();
|
||||
s.registerType<SetGarrisons>();
|
||||
s.registerType<NewStructures>();
|
||||
s.registerType<SetAvailableCreatures>();
|
||||
s.registerType<SetHeroesInTown>();
|
||||
s.registerType<SetHeroArtifacts>();
|
||||
s.registerType<HeroRecruited>();
|
||||
s.registerType<GiveHero>();
|
||||
s.registerType<NewTurn>();
|
||||
s.registerType<InfoWindow>();
|
||||
s.registerType<SetObjectProperty>();
|
||||
s.registerType<SetHoverName>();
|
||||
s.registerType<HeroLevelUp>();
|
||||
s.registerType<SelectionDialog>();
|
||||
s.registerType<YesNoDialog>();
|
||||
s.registerType<BattleStart>();
|
||||
s.registerType<BattleNextRound>();
|
||||
s.registerType<BattleSetActiveStack>();
|
||||
s.registerType<BattleResult>();
|
||||
s.registerType<BattleStackMoved>();
|
||||
s.registerType<BattleStackAttacked>();
|
||||
s.registerType<BattleAttack>();
|
||||
s.registerType<StartAction>();
|
||||
s.registerType<EndAction>();
|
||||
s.registerType<SpellCasted>();
|
||||
s.registerType<SetStackEffect>();
|
||||
s.registerType<ShowInInfobox>();
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes2(Serializer &s);
|
||||
|
||||
s.registerType<SetSelection>();
|
||||
s.registerType<PlayerMessage>();
|
||||
}
|
||||
|
||||
template<typename Serializer> DLL_EXPORT void registerTypes3(Serializer &s)
|
||||
{
|
||||
s.registerType<SaveGame>();
|
||||
s.registerType<CloseServer>();
|
||||
s.registerType<EndTurn>();
|
||||
s.registerType<DismissHero>();
|
||||
s.registerType<MoveHero>();
|
||||
s.registerType<ArrangeStacks>();
|
||||
s.registerType<DisbandCreature>();
|
||||
s.registerType<BuildStructure>();
|
||||
s.registerType<RecruitCreatures>();
|
||||
s.registerType<UpgradeCreature>();
|
||||
s.registerType<GarrisonHeroSwap>();
|
||||
s.registerType<ExchangeArtifacts>();
|
||||
s.registerType<BuyArtifact>();
|
||||
s.registerType<TradeOnMarketplace>();
|
||||
s.registerType<SetFormation>();
|
||||
s.registerType<HireHero>();
|
||||
s.registerType<QueryReply>();
|
||||
s.registerType<MakeAction>();
|
||||
s.registerType<MakeCustomAction>();
|
||||
|
||||
s.registerType<SetSelection>();
|
||||
s.registerType<PlayerMessage>();
|
||||
}
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes3(Serializer &s);
|
||||
|
||||
//register all
|
||||
template<typename Serializer> DLL_EXPORT void registerTypes(Serializer &s)
|
||||
{
|
||||
registerTypes1(s);
|
||||
registerTypes2(s);
|
||||
registerTypes3(s);
|
||||
}
|
||||
template<typename Serializer> DLL_EXPORT
|
||||
void registerTypes(Serializer &s);
|
Loading…
Reference in New Issue
Block a user