1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Reorganized types registration code

This commit is contained in:
Ivan Savenko 2023-11-11 00:39:08 +02:00
parent 4a7fa9bf8c
commit 5c810df36f
32 changed files with 681 additions and 881 deletions

View File

@ -47,7 +47,7 @@
#include "../lib/modding/ModIncompatibility.h" #include "../lib/modding/ModIncompatibility.h"
#include "../lib/rmg/CMapGenOptions.h" #include "../lib/rmg/CMapGenOptions.h"
#include "../lib/filesystem/Filesystem.h" #include "../lib/filesystem/Filesystem.h"
#include "../lib/registerTypes/RegisterTypes.h" #include "../lib/registerTypes/RegisterTypesLobbyPacks.h"
#include "../lib/serializer/Connection.h" #include "../lib/serializer/Connection.h"
#include "../lib/serializer/CMemorySerializer.h" #include "../lib/serializer/CMemorySerializer.h"

View File

@ -24,6 +24,7 @@
#include "../CCallback.h" #include "../CCallback.h"
#include "../lib/CConfigHandler.h" #include "../lib/CConfigHandler.h"
#include "../lib/gameState/CGameState.h" #include "../lib/gameState/CGameState.h"
#include "../lib/CPlayerState.h"
#include "../lib/CThreadHelper.h" #include "../lib/CThreadHelper.h"
#include "../lib/VCMIDirs.h" #include "../lib/VCMIDirs.h"
#include "../lib/UnlockGuard.h" #include "../lib/UnlockGuard.h"
@ -32,7 +33,7 @@
#include "../lib/mapping/CMapService.h" #include "../lib/mapping/CMapService.h"
#include "../lib/pathfinder/CGPathNode.h" #include "../lib/pathfinder/CGPathNode.h"
#include "../lib/filesystem/Filesystem.h" #include "../lib/filesystem/Filesystem.h"
#include "../lib/registerTypes/RegisterTypes.h" #include "../lib/registerTypes/RegisterTypesClientPacks.h"
#include "../lib/serializer/Connection.h" #include "../lib/serializer/Connection.h"
#include <memory> #include <memory>
@ -137,8 +138,7 @@ CClient::CClient()
{ {
waitingRequest.clear(); waitingRequest.clear();
applier = std::make_shared<CApplier<CBaseForCLApply>>(); applier = std::make_shared<CApplier<CBaseForCLApply>>();
registerTypesClientPacks1(*applier); registerTypesClientPacks(*applier);
registerTypesClientPacks2(*applier);
IObjectInterface::cb = this; IObjectInterface::cb = this;
gs = nullptr; gs = nullptr;
} }

View File

@ -39,7 +39,7 @@
#include "../../lib/TerrainHandler.h" #include "../../lib/TerrainHandler.h"
#include "../../lib/filesystem/Filesystem.h" #include "../../lib/filesystem/Filesystem.h"
#include "../../lib/serializer/BinaryDeserializer.h" #include "../../lib/serializer/CLoadFile.h"
#include "../../lib/StartInfo.h" #include "../../lib/StartInfo.h"
#include "../../lib/rmg/CMapGenOptions.h" #include "../../lib/rmg/CMapGenOptions.h"

View File

@ -133,15 +133,6 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/pathfinder/PathfindingRules.cpp ${MAIN_LIB_DIR}/pathfinder/PathfindingRules.cpp
${MAIN_LIB_DIR}/pathfinder/TurnInfo.cpp ${MAIN_LIB_DIR}/pathfinder/TurnInfo.cpp
${MAIN_LIB_DIR}/registerTypes/RegisterTypes.cpp
${MAIN_LIB_DIR}/registerTypes/TypesClientPacks1.cpp
${MAIN_LIB_DIR}/registerTypes/TypesClientPacks2.cpp
${MAIN_LIB_DIR}/registerTypes/TypesMapObjects1.cpp
${MAIN_LIB_DIR}/registerTypes/TypesMapObjects2.cpp
${MAIN_LIB_DIR}/registerTypes/TypesMapObjects3.cpp
${MAIN_LIB_DIR}/registerTypes/TypesLobbyPacks.cpp
${MAIN_LIB_DIR}/registerTypes/TypesServerPacks.cpp
${MAIN_LIB_DIR}/rewardable/Configuration.cpp ${MAIN_LIB_DIR}/rewardable/Configuration.cpp
${MAIN_LIB_DIR}/rewardable/Info.cpp ${MAIN_LIB_DIR}/rewardable/Info.cpp
${MAIN_LIB_DIR}/rewardable/Interface.cpp ${MAIN_LIB_DIR}/rewardable/Interface.cpp
@ -181,8 +172,10 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/serializer/BinaryDeserializer.cpp ${MAIN_LIB_DIR}/serializer/BinaryDeserializer.cpp
${MAIN_LIB_DIR}/serializer/BinarySerializer.cpp ${MAIN_LIB_DIR}/serializer/BinarySerializer.cpp
${MAIN_LIB_DIR}/serializer/CLoadFile.cpp
${MAIN_LIB_DIR}/serializer/CMemorySerializer.cpp ${MAIN_LIB_DIR}/serializer/CMemorySerializer.cpp
${MAIN_LIB_DIR}/serializer/Connection.cpp ${MAIN_LIB_DIR}/serializer/Connection.cpp
${MAIN_LIB_DIR}/serializer/CSaveFile.cpp
${MAIN_LIB_DIR}/serializer/CSerializer.cpp ${MAIN_LIB_DIR}/serializer/CSerializer.cpp
${MAIN_LIB_DIR}/serializer/CTypeList.cpp ${MAIN_LIB_DIR}/serializer/CTypeList.cpp
${MAIN_LIB_DIR}/serializer/JsonDeserializer.cpp ${MAIN_LIB_DIR}/serializer/JsonDeserializer.cpp
@ -505,6 +498,10 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/pathfinder/TurnInfo.h ${MAIN_LIB_DIR}/pathfinder/TurnInfo.h
${MAIN_LIB_DIR}/registerTypes/RegisterTypes.h ${MAIN_LIB_DIR}/registerTypes/RegisterTypes.h
${MAIN_LIB_DIR}/registerTypes/RegisterTypesClientPacks.h
${MAIN_LIB_DIR}/registerTypes/RegisterTypesLobbyPacks.h
${MAIN_LIB_DIR}/registerTypes/RegisterTypesMapObjects.h
${MAIN_LIB_DIR}/registerTypes/RegisterTypesServerPacks.h
${MAIN_LIB_DIR}/rewardable/Configuration.h ${MAIN_LIB_DIR}/rewardable/Configuration.h
${MAIN_LIB_DIR}/rewardable/Info.h ${MAIN_LIB_DIR}/rewardable/Info.h
@ -548,8 +545,10 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/serializer/BinaryDeserializer.h ${MAIN_LIB_DIR}/serializer/BinaryDeserializer.h
${MAIN_LIB_DIR}/serializer/BinarySerializer.h ${MAIN_LIB_DIR}/serializer/BinarySerializer.h
${MAIN_LIB_DIR}/serializer/CLoadFile.h
${MAIN_LIB_DIR}/serializer/CMemorySerializer.h ${MAIN_LIB_DIR}/serializer/CMemorySerializer.h
${MAIN_LIB_DIR}/serializer/Connection.h ${MAIN_LIB_DIR}/serializer/Connection.h
${MAIN_LIB_DIR}/serializer/CSaveFile.h
${MAIN_LIB_DIR}/serializer/CSerializer.h ${MAIN_LIB_DIR}/serializer/CSerializer.h
${MAIN_LIB_DIR}/serializer/CTypeList.h ${MAIN_LIB_DIR}/serializer/CTypeList.h
${MAIN_LIB_DIR}/serializer/JsonDeserializer.h ${MAIN_LIB_DIR}/serializer/JsonDeserializer.h

View File

@ -21,9 +21,8 @@
#include "bonuses/Propagators.h" #include "bonuses/Propagators.h"
#include "bonuses/Updaters.h" #include "bonuses/Updaters.h"
#include "serializer/CSerializer.h" // for SAVEGAME_MAGIC #include "serializer/CLoadFile.h"
#include "serializer/BinaryDeserializer.h" #include "serializer/CSaveFile.h"
#include "serializer/BinarySerializer.h"
#include "rmg/CMapGenOptions.h" #include "rmg/CMapGenOptions.h"
#include "mapObjectConstructors/AObjectTypeHandler.h" #include "mapObjectConstructors/AObjectTypeHandler.h"
#include "mapObjectConstructors/CObjectClassesHandler.h" #include "mapObjectConstructors/CObjectClassesHandler.h"

View File

@ -42,7 +42,7 @@
#include "../modding/IdentifierStorage.h" #include "../modding/IdentifierStorage.h"
#include "../pathfinder/CPathfinder.h" #include "../pathfinder/CPathfinder.h"
#include "../pathfinder/PathfinderOptions.h" #include "../pathfinder/PathfinderOptions.h"
#include "../registerTypes/RegisterTypes.h" #include "../registerTypes/RegisterTypesClientPacks.h"
#include "../rmg/CMapGenerator.h" #include "../rmg/CMapGenerator.h"
#include "../serializer/CMemorySerializer.h" #include "../serializer/CMemorySerializer.h"
#include "../serializer/CTypeList.h" #include "../serializer/CTypeList.h"
@ -157,8 +157,7 @@ CGameState::CGameState()
gs = this; gs = this;
heroesPool = std::make_unique<TavernHeroesPool>(); heroesPool = std::make_unique<TavernHeroesPool>();
applier = std::make_shared<CApplier<CBaseForGSApply>>(); applier = std::make_shared<CApplier<CBaseForGSApply>>();
registerTypesClientPacks1(*applier); registerTypesClientPacks(*applier);
registerTypesClientPacks2(*applier);
globalEffects.setNodeType(CBonusSystemNode::GLOBAL_EFFECTS); globalEffects.setNodeType(CBonusSystemNode::GLOBAL_EFFECTS);
} }

View File

@ -21,7 +21,7 @@
#include "../campaign/CampaignHandler.h" #include "../campaign/CampaignHandler.h"
#include "../filesystem/Filesystem.h" #include "../filesystem/Filesystem.h"
#include "../serializer/CMemorySerializer.h" #include "../serializer/CLoadFile.h"
#include "../CGeneralTextHandler.h" #include "../CGeneralTextHandler.h"
#include "../rmg/CMapGenOptions.h" #include "../rmg/CMapGenOptions.h"
#include "../CCreatureHandler.h" #include "../CCreatureHandler.h"

View File

@ -1,51 +0,0 @@
/*
* RegisterTypes.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#define INSTANTIATE_REGISTER_TYPES_HERE
#include "RegisterTypes.h"
#include "../mapping/CMapInfo.h"
#include "../StartInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../spells/CSpellHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
// For reference: peak memory usage by gcc during compilation of register type templates
// registerTypesMapObjects: 1.9 Gb
// registerTypes2: 2.2 Gb
// registerTypesClientPacks1 1.6 Gb
// registerTypesClientPacks2 1.6 Gb
// registerTypesServerPacks: 1.3 Gb
// registerTypes4: 1.3 Gb
#define DEFINE_EXTERNAL_METHOD(METHODNAME) \
extern template DLL_LINKAGE void METHODNAME<BinaryDeserializer>(BinaryDeserializer & s); \
extern template DLL_LINKAGE void METHODNAME<BinarySerializer>(BinarySerializer & s);
//DEFINE_EXTERNAL_METHOD(registerTypesMapObjects)
DEFINE_EXTERNAL_METHOD(registerTypesMapObjects1)
DEFINE_EXTERNAL_METHOD(registerTypesMapObjects2)
DEFINE_EXTERNAL_METHOD(registerTypesClientPacks1)
DEFINE_EXTERNAL_METHOD(registerTypesClientPacks2)
DEFINE_EXTERNAL_METHOD(registerTypesServerPacks)
DEFINE_EXTERNAL_METHOD(registerTypesLobbyPacks)
template void registerTypes<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypes<BinarySerializer>(BinarySerializer & s);
template void registerTypes<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -9,351 +9,20 @@
*/ */
#pragma once #pragma once
#include "../networkPacks/PacksForClient.h" #include "RegisterTypesClientPacks.h"
#include "../networkPacks/PacksForClientBattle.h" #include "RegisterTypesLobbyPacks.h"
#include "../networkPacks/PacksForServer.h" #include "RegisterTypesMapObjects.h"
#include "../networkPacks/PacksForLobby.h" #include "RegisterTypesServerPacks.h"
#include "../networkPacks/SetStackEffect.h"
#include "../mapObjectConstructors/CBankInstanceConstructor.h"
#include "../mapObjects/MapObjects.h"
#include "../mapObjects/CGCreature.h"
#include "../mapObjects/CGTownBuilding.h"
#include "../mapObjects/ObjectTemplate.h"
#include "../battle/BattleInfo.h"
#include "../battle/CObstacleInstance.h"
#include "../bonuses/Limiters.h"
#include "../bonuses/Updaters.h"
#include "../bonuses/Propagators.h"
#include "../CPlayerState.h"
#include "../CStack.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
class BinarySerializer;
class BinaryDeserializer;
class CTypeList;
template<typename Serializer>
void registerTypesMapObjects1(Serializer &s)
{
//////////////////////////////////////////////////////////////////////////
// Adventure map objects
//////////////////////////////////////////////////////////////////////////
s.template registerType<IObjectInterface, CGObjectInstance>();
// Non-armed objects
s.template registerType<CGObjectInstance, CGTeleport>();
s.template registerType<CGTeleport, CGMonolith>();
s.template registerType<CGMonolith, CGSubterraneanGate>();
s.template registerType<CGMonolith, CGWhirlpool>();
s.template registerType<CGObjectInstance, CGSignBottle>();
s.template registerType<CGObjectInstance, CGKeys>();
s.template registerType<CGKeys, CGKeymasterTent>();
s.template registerType<CGKeys, CGBorderGuard>(); s.template registerType<IQuestObject, CGBorderGuard>();
s.template registerType<CGBorderGuard, CGBorderGate>();
s.template registerType<CGObjectInstance, CGBoat>();
s.template registerType<CGObjectInstance, CGMagi>();
s.template registerType<CGObjectInstance, CGSirens>();
s.template registerType<CGObjectInstance, CGShipyard>();
s.template registerType<CGObjectInstance, CGDenOfthieves>();
s.template registerType<CGObjectInstance, CGLighthouse>();
s.template registerType<CGObjectInstance, CGTerrainPatch>();
s.template registerType<CGObjectInstance, HillFort>();
s.template registerType<CGObjectInstance, CGMarket>();
s.template registerType<CGMarket, CGBlackMarket>();
s.template registerType<CGMarket, CGUniversity>();
s.template registerType<CGObjectInstance, CGHeroPlaceholder>();
s.template registerType<CGObjectInstance, CArmedInstance>(); s.template registerType<CBonusSystemNode, CArmedInstance>(); s.template registerType<CCreatureSet, CArmedInstance>();
// Armed objects
s.template registerType<CArmedInstance, CGHeroInstance>(); s.template registerType<CArtifactSet, CGHeroInstance>();
s.template registerType<CArmedInstance, CGDwelling>();
s.template registerType<CGDwelling, CGTownInstance>();
s.template registerType<CArmedInstance, CGPandoraBox>();
s.template registerType<CGPandoraBox, CGEvent>();
s.template registerType<CArmedInstance, CGCreature>();
s.template registerType<CArmedInstance, CGGarrison>();
s.template registerType<CArmedInstance, CGArtifact>();
s.template registerType<CArmedInstance, CGResource>();
s.template registerType<CArmedInstance, CGMine>();
s.template registerType<CArmedInstance, CBank>();
s.template registerType<CArmedInstance, CGSeerHut>(); s.template registerType<IQuestObject, CGSeerHut>();
s.template registerType<CGSeerHut, CGQuestGuard>();
}
template<typename Serializer>
void registerTypesMapObjectTypes(Serializer &s)
{
s.template registerType<IUpdater, GrowsWithLevelUpdater>();
s.template registerType<IUpdater, TimesHeroLevelUpdater>();
s.template registerType<IUpdater, TimesStackLevelUpdater>();
s.template registerType<IUpdater, OwnerUpdater>();
s.template registerType<IUpdater, ArmyMovementUpdater>();
s.template registerType<ILimiter, AnyOfLimiter>();
s.template registerType<ILimiter, NoneOfLimiter>();
s.template registerType<ILimiter, OppositeSideLimiter>();
//new types (other than netpacks) must register here
//order of type registration is critical for loading old savegames
}
template<typename Serializer>
void registerTypesMapObjects2(Serializer &s)
{
//Other object-related
s.template registerType<IObjectInterface, CGTownBuilding>();
s.template registerType<CGTownBuilding, CTownBonus>();
s.template registerType<CGTownBuilding, COPWBonus>();
s.template registerType<CGTownBuilding, CTownRewardableBuilding>();
s.template registerType<CGObjectInstance, CRewardableObject>();
s.template registerType<CGObjectInstance, CTeamVisited>();
s.template registerType<CTeamVisited, CGObelisk>();
//s.template registerType<CQuest>();
//s.template registerType<IQuestObject>();
//end of objects
//////////////////////////////////////////////////////////////////////////
// Bonus system
//////////////////////////////////////////////////////////////////////////
//s.template registerType<IPropagator>();
s.template registerType<IPropagator, CPropagatorNodeType>();
// Limiters
//s.template registerType<ILimiter>();
s.template registerType<ILimiter, AllOfLimiter>();
s.template registerType<ILimiter, CCreatureTypeLimiter>();
s.template registerType<ILimiter, HasAnotherBonusLimiter>();
s.template registerType<ILimiter, CreatureTerrainLimiter>();
s.template registerType<ILimiter, FactionLimiter>();
s.template registerType<ILimiter, CreatureLevelLimiter>();
s.template registerType<ILimiter, CreatureAlignmentLimiter>();
s.template registerType<ILimiter, RankRangeLimiter>();
s.template registerType<ILimiter, UnitOnHexLimiter>();
// s.template registerType<CBonusSystemNode>();
s.template registerType<CBonusSystemNode, CArtifact>();
s.template registerType<CBonusSystemNode, CCreature>();
s.template registerType<CBonusSystemNode, CStackInstance>();
s.template registerType<CStackInstance, CCommanderInstance>();
s.template registerType<CBonusSystemNode, PlayerState>();
s.template registerType<CBonusSystemNode, TeamState>();
//s.template registerType<CGameState>(); //TODO
//s.template registerType<CArmedInstance>();
s.template registerType<CBonusSystemNode, CStack>();
s.template registerType<CBonusSystemNode, BattleInfo>();
//s.template registerType<QuestInfo>();
s.template registerType<CBonusSystemNode, CArtifactInstance>();
//s.template registerType<CObstacleInstance>();
s.template registerType<CObstacleInstance, SpellCreatedObstacle>();
}
template<typename Serializer>
void registerTypesClientPacks1(Serializer &s)
{
s.template registerType<CPack, CPackForClient>();
s.template registerType<CPackForClient, PackageApplied>();
s.template registerType<CPackForClient, SystemMessage>();
s.template registerType<CPackForClient, PlayerBlocked>();
s.template registerType<CPackForClient, PlayerCheated>();
s.template registerType<CPackForClient, PlayerStartsTurn>();
s.template registerType<CPackForClient, DaysWithoutTown>();
s.template registerType<CPackForClient, TurnTimeUpdate>();
s.template registerType<CPackForClient, SetResources>();
s.template registerType<CPackForClient, SetPrimSkill>();
s.template registerType<CPackForClient, SetSecSkill>();
s.template registerType<CPackForClient, HeroVisitCastle>();
s.template registerType<CPackForClient, ChangeSpells>();
s.template registerType<CPackForClient, SetMana>();
s.template registerType<CPackForClient, SetMovePoints>();
s.template registerType<CPackForClient, FoWChange>();
s.template registerType<CPackForClient, SetAvailableHero>();
s.template registerType<CPackForClient, GiveBonus>();
s.template registerType<CPackForClient, ChangeObjPos>();
s.template registerType<CPackForClient, PlayerEndsTurn>();
s.template registerType<CPackForClient, PlayerEndsGame>();
s.template registerType<CPackForClient, PlayerReinitInterface>();
s.template registerType<CPackForClient, RemoveBonus>();
s.template registerType<CPackForClient, UpdateArtHandlerLists>();
s.template registerType<CPackForClient, UpdateMapEvents>();
s.template registerType<CPackForClient, UpdateCastleEvents>();
s.template registerType<CPackForClient, ChangeFormation>();
s.template registerType<CPackForClient, RemoveObject>();
s.template registerType<CPackForClient, TryMoveHero>();
s.template registerType<CPackForClient, NewStructures>();
s.template registerType<CPackForClient, RazeStructures>();
s.template registerType<CPackForClient, SetAvailableCreatures>();
s.template registerType<CPackForClient, SetHeroesInTown>();
s.template registerType<CPackForClient, HeroRecruited>();
s.template registerType<CPackForClient, GiveHero>();
s.template registerType<CPackForClient, NewTurn>();
s.template registerType<CPackForClient, InfoWindow>();
s.template registerType<CPackForClient, SetObjectProperty>();
s.template registerType<CPackForClient, AdvmapSpellCast>();
s.template registerType<CPackForClient, OpenWindow>();
s.template registerType<CPackForClient, NewObject>();
s.template registerType<CPackForClient, NewArtifact>();
s.template registerType<CPackForClient, AddQuest>();
s.template registerType<CPackForClient, SetAvailableArtifacts>();
s.template registerType<CPackForClient, CenterView>();
s.template registerType<CPackForClient, HeroVisit>();
s.template registerType<CPackForClient, SetCommanderProperty>();
s.template registerType<CPackForClient, ChangeObjectVisitors>();
s.template registerType<CPackForClient, ShowWorldViewEx>();
s.template registerType<CPackForClient, PrepareHeroLevelUp>();
s.template registerType<CPackForClient, EntitiesChanged>();
}
template<typename Serializer>
void registerTypesClientPacks2(Serializer &s)
{
s.template registerType<CPackForClient, BattleStart>();
s.template registerType<CPackForClient, BattleNextRound>();
s.template registerType<CPackForClient, BattleSetActiveStack>();
s.template registerType<CPackForClient, BattleResult>();
s.template registerType<CPackForClient, BattleResultAccepted>();
s.template registerType<CPackForClient, BattleCancelled>();
s.template registerType<CPackForClient, BattleLogMessage>();
s.template registerType<CPackForClient, BattleStackMoved>();
s.template registerType<CPackForClient, BattleAttack>();
s.template registerType<CPackForClient, StartAction>();
s.template registerType<CPackForClient, EndAction>();
s.template registerType<CPackForClient, BattleSpellCast>();
s.template registerType<CPackForClient, SetStackEffect>();
s.template registerType<CPackForClient, BattleTriggerEffect>();
s.template registerType<CPackForClient, BattleUpdateGateState>();
s.template registerType<CPackForClient, BattleSetStackProperty>();
s.template registerType<CPackForClient, StacksInjured>();
s.template registerType<CPackForClient, BattleResultsApplied>();
s.template registerType<CPackForClient, BattleUnitsChanged>();
s.template registerType<CPackForClient, BattleObstaclesChanged>();
s.template registerType<CPackForClient, CatapultAttack>();
s.template registerType<CPackForClient, Query>();
s.template registerType<Query, HeroLevelUp>();
s.template registerType<Query, CommanderLevelUp>();
s.template registerType<Query, BlockingDialog>();
s.template registerType<Query, GarrisonDialog>();
s.template registerType<Query, ExchangeDialog>();
s.template registerType<Query, TeleportDialog>();
s.template registerType<Query, MapObjectSelectDialog>();
s.template registerType<CPackForClient, CGarrisonOperationPack>();
s.template registerType<CGarrisonOperationPack, ChangeStackCount>();
s.template registerType<CGarrisonOperationPack, SetStackType>();
s.template registerType<CGarrisonOperationPack, EraseStack>();
s.template registerType<CGarrisonOperationPack, SwapStacks>();
s.template registerType<CGarrisonOperationPack, InsertNewStack>();
s.template registerType<CGarrisonOperationPack, RebalanceStacks>();
s.template registerType<CPackForClient, CArtifactOperationPack>();
s.template registerType<CArtifactOperationPack, PutArtifact>();
s.template registerType<CArtifactOperationPack, EraseArtifact>();
s.template registerType<CArtifactOperationPack, MoveArtifact>();
s.template registerType<CArtifactOperationPack, AssembledArtifact>();
s.template registerType<CArtifactOperationPack, DisassembledArtifact>();
s.template registerType<CArtifactOperationPack, BulkMoveArtifacts>();
s.template registerType<CPackForClient, PlayerMessageClient>();
s.template registerType<CGarrisonOperationPack, BulkRebalanceStacks>();
s.template registerType<CGarrisonOperationPack, BulkSmartRebalanceStacks>();
}
template<typename Serializer>
void registerTypesServerPacks(Serializer &s)
{
s.template registerType<CPack, CPackForServer>();
s.template registerType<CPackForServer, EndTurn>();
s.template registerType<CPackForServer, DismissHero>();
s.template registerType<CPackForServer, MoveHero>();
s.template registerType<CPackForServer, ArrangeStacks>();
s.template registerType<CPackForServer, DisbandCreature>();
s.template registerType<CPackForServer, BuildStructure>();
s.template registerType<CPackForServer, RecruitCreatures>();
s.template registerType<CPackForServer, UpgradeCreature>();
s.template registerType<CPackForServer, GarrisonHeroSwap>();
s.template registerType<CPackForServer, ExchangeArtifacts>();
s.template registerType<CPackForServer, AssembleArtifacts>();
s.template registerType<CPackForServer, BuyArtifact>();
s.template registerType<CPackForServer, TradeOnMarketplace>();
s.template registerType<CPackForServer, SetFormation>();
s.template registerType<CPackForServer, HireHero>();
s.template registerType<CPackForServer, BuildBoat>();
s.template registerType<CPackForServer, QueryReply>();
s.template registerType<CPackForServer, MakeAction>();
s.template registerType<CPackForServer, DigWithHero>();
s.template registerType<CPackForServer, CastAdvSpell>();
s.template registerType<CPackForServer, CastleTeleportHero>();
s.template registerType<CPackForServer, SaveGame>();
s.template registerType<CPackForServer, PlayerMessage>();
s.template registerType<CPackForServer, BulkSplitStack>();
s.template registerType<CPackForServer, BulkMergeStacks>();
s.template registerType<CPackForServer, BulkSmartSplitStack>();
s.template registerType<CPackForServer, BulkMoveArmy>();
s.template registerType<CPackForServer, BulkExchangeArtifacts>();
s.template registerType<CPackForServer, EraseArtifactByClient>();
s.template registerType<CPackForServer, GamePause>();
}
template<typename Serializer>
void registerTypesLobbyPacks(Serializer &s)
{
s.template registerType<CPack, CPackForLobby>();
s.template registerType<CPackForLobby, CLobbyPackToPropagate>();
s.template registerType<CPackForLobby, CLobbyPackToServer>();
// Any client can sent
s.template registerType<CLobbyPackToPropagate, LobbyClientConnected>();
s.template registerType<CLobbyPackToPropagate, LobbyClientDisconnected>();
s.template registerType<CLobbyPackToPropagate, LobbyChatMessage>();
// Only host client send
s.template registerType<CLobbyPackToPropagate, LobbyGuiAction>();
s.template registerType<CLobbyPackToPropagate, LobbyLoadProgress>();
s.template registerType<CLobbyPackToPropagate, LobbyEndGame>();
s.template registerType<CLobbyPackToPropagate, LobbyStartGame>();
s.template registerType<CLobbyPackToPropagate, LobbyChangeHost>();
// Only server send
s.template registerType<CLobbyPackToPropagate, LobbyUpdateState>();
s.template registerType<CLobbyPackToPropagate, LobbyShowMessage>();
// For client with permissions
s.template registerType<CLobbyPackToServer, LobbyChangePlayerOption>();
// Only for host client
s.template registerType<CLobbyPackToServer, LobbySetMap>();
s.template registerType<CLobbyPackToServer, LobbySetCampaign>();
s.template registerType<CLobbyPackToServer, LobbySetCampaignMap>();
s.template registerType<CLobbyPackToServer, LobbySetCampaignBonus>();
s.template registerType<CLobbyPackToServer, LobbySetPlayer>();
s.template registerType<CLobbyPackToServer, LobbySetPlayerName>();
s.template registerType<CLobbyPackToServer, LobbySetTurnTime>();
s.template registerType<CLobbyPackToServer, LobbySetSimturns>();
s.template registerType<CLobbyPackToServer, LobbySetDifficulty>();
s.template registerType<CLobbyPackToServer, LobbyForceSetPlayer>();
}
template<typename Serializer> template<typename Serializer>
void registerTypes(Serializer &s) void registerTypes(Serializer &s)
{ {
registerTypesMapObjects1(s); registerTypesMapObjects(s);
registerTypesMapObjects2(s); registerTypesClientPacks(s);
registerTypesMapObjectTypes(s);
registerTypesClientPacks1(s);
registerTypesClientPacks2(s);
registerTypesServerPacks(s); registerTypesServerPacks(s);
registerTypesLobbyPacks(s); registerTypesLobbyPacks(s);
} }
#ifndef INSTANTIATE_REGISTER_TYPES_HERE
extern template DLL_LINKAGE void registerTypes<BinaryDeserializer>(BinaryDeserializer & s);
extern template DLL_LINKAGE void registerTypes<BinarySerializer>(BinarySerializer & s);
#endif
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,125 @@
/*
* RegisterTypesClientPacks.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../networkPacks/PacksForClient.h"
#include "../networkPacks/PacksForClientBattle.h"
#include "../networkPacks/SetStackEffect.h"
VCMI_LIB_NAMESPACE_BEGIN
template<typename Serializer>
void registerTypesClientPacks(Serializer &s)
{
s.template registerType<CPack, CPackForClient>();
s.template registerType<CPackForClient, PackageApplied>();
s.template registerType<CPackForClient, SystemMessage>();
s.template registerType<CPackForClient, PlayerBlocked>();
s.template registerType<CPackForClient, PlayerCheated>();
s.template registerType<CPackForClient, PlayerStartsTurn>();
s.template registerType<CPackForClient, DaysWithoutTown>();
s.template registerType<CPackForClient, TurnTimeUpdate>();
s.template registerType<CPackForClient, SetResources>();
s.template registerType<CPackForClient, SetPrimSkill>();
s.template registerType<CPackForClient, SetSecSkill>();
s.template registerType<CPackForClient, HeroVisitCastle>();
s.template registerType<CPackForClient, ChangeSpells>();
s.template registerType<CPackForClient, SetMana>();
s.template registerType<CPackForClient, SetMovePoints>();
s.template registerType<CPackForClient, FoWChange>();
s.template registerType<CPackForClient, SetAvailableHero>();
s.template registerType<CPackForClient, GiveBonus>();
s.template registerType<CPackForClient, ChangeObjPos>();
s.template registerType<CPackForClient, PlayerEndsTurn>();
s.template registerType<CPackForClient, PlayerEndsGame>();
s.template registerType<CPackForClient, PlayerReinitInterface>();
s.template registerType<CPackForClient, RemoveBonus>();
s.template registerType<CPackForClient, UpdateArtHandlerLists>();
s.template registerType<CPackForClient, UpdateMapEvents>();
s.template registerType<CPackForClient, UpdateCastleEvents>();
s.template registerType<CPackForClient, ChangeFormation>();
s.template registerType<CPackForClient, RemoveObject>();
s.template registerType<CPackForClient, TryMoveHero>();
s.template registerType<CPackForClient, NewStructures>();
s.template registerType<CPackForClient, RazeStructures>();
s.template registerType<CPackForClient, SetAvailableCreatures>();
s.template registerType<CPackForClient, SetHeroesInTown>();
s.template registerType<CPackForClient, HeroRecruited>();
s.template registerType<CPackForClient, GiveHero>();
s.template registerType<CPackForClient, NewTurn>();
s.template registerType<CPackForClient, InfoWindow>();
s.template registerType<CPackForClient, SetObjectProperty>();
s.template registerType<CPackForClient, AdvmapSpellCast>();
s.template registerType<CPackForClient, OpenWindow>();
s.template registerType<CPackForClient, NewObject>();
s.template registerType<CPackForClient, NewArtifact>();
s.template registerType<CPackForClient, AddQuest>();
s.template registerType<CPackForClient, SetAvailableArtifacts>();
s.template registerType<CPackForClient, CenterView>();
s.template registerType<CPackForClient, HeroVisit>();
s.template registerType<CPackForClient, SetCommanderProperty>();
s.template registerType<CPackForClient, ChangeObjectVisitors>();
s.template registerType<CPackForClient, ShowWorldViewEx>();
s.template registerType<CPackForClient, PrepareHeroLevelUp>();
s.template registerType<CPackForClient, EntitiesChanged>();
s.template registerType<CPackForClient, BattleStart>();
s.template registerType<CPackForClient, BattleNextRound>();
s.template registerType<CPackForClient, BattleSetActiveStack>();
s.template registerType<CPackForClient, BattleResult>();
s.template registerType<CPackForClient, BattleResultAccepted>();
s.template registerType<CPackForClient, BattleCancelled>();
s.template registerType<CPackForClient, BattleLogMessage>();
s.template registerType<CPackForClient, BattleStackMoved>();
s.template registerType<CPackForClient, BattleAttack>();
s.template registerType<CPackForClient, StartAction>();
s.template registerType<CPackForClient, EndAction>();
s.template registerType<CPackForClient, BattleSpellCast>();
s.template registerType<CPackForClient, SetStackEffect>();
s.template registerType<CPackForClient, BattleTriggerEffect>();
s.template registerType<CPackForClient, BattleUpdateGateState>();
s.template registerType<CPackForClient, BattleSetStackProperty>();
s.template registerType<CPackForClient, StacksInjured>();
s.template registerType<CPackForClient, BattleResultsApplied>();
s.template registerType<CPackForClient, BattleUnitsChanged>();
s.template registerType<CPackForClient, BattleObstaclesChanged>();
s.template registerType<CPackForClient, CatapultAttack>();
s.template registerType<CPackForClient, Query>();
s.template registerType<Query, HeroLevelUp>();
s.template registerType<Query, CommanderLevelUp>();
s.template registerType<Query, BlockingDialog>();
s.template registerType<Query, GarrisonDialog>();
s.template registerType<Query, ExchangeDialog>();
s.template registerType<Query, TeleportDialog>();
s.template registerType<Query, MapObjectSelectDialog>();
s.template registerType<CPackForClient, CGarrisonOperationPack>();
s.template registerType<CGarrisonOperationPack, ChangeStackCount>();
s.template registerType<CGarrisonOperationPack, SetStackType>();
s.template registerType<CGarrisonOperationPack, EraseStack>();
s.template registerType<CGarrisonOperationPack, SwapStacks>();
s.template registerType<CGarrisonOperationPack, InsertNewStack>();
s.template registerType<CGarrisonOperationPack, RebalanceStacks>();
s.template registerType<CPackForClient, CArtifactOperationPack>();
s.template registerType<CArtifactOperationPack, PutArtifact>();
s.template registerType<CArtifactOperationPack, EraseArtifact>();
s.template registerType<CArtifactOperationPack, MoveArtifact>();
s.template registerType<CArtifactOperationPack, AssembledArtifact>();
s.template registerType<CArtifactOperationPack, DisassembledArtifact>();
s.template registerType<CArtifactOperationPack, BulkMoveArtifacts>();
s.template registerType<CPackForClient, PlayerMessageClient>();
s.template registerType<CGarrisonOperationPack, BulkRebalanceStacks>();
s.template registerType<CGarrisonOperationPack, BulkSmartRebalanceStacks>();
}
VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,62 @@
/*
* RegisterTypesLobbyPacks.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../networkPacks/PacksForLobby.h"
#include "../gameState/CGameState.h"
#include "../campaign/CampaignState.h"
#include "../mapping/CMapInfo.h"
#include "../rmg/CMapGenOptions.h"
#include "../gameState/TavernHeroesPool.h"
#include "../gameState/CGameStateCampaign.h"
#include "../mapping/CMap.h"
#include "../TerrainHandler.h"
#include "../RiverHandler.h"
#include "../RoadHandler.h"
VCMI_LIB_NAMESPACE_BEGIN
template<typename Serializer>
void registerTypesLobbyPacks(Serializer &s)
{
s.template registerType<CPack, CPackForLobby>();
s.template registerType<CPackForLobby, CLobbyPackToPropagate>();
s.template registerType<CPackForLobby, CLobbyPackToServer>();
// Any client can sent
s.template registerType<CLobbyPackToPropagate, LobbyClientConnected>();
s.template registerType<CLobbyPackToPropagate, LobbyClientDisconnected>();
s.template registerType<CLobbyPackToPropagate, LobbyChatMessage>();
// Only host client send
s.template registerType<CLobbyPackToPropagate, LobbyGuiAction>();
s.template registerType<CLobbyPackToPropagate, LobbyLoadProgress>();
s.template registerType<CLobbyPackToPropagate, LobbyEndGame>();
s.template registerType<CLobbyPackToPropagate, LobbyStartGame>();
s.template registerType<CLobbyPackToPropagate, LobbyChangeHost>();
// Only server send
s.template registerType<CLobbyPackToPropagate, LobbyUpdateState>();
s.template registerType<CLobbyPackToPropagate, LobbyShowMessage>();
// For client with permissions
s.template registerType<CLobbyPackToServer, LobbyChangePlayerOption>();
// Only for host client
s.template registerType<CLobbyPackToServer, LobbySetMap>();
s.template registerType<CLobbyPackToServer, LobbySetCampaign>();
s.template registerType<CLobbyPackToServer, LobbySetCampaignMap>();
s.template registerType<CLobbyPackToServer, LobbySetCampaignBonus>();
s.template registerType<CLobbyPackToServer, LobbySetPlayer>();
s.template registerType<CLobbyPackToServer, LobbySetPlayerName>();
s.template registerType<CLobbyPackToServer, LobbySetTurnTime>();
s.template registerType<CLobbyPackToServer, LobbySetSimturns>();
s.template registerType<CLobbyPackToServer, LobbySetDifficulty>();
s.template registerType<CLobbyPackToServer, LobbyForceSetPlayer>();
}
VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,137 @@
/*
* RegisterTypesMapObjects.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../mapObjectConstructors/CBankInstanceConstructor.h"
#include "../mapObjects/MapObjects.h"
#include "../mapObjects/CGCreature.h"
#include "../mapObjects/CGTownBuilding.h"
#include "../mapObjects/ObjectTemplate.h"
#include "../battle/BattleInfo.h"
#include "../battle/CObstacleInstance.h"
#include "../bonuses/Limiters.h"
#include "../bonuses/Updaters.h"
#include "../bonuses/Propagators.h"
#include "../CPlayerState.h"
#include "../CStack.h"
#include "../CHeroHandler.h"
VCMI_LIB_NAMESPACE_BEGIN
template<typename Serializer>
void registerTypesMapObjects(Serializer &s)
{
//////////////////////////////////////////////////////////////////////////
// Adventure map objects
//////////////////////////////////////////////////////////////////////////
s.template registerType<IObjectInterface, CGObjectInstance>();
// Non-armed objects
s.template registerType<CGObjectInstance, CGTeleport>();
s.template registerType<CGTeleport, CGMonolith>();
s.template registerType<CGMonolith, CGSubterraneanGate>();
s.template registerType<CGMonolith, CGWhirlpool>();
s.template registerType<CGObjectInstance, CGSignBottle>();
s.template registerType<CGObjectInstance, CGKeys>();
s.template registerType<CGKeys, CGKeymasterTent>();
s.template registerType<CGKeys, CGBorderGuard>(); s.template registerType<IQuestObject, CGBorderGuard>();
s.template registerType<CGBorderGuard, CGBorderGate>();
s.template registerType<CGObjectInstance, CGBoat>();
s.template registerType<CGObjectInstance, CGMagi>();
s.template registerType<CGObjectInstance, CGSirens>();
s.template registerType<CGObjectInstance, CGShipyard>();
s.template registerType<CGObjectInstance, CGDenOfthieves>();
s.template registerType<CGObjectInstance, CGLighthouse>();
s.template registerType<CGObjectInstance, CGTerrainPatch>();
s.template registerType<CGObjectInstance, HillFort>();
s.template registerType<CGObjectInstance, CGMarket>();
s.template registerType<CGMarket, CGBlackMarket>();
s.template registerType<CGMarket, CGUniversity>();
s.template registerType<CGObjectInstance, CGHeroPlaceholder>();
s.template registerType<CGObjectInstance, CArmedInstance>(); s.template registerType<CBonusSystemNode, CArmedInstance>(); s.template registerType<CCreatureSet, CArmedInstance>();
// Armed objects
s.template registerType<CArmedInstance, CGHeroInstance>(); s.template registerType<CArtifactSet, CGHeroInstance>();
s.template registerType<CArmedInstance, CGDwelling>();
s.template registerType<CGDwelling, CGTownInstance>();
s.template registerType<CArmedInstance, CGPandoraBox>();
s.template registerType<CGPandoraBox, CGEvent>();
s.template registerType<CArmedInstance, CGCreature>();
s.template registerType<CArmedInstance, CGGarrison>();
s.template registerType<CArmedInstance, CGArtifact>();
s.template registerType<CArmedInstance, CGResource>();
s.template registerType<CArmedInstance, CGMine>();
s.template registerType<CArmedInstance, CBank>();
s.template registerType<CArmedInstance, CGSeerHut>(); s.template registerType<IQuestObject, CGSeerHut>();
s.template registerType<CGSeerHut, CGQuestGuard>();
s.template registerType<IUpdater, GrowsWithLevelUpdater>();
s.template registerType<IUpdater, TimesHeroLevelUpdater>();
s.template registerType<IUpdater, TimesStackLevelUpdater>();
s.template registerType<IUpdater, OwnerUpdater>();
s.template registerType<IUpdater, ArmyMovementUpdater>();
s.template registerType<ILimiter, AnyOfLimiter>();
s.template registerType<ILimiter, NoneOfLimiter>();
s.template registerType<ILimiter, OppositeSideLimiter>();
//new types (other than netpacks) must register here
//order of type registration is critical for loading old savegames
//Other object-related
s.template registerType<IObjectInterface, CGTownBuilding>();
s.template registerType<CGTownBuilding, CTownBonus>();
s.template registerType<CGTownBuilding, COPWBonus>();
s.template registerType<CGTownBuilding, CTownRewardableBuilding>();
s.template registerType<CGObjectInstance, CRewardableObject>();
s.template registerType<CGObjectInstance, CTeamVisited>();
s.template registerType<CTeamVisited, CGObelisk>();
//end of objects
//////////////////////////////////////////////////////////////////////////
// Bonus system
//////////////////////////////////////////////////////////////////////////
//s.template registerType<IPropagator>();
s.template registerType<IPropagator, CPropagatorNodeType>();
// Limiters
//s.template registerType<ILimiter>();
s.template registerType<ILimiter, AllOfLimiter>();
s.template registerType<ILimiter, CCreatureTypeLimiter>();
s.template registerType<ILimiter, HasAnotherBonusLimiter>();
s.template registerType<ILimiter, CreatureTerrainLimiter>();
s.template registerType<ILimiter, FactionLimiter>();
s.template registerType<ILimiter, CreatureLevelLimiter>();
s.template registerType<ILimiter, CreatureAlignmentLimiter>();
s.template registerType<ILimiter, RankRangeLimiter>();
s.template registerType<ILimiter, UnitOnHexLimiter>();
// s.template registerType<CBonusSystemNode>();
s.template registerType<CBonusSystemNode, CArtifact>();
s.template registerType<CBonusSystemNode, CCreature>();
s.template registerType<CBonusSystemNode, CStackInstance>();
s.template registerType<CStackInstance, CCommanderInstance>();
s.template registerType<CBonusSystemNode, PlayerState>();
s.template registerType<CBonusSystemNode, TeamState>();
//s.template registerType<CGameState>(); //TODO
//s.template registerType<CArmedInstance>();
s.template registerType<CBonusSystemNode, CStack>();
s.template registerType<CBonusSystemNode, BattleInfo>();
//s.template registerType<QuestInfo>();
s.template registerType<CBonusSystemNode, CArtifactInstance>();
//s.template registerType<CObstacleInstance>();
s.template registerType<CObstacleInstance, SpellCreatedObstacle>();
}
VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,56 @@
/*
* RegisterTypesServerPacks.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../networkPacks/PacksForServer.h"
VCMI_LIB_NAMESPACE_BEGIN
class BinarySerializer;
class BinaryDeserializer;
class CTypeList;
template<typename Serializer>
void registerTypesServerPacks(Serializer &s)
{
s.template registerType<CPack, CPackForServer>();
s.template registerType<CPackForServer, EndTurn>();
s.template registerType<CPackForServer, DismissHero>();
s.template registerType<CPackForServer, MoveHero>();
s.template registerType<CPackForServer, ArrangeStacks>();
s.template registerType<CPackForServer, DisbandCreature>();
s.template registerType<CPackForServer, BuildStructure>();
s.template registerType<CPackForServer, RecruitCreatures>();
s.template registerType<CPackForServer, UpgradeCreature>();
s.template registerType<CPackForServer, GarrisonHeroSwap>();
s.template registerType<CPackForServer, ExchangeArtifacts>();
s.template registerType<CPackForServer, AssembleArtifacts>();
s.template registerType<CPackForServer, BuyArtifact>();
s.template registerType<CPackForServer, TradeOnMarketplace>();
s.template registerType<CPackForServer, SetFormation>();
s.template registerType<CPackForServer, HireHero>();
s.template registerType<CPackForServer, BuildBoat>();
s.template registerType<CPackForServer, QueryReply>();
s.template registerType<CPackForServer, MakeAction>();
s.template registerType<CPackForServer, DigWithHero>();
s.template registerType<CPackForServer, CastAdvSpell>();
s.template registerType<CPackForServer, CastleTeleportHero>();
s.template registerType<CPackForServer, SaveGame>();
s.template registerType<CPackForServer, PlayerMessage>();
s.template registerType<CPackForServer, BulkSplitStack>();
s.template registerType<CPackForServer, BulkMergeStacks>();
s.template registerType<CPackForServer, BulkSmartSplitStack>();
s.template registerType<CPackForServer, BulkMoveArmy>();
s.template registerType<CPackForServer, BulkExchangeArtifacts>();
s.template registerType<CPackForServer, EraseArtifactByClient>();
s.template registerType<CPackForServer, GamePause>();
}
VCMI_LIB_NAMESPACE_END

View File

@ -1,33 +0,0 @@
/*
* TypesClientPacks1.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../StartInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesClientPacks1<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesClientPacks1<BinarySerializer>(BinarySerializer & s);
template void registerTypesClientPacks1<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -1,37 +0,0 @@
/*
* TypesClientPacks2.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../StartInfo.h"
#include "../CStack.h"
#include "../battle/BattleInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesClientPacks2<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesClientPacks2<BinarySerializer>(BinarySerializer & s);
template void registerTypesClientPacks2<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -1,43 +0,0 @@
/*
* TypesLobbyPacks.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../mapping/CMapInfo.h"
#include "../StartInfo.h"
#include "../gameState/CGameState.h"
#include "../gameState/CGameStateCampaign.h"
#include "../gameState/TavernHeroesPool.h"
#include "../mapping/CMap.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../RoadHandler.h"
#include "../RiverHandler.h"
#include "../TerrainHandler.h"
#include "../campaign/CampaignState.h"
#include "../rmg/CMapGenOptions.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesLobbyPacks<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesLobbyPacks<BinarySerializer>(BinarySerializer & s);
template void registerTypesLobbyPacks<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -1,34 +0,0 @@
/*
* TypesMapObjects1.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../StartInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesMapObjects1<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesMapObjects1<BinarySerializer>(BinarySerializer & s);
template void registerTypesMapObjects1<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -1,36 +0,0 @@
/*
* TypesMapObjects2.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../StartInfo.h"
#include "../CStack.h"
#include "../battle/BattleInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesMapObjects2<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesMapObjects2<BinarySerializer>(BinarySerializer & s);
template void registerTypesMapObjects2<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -1,32 +0,0 @@
/*
* TypesMapObjects3.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../StartInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesMapObjectTypes<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesMapObjectTypes<BinarySerializer>(BinarySerializer & s);
template void registerTypesMapObjectTypes<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -1,32 +0,0 @@
/*
* TypesServerPacks.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RegisterTypes.h"
#include "../StartInfo.h"
#include "../mapObjects/CObjectHandler.h"
#include "../CCreatureHandler.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CHeroHandler.h"
#include "../spells/CSpellHandler.h"
#include "../CTownHandler.h"
#include "../serializer/BinaryDeserializer.h"
#include "../serializer/BinarySerializer.h"
#include "../serializer/CTypeList.h"
VCMI_LIB_NAMESPACE_BEGIN
template void registerTypesServerPacks<BinaryDeserializer>(BinaryDeserializer & s);
template void registerTypesServerPacks<BinarySerializer>(BinarySerializer & s);
template void registerTypesServerPacks<CTypeList>(CTypeList & s);
VCMI_LIB_NAMESPACE_END

View File

@ -9,97 +9,18 @@
*/ */
#include "StdInc.h" #include "StdInc.h"
#include "BinaryDeserializer.h" #include "BinaryDeserializer.h"
#include "../registerTypes/RegisterTypes.h" #include "../registerTypes/RegisterTypes.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
extern template void registerTypes<BinaryDeserializer>(BinaryDeserializer & s); BinaryDeserializer::BinaryDeserializer(IBinaryReader * r): CLoaderBase(r)
CLoadFile::CLoadFile(const boost::filesystem::path & fname, int minimalVersion)
: serializer(this)
{ {
registerTypes(serializer); saving = false;
openNextFile(fname, minimalVersion); fileVersion = 0;
} smartPointerSerialization = true;
reverseEndianess = false;
//must be instantiated in .cpp file for access to complete types of all member fields registerTypes(*this);
CLoadFile::~CLoadFile() = default;
int CLoadFile::read(void * data, unsigned size)
{
sfile->read(reinterpret_cast<char *>(data), size);
return size;
}
void CLoadFile::openNextFile(const boost::filesystem::path & fname, int minimalVersion)
{
assert(!serializer.reverseEndianess);
assert(minimalVersion <= SERIALIZATION_VERSION);
try
{
fName = fname.string();
sfile = std::make_unique<std::fstream>(fname.c_str(), std::ios::in | std::ios::binary);
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
if(!(*sfile))
THROW_FORMAT("Error: cannot open to read %s!", fName);
//we can read
char buffer[4];
sfile->read(buffer, 4);
if(std::memcmp(buffer, "VCMI", 4) != 0)
THROW_FORMAT("Error: not a VCMI file(%s)!", fName);
serializer & serializer.fileVersion;
if(serializer.fileVersion < minimalVersion)
THROW_FORMAT("Error: too old file format (%s)!", fName);
if(serializer.fileVersion > SERIALIZATION_VERSION)
{
logGlobal->warn("Warning format version mismatch: found %d when current is %d! (file %s)\n", serializer.fileVersion, SERIALIZATION_VERSION , fName);
auto * versionptr = reinterpret_cast<char *>(&serializer.fileVersion);
std::reverse(versionptr, versionptr + 4);
logGlobal->warn("Version number reversed is %x, checking...", serializer.fileVersion);
if(serializer.fileVersion == SERIALIZATION_VERSION)
{
logGlobal->warn("%s seems to have different endianness! Entering reversing mode.", fname.string());
serializer.reverseEndianess = true;
}
else
THROW_FORMAT("Error: too new file format (%s)!", fName);
}
}
catch(...)
{
clear(); //if anything went wrong, we delete file and rethrow
throw;
}
}
void CLoadFile::reportState(vstd::CLoggerBase * out)
{
out->debug("CLoadFile");
if(!!sfile && *sfile)
out->debug("\tOpened %s Position: %d", fName, sfile->tellg());
}
void CLoadFile::clear()
{
sfile = nullptr;
fName.clear();
serializer.fileVersion = 0;
}
void CLoadFile::checkMagicBytes(const std::string &text)
{
std::string loaded = text;
read((void *)loaded.data(), static_cast<unsigned int>(text.length()));
if(loaded != text)
throw std::runtime_error("Magic bytes doesn't match!");
} }
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -12,12 +12,9 @@
#include "CSerializer.h" #include "CSerializer.h"
#include "CTypeList.h" #include "CTypeList.h"
#include "../mapObjects/CGHeroInstance.h" #include "../mapObjects/CGHeroInstance.h"
#include "../../Global.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
class CStackInstance;
class DLL_LINKAGE CLoaderBase class DLL_LINKAGE CLoaderBase
{ {
protected: protected:
@ -115,7 +112,8 @@ class DLL_LINKAGE BinaryDeserializer : public CLoaderBase
} }
}; };
template <typename Type> class CPointerLoader : public IPointerLoader template <typename Type>
class CPointerLoader : public IPointerLoader
{ {
public: public:
void * loadPtr(CLoaderBase &ar, ui32 pid) const override //data is pointer to the ACTUAL POINTER void * loadPtr(CLoaderBase &ar, ui32 pid) const override //data is pointer to the ACTUAL POINTER
@ -147,13 +145,7 @@ public:
bool smartPointerSerialization; bool smartPointerSerialization;
bool saving; bool saving;
BinaryDeserializer(IBinaryReader * r): CLoaderBase(r) BinaryDeserializer(IBinaryReader * r);
{
saving = false;
fileVersion = 0;
smartPointerSerialization = true;
reverseEndianess = false;
}
template<class T> template<class T>
BinaryDeserializer & operator&(T & t) BinaryDeserializer & operator&(T & t)
@ -538,30 +530,4 @@ public:
} }
}; };
class DLL_LINKAGE CLoadFile : public IBinaryReader
{
public:
BinaryDeserializer serializer;
std::string fName;
std::unique_ptr<std::fstream> sfile;
CLoadFile(const boost::filesystem::path & fname, int minimalVersion = SERIALIZATION_VERSION); //throws!
virtual ~CLoadFile();
int read(void * data, unsigned size) override; //throws!
void openNextFile(const boost::filesystem::path & fname, int minimalVersion); //throws!
void clear();
void reportState(vstd::CLoggerBase * out) override;
void checkMagicBytes(const std::string & text);
template<class T>
CLoadFile & operator>>(T &t)
{
serializer & t;
return * this;
}
};
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -9,69 +9,15 @@
*/ */
#include "StdInc.h" #include "StdInc.h"
#include "BinarySerializer.h" #include "BinarySerializer.h"
#include "../registerTypes/RegisterTypes.h" #include "../registerTypes/RegisterTypes.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
extern template void registerTypes<BinarySerializer>(BinarySerializer & s); BinarySerializer::BinarySerializer(IBinaryWriter * w): CSaverBase(w)
CSaveFile::CSaveFile(const boost::filesystem::path &fname)
: serializer(this)
{ {
registerTypes(serializer); saving=true;
openNextFile(fname); smartPointerSerialization = true;
} registerTypes(*this);
//must be instantiated in .cpp file for access to complete types of all member fields
CSaveFile::~CSaveFile() = default;
int CSaveFile::write(const void * data, unsigned size)
{
sfile->write((char *)data,size);
return size;
}
void CSaveFile::openNextFile(const boost::filesystem::path &fname)
{
fName = fname;
try
{
sfile = std::make_unique<std::fstream>(fname.c_str(), std::ios::out | std::ios::binary);
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
if(!(*sfile))
THROW_FORMAT("Error: cannot open to write %s!", fname);
sfile->write("VCMI",4); //write magic identifier
serializer & SERIALIZATION_VERSION; //write format version
}
catch(...)
{
logGlobal->error("Failed to save to %s", fname.string());
clear();
throw;
}
}
void CSaveFile::reportState(vstd::CLoggerBase * out)
{
out->debug("CSaveFile");
if(sfile.get() && *sfile)
{
out->debug("\tOpened %s \tPosition: %d", fName, sfile->tellp());
}
}
void CSaveFile::clear()
{
fName.clear();
sfile = nullptr;
}
void CSaveFile::putMagicBytes(const std::string &text)
{
write(text.c_str(), static_cast<unsigned int>(text.length()));
} }
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -115,11 +115,7 @@ public:
bool smartPointerSerialization; bool smartPointerSerialization;
bool saving; bool saving;
BinarySerializer(IBinaryWriter * w): CSaverBase(w) BinarySerializer(IBinaryWriter * w);
{
saving=true;
smartPointerSerialization = true;
}
template<typename Base, typename Derived> template<typename Base, typename Derived>
void registerType(const Base * b = nullptr, const Derived * d = nullptr) void registerType(const Base * b = nullptr, const Derived * d = nullptr)
@ -404,30 +400,4 @@ public:
} }
}; };
class DLL_LINKAGE CSaveFile : public IBinaryWriter
{
public:
BinarySerializer serializer;
boost::filesystem::path fName;
std::unique_ptr<std::fstream> sfile;
CSaveFile(const boost::filesystem::path &fname); //throws!
~CSaveFile();
int write(const void * data, unsigned size) override;
void openNextFile(const boost::filesystem::path &fname); //throws!
void clear();
void reportState(vstd::CLoggerBase * out) override;
void putMagicBytes(const std::string &text);
template<class T>
CSaveFile & operator<<(const T &t)
{
serializer & t;
return * this;
}
};
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,100 @@
/*
* CLoadFile.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "CLoadFile.h"
VCMI_LIB_NAMESPACE_BEGIN
CLoadFile::CLoadFile(const boost::filesystem::path & fname, int minimalVersion)
: serializer(this)
{
openNextFile(fname, minimalVersion);
}
//must be instantiated in .cpp file for access to complete types of all member fields
CLoadFile::~CLoadFile() = default;
int CLoadFile::read(void * data, unsigned size)
{
sfile->read(reinterpret_cast<char *>(data), size);
return size;
}
void CLoadFile::openNextFile(const boost::filesystem::path & fname, int minimalVersion)
{
assert(!serializer.reverseEndianess);
assert(minimalVersion <= SERIALIZATION_VERSION);
try
{
fName = fname.string();
sfile = std::make_unique<std::fstream>(fname.c_str(), std::ios::in | std::ios::binary);
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
if(!(*sfile))
THROW_FORMAT("Error: cannot open to read %s!", fName);
//we can read
char buffer[4];
sfile->read(buffer, 4);
if(std::memcmp(buffer, "VCMI", 4) != 0)
THROW_FORMAT("Error: not a VCMI file(%s)!", fName);
serializer & serializer.fileVersion;
if(serializer.fileVersion < minimalVersion)
THROW_FORMAT("Error: too old file format (%s)!", fName);
if(serializer.fileVersion > SERIALIZATION_VERSION)
{
logGlobal->warn("Warning format version mismatch: found %d when current is %d! (file %s)\n", serializer.fileVersion, SERIALIZATION_VERSION , fName);
auto * versionptr = reinterpret_cast<char *>(&serializer.fileVersion);
std::reverse(versionptr, versionptr + 4);
logGlobal->warn("Version number reversed is %x, checking...", serializer.fileVersion);
if(serializer.fileVersion == SERIALIZATION_VERSION)
{
logGlobal->warn("%s seems to have different endianness! Entering reversing mode.", fname.string());
serializer.reverseEndianess = true;
}
else
THROW_FORMAT("Error: too new file format (%s)!", fName);
}
}
catch(...)
{
clear(); //if anything went wrong, we delete file and rethrow
throw;
}
}
void CLoadFile::reportState(vstd::CLoggerBase * out)
{
out->debug("CLoadFile");
if(!!sfile && *sfile)
out->debug("\tOpened %s Position: %d", fName, sfile->tellg());
}
void CLoadFile::clear()
{
sfile = nullptr;
fName.clear();
serializer.fileVersion = 0;
}
void CLoadFile::checkMagicBytes(const std::string &text)
{
std::string loaded = text;
read((void *)loaded.data(), static_cast<unsigned int>(text.length()));
if(loaded != text)
throw std::runtime_error("Magic bytes doesn't match!");
}
VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,42 @@
/*
* CLoadFile.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "BinaryDeserializer.h"
VCMI_LIB_NAMESPACE_BEGIN
class DLL_LINKAGE CLoadFile : public IBinaryReader
{
public:
BinaryDeserializer serializer;
std::string fName;
std::unique_ptr<std::fstream> sfile;
CLoadFile(const boost::filesystem::path & fname, int minimalVersion = SERIALIZATION_VERSION); //throws!
virtual ~CLoadFile();
int read(void * data, unsigned size) override; //throws!
void openNextFile(const boost::filesystem::path & fname, int minimalVersion); //throws!
void clear();
void reportState(vstd::CLoggerBase * out) override;
void checkMagicBytes(const std::string & text);
template<class T>
CLoadFile & operator>>(T &t)
{
serializer & t;
return * this;
}
};
VCMI_LIB_NAMESPACE_END

View File

@ -10,8 +10,6 @@
#include "StdInc.h" #include "StdInc.h"
#include "CMemorySerializer.h" #include "CMemorySerializer.h"
#include "../registerTypes/RegisterTypes.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
int CMemorySerializer::read(void * data, unsigned size) int CMemorySerializer::read(void * data, unsigned size)
@ -34,8 +32,6 @@ int CMemorySerializer::write(const void * data, unsigned size)
CMemorySerializer::CMemorySerializer(): iser(this), oser(this), readPos(0) CMemorySerializer::CMemorySerializer(): iser(this), oser(this), readPos(0)
{ {
registerTypes(iser);
registerTypes(oser);
iser.fileVersion = SERIALIZATION_VERSION; iser.fileVersion = SERIALIZATION_VERSION;
} }

View File

@ -0,0 +1,72 @@
/*
* CSaveFile.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "CSaveFile.h"
VCMI_LIB_NAMESPACE_BEGIN
CSaveFile::CSaveFile(const boost::filesystem::path &fname)
: serializer(this)
{
openNextFile(fname);
}
//must be instantiated in .cpp file for access to complete types of all member fields
CSaveFile::~CSaveFile() = default;
int CSaveFile::write(const void * data, unsigned size)
{
sfile->write((char *)data,size);
return size;
}
void CSaveFile::openNextFile(const boost::filesystem::path &fname)
{
fName = fname;
try
{
sfile = std::make_unique<std::fstream>(fname.c_str(), std::ios::out | std::ios::binary);
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
if(!(*sfile))
THROW_FORMAT("Error: cannot open to write %s!", fname);
sfile->write("VCMI",4); //write magic identifier
serializer & SERIALIZATION_VERSION; //write format version
}
catch(...)
{
logGlobal->error("Failed to save to %s", fname.string());
clear();
throw;
}
}
void CSaveFile::reportState(vstd::CLoggerBase * out)
{
out->debug("CSaveFile");
if(sfile.get() && *sfile)
{
out->debug("\tOpened %s \tPosition: %d", fName, sfile->tellp());
}
}
void CSaveFile::clear()
{
fName.clear();
sfile = nullptr;
}
void CSaveFile::putMagicBytes(const std::string &text)
{
write(text.c_str(), static_cast<unsigned int>(text.length()));
}
VCMI_LIB_NAMESPACE_END

View File

@ -0,0 +1,42 @@
/*
* CSaveFile.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "BinarySerializer.h"
VCMI_LIB_NAMESPACE_BEGIN
class DLL_LINKAGE CSaveFile : public IBinaryWriter
{
public:
BinarySerializer serializer;
boost::filesystem::path fName;
std::unique_ptr<std::fstream> sfile;
CSaveFile(const boost::filesystem::path &fname); //throws!
~CSaveFile();
int write(const void * data, unsigned size) override;
void openNextFile(const boost::filesystem::path &fname); //throws!
void clear();
void reportState(vstd::CLoggerBase * out) override;
void putMagicBytes(const std::string &text);
template<class T>
CSaveFile & operator<<(const T &t)
{
serializer & t;
return * this;
}
};
VCMI_LIB_NAMESPACE_END

View File

@ -10,8 +10,7 @@
#include "StdInc.h" #include "StdInc.h"
#include "Connection.h" #include "Connection.h"
#include "../registerTypes/RegisterTypes.h" #include "../networkPacks/NetPacksBase.h"
#include "../mapping/CMapHeader.h"
#include <boost/asio.hpp> #include <boost/asio.hpp>
@ -45,8 +44,6 @@ void CConnection::init()
enableSmartPointerSerialization(); enableSmartPointerSerialization();
disableStackSendingByID(); disableStackSendingByID();
registerTypes(iser);
registerTypes(oser);
#ifndef VCMI_ENDIAN_BIG #ifndef VCMI_ENDIAN_BIG
myEndianess = true; myEndianess = true;
#else #else

View File

@ -27,6 +27,7 @@
#include "../lib/CCreatureSet.h" #include "../lib/CCreatureSet.h"
#include "../lib/CGeneralTextHandler.h" #include "../lib/CGeneralTextHandler.h"
#include "../lib/CHeroHandler.h" #include "../lib/CHeroHandler.h"
#include "../lib/CPlayerState.h"
#include "../lib/CSoundBase.h" #include "../lib/CSoundBase.h"
#include "../lib/CThreadHelper.h" #include "../lib/CThreadHelper.h"
#include "../lib/CTownHandler.h" #include "../lib/CTownHandler.h"
@ -47,20 +48,19 @@
#include "../lib/mapping/CMap.h" #include "../lib/mapping/CMap.h"
#include "../lib/mapping/CMapService.h" #include "../lib/mapping/CMapService.h"
#include "../lib/mapObjects/CGMarket.h"
#include "../lib/modding/ModIncompatibility.h" #include "../lib/modding/ModIncompatibility.h"
#include "../lib/networkPacks/StackLocation.h" #include "../lib/networkPacks/StackLocation.h"
#include "../lib/pathfinder/CPathfinder.h" #include "../lib/pathfinder/CPathfinder.h"
#include "../lib/pathfinder/PathfinderOptions.h" #include "../lib/pathfinder/PathfinderOptions.h"
#include "../lib/pathfinder/TurnInfo.h" #include "../lib/pathfinder/TurnInfo.h"
#include "../lib/registerTypes/RegisterTypes.h" #include "../lib/registerTypes/RegisterTypesServerPacks.h"
#include "../lib/rmg/CMapGenOptions.h" #include "../lib/rmg/CMapGenOptions.h"
#include "../lib/serializer/CTypeList.h" #include "../lib/serializer/CSaveFile.h"
#include "../lib/serializer/Cast.h" #include "../lib/serializer/CLoadFile.h"
#include "../lib/serializer/Connection.h"
#include "../lib/serializer/JsonSerializer.h"
#include "../lib/spells/CSpellHandler.h" #include "../lib/spells/CSpellHandler.h"

View File

@ -47,7 +47,7 @@
#include "../lib/UnlockGuard.h" #include "../lib/UnlockGuard.h"
// for applier // for applier
#include "../lib/registerTypes/RegisterTypes.h" #include "../lib/registerTypes/RegisterTypesLobbyPacks.h"
// UUID generation // UUID generation
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>