mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
Rebase of codebase changes for refactored serializer
Some of newer fixes not yet merged there and save compatibility a bit off.
This commit is contained in:
parent
3d1b1f4ba8
commit
5b76c3f4eb
@ -327,13 +327,13 @@ BattleAction CStupidAI::goTowards(const CStack * stack, BattleHex destination)
|
||||
}
|
||||
}
|
||||
|
||||
void CStupidAI::saveGame(COSer & h, const int version)
|
||||
void CStupidAI::saveGame(BinarySerializer & h, const int version)
|
||||
{
|
||||
//TODO to be implemented with saving/loading during the battles
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void CStupidAI::loadGame(CISer & h, const int version)
|
||||
void CStupidAI::loadGame(BinaryDeserializer & h, const int version)
|
||||
{
|
||||
//TODO to be implemented with saving/loading during the battles
|
||||
assert(0);
|
||||
|
@ -36,8 +36,8 @@ public:
|
||||
|
||||
BattleAction goTowards(const CStack * stack, BattleHex hex );
|
||||
|
||||
virtual void saveGame(COSer & h, const int version) override;
|
||||
virtual void loadGame(CISer & h, const int version) override;
|
||||
virtual void saveGame(BinarySerializer & h, const int version) override;
|
||||
virtual void loadGame(BinaryDeserializer & h, const int version) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/Connection.h"
|
||||
#include "../../lib/CStopWatch.h"
|
||||
#include "../../lib/mapObjects/CObjectHandler.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
||||
/*
|
||||
* AIUtility.h, part of VCMI engine
|
||||
|
@ -9,7 +9,9 @@
|
||||
#include "../../lib/CModHandler.h"
|
||||
#include "../../lib/CGameState.h"
|
||||
#include "../../lib/NetPacks.h"
|
||||
|
||||
#include "../../lib/serializer/CTypeList.h"
|
||||
#include "../../lib/serializer/BinarySerializer.h"
|
||||
#include "../../lib/serializer/BinaryDeserializer.h"
|
||||
|
||||
/*
|
||||
* VCAI.cpp, part of VCMI engine
|
||||
@ -705,7 +707,7 @@ void VCAI::showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *do
|
||||
});
|
||||
}
|
||||
|
||||
void VCAI::saveGame(COSer & h, const int version)
|
||||
void VCAI::saveGame(BinarySerializer & h, const int version)
|
||||
{
|
||||
LOG_TRACE_PARAMS(logAi, "version '%i'", version);
|
||||
NET_EVENT_HANDLER;
|
||||
@ -716,7 +718,7 @@ void VCAI::saveGame(COSer & h, const int version)
|
||||
serializeInternal(h, version);
|
||||
}
|
||||
|
||||
void VCAI::loadGame(CISer & h, const int version)
|
||||
void VCAI::loadGame(BinaryDeserializer & h, const int version)
|
||||
{
|
||||
LOG_TRACE_PARAMS(logAi, "version '%i'", version);
|
||||
NET_EVENT_HANDLER;
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/mapObjects/MiscObjects.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/Connection.h"
|
||||
#include "../../lib/CondSh.h"
|
||||
|
||||
struct QuestInfo;
|
||||
@ -189,8 +188,8 @@ public:
|
||||
virtual void showBlockingDialog(const std::string &text, const std::vector<Component> &components, QueryID askID, const int soundID, bool selection, bool cancel) override; //Show a dialog, player must take decision. If selection then he has to choose between one of given components, if cancel he is allowed to not choose. After making choice, CCallback::selectionMade should be called with number of selected component (1 - n) or 0 for cancel (if allowed) and askID.
|
||||
virtual void showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, QueryID queryID) override; //all stacks operations between these objects become allowed, interface has to call onEnd when done
|
||||
virtual void showTeleportDialog(TeleportChannelID channel, TTeleportExitsList exits, bool impassable, QueryID askID) override;
|
||||
virtual void saveGame(COSer & h, const int version) override; //saving
|
||||
virtual void loadGame(CISer & h, const int version) override; //loading
|
||||
virtual void saveGame(BinarySerializer & h, const int version) override; //saving
|
||||
virtual void loadGame(BinaryDeserializer & h, const int version) override; //loading
|
||||
virtual void finish() override;
|
||||
|
||||
virtual void availableCreaturesChanged(const CGDwelling *town) override;
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "lib/mapObjects/CObjectClassesHandler.h"
|
||||
#include "lib/CGeneralTextHandler.h"
|
||||
#include "lib/CHeroHandler.h"
|
||||
#include "lib/Connection.h"
|
||||
#include "lib/NetPacks.h"
|
||||
#include "client/mapHandler.h"
|
||||
#include "lib/spells/CSpellHandler.h"
|
||||
|
5
Global.h
5
Global.h
@ -108,6 +108,10 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
||||
# define STRONG_INLINE inline
|
||||
#endif
|
||||
|
||||
#define TO_STRING_HELPER(x) #x
|
||||
#define TO_STRING(x) TO_STRING_HELPER(x)
|
||||
#define LINE_IN_FILE __FILE__ ":" TO_STRING(__LINE__)
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
|
||||
#include <cstdio>
|
||||
@ -222,7 +226,6 @@ typedef boost::lock_guard<boost::recursive_mutex> TLockGuardRec;
|
||||
# define DLL_IMPORT __attribute__ ((visibility("default")))
|
||||
# define DLL_EXPORT __attribute__ ((visibility("default")))
|
||||
# define ELF_VISIBILITY __attribute__ ((visibility("default")))
|
||||
# define ELF_VISIBILITY __attribute__ ((visibility("default")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,8 @@
|
||||
#include "Graphics.h"
|
||||
#include "Client.h"
|
||||
#include "../lib/CConfigHandler.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/serializer/BinaryDeserializer.h"
|
||||
#include "../lib/serializer/BinarySerializer.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
#include "../lib/NetPacks.h"
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include "../lib/CArtHandler.h"
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/serializer/CTypeList.h"
|
||||
#include "../lib/serializer/BinaryDeserializer.h"
|
||||
#include "../lib/serializer/BinarySerializer.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/mapObjects/CObjectClassesHandler.h" // For displaying correct UI when interacting with objects
|
||||
@ -1310,13 +1312,13 @@ template <typename Handler> void CPlayerInterface::serializeTempl( Handler &h, c
|
||||
h & spellbookSettings;
|
||||
}
|
||||
|
||||
void CPlayerInterface::saveGame( COSer & h, const int version )
|
||||
void CPlayerInterface::saveGame( BinarySerializer & h, const int version )
|
||||
{
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
serializeTempl(h,version);
|
||||
}
|
||||
|
||||
void CPlayerInterface::loadGame( CISer & h, const int version )
|
||||
void CPlayerInterface::loadGame( BinaryDeserializer & h, const int version )
|
||||
{
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
serializeTempl(h,version);
|
||||
|
@ -192,8 +192,8 @@ public:
|
||||
void gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryLossCheckResult) override;
|
||||
void playerStartsTurn(PlayerColor player) override; //called before yourTurn on active itnerface
|
||||
void showComp(const Component &comp, std::string message) override; //display component in the advmapint infobox
|
||||
void saveGame(COSer & h, const int version) override; //saving
|
||||
void loadGame(CISer & h, const int version) override; //loading
|
||||
void saveGame(BinarySerializer & h, const int version) override; //saving
|
||||
void loadGame(BinaryDeserializer & h, const int version) override; //loading
|
||||
void showWorldViewEx(const std::vector<ObjectPosInfo> & objectPositions) override;
|
||||
|
||||
//for battles
|
||||
|
@ -17,7 +17,8 @@
|
||||
#include "CMusicHandler.h"
|
||||
#include "CVideoHandler.h"
|
||||
#include "Graphics.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
#include "../lib/serializer/CTypeList.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
#include "../lib/mapping/CMap.h"
|
||||
#include "windows/GUIClasses.h"
|
||||
@ -1011,7 +1012,7 @@ void CSelectionScreen::processPacks()
|
||||
{
|
||||
CPackForSelectionScreen *pack = upcomingPacks.front();
|
||||
upcomingPacks.pop_front();
|
||||
CBaseForPGApply *apply = applier->apps[typeList.getTypeID(pack)]; //find the applier
|
||||
CBaseForPGApply *apply = applier->getApplier(typeList.getTypeID(pack)); //find the applier
|
||||
apply->applyOnPG(this, pack);
|
||||
delete pack;
|
||||
}
|
||||
|
@ -19,7 +19,9 @@
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/CBuildingHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/serializer/CTypeList.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
#include "../lib/serializer/CLoadIntegrityValidator.h"
|
||||
#ifndef VCMI_ANDROID
|
||||
#include "../lib/Interprocess.h"
|
||||
#endif
|
||||
@ -510,7 +512,7 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
||||
// }
|
||||
}
|
||||
|
||||
void CClient::serialize(COSer & h, const int version)
|
||||
void CClient::serialize(BinarySerializer & h, const int version)
|
||||
{
|
||||
assert(h.saving);
|
||||
h & hotSeat;
|
||||
@ -528,7 +530,7 @@ void CClient::serialize(COSer & h, const int version)
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::serialize(CISer & h, const int version)
|
||||
void CClient::serialize(BinaryDeserializer & h, const int version)
|
||||
{
|
||||
assert(!h.saving);
|
||||
h & hotSeat;
|
||||
@ -579,7 +581,7 @@ void CClient::serialize(CISer & h, const int version)
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::serialize(COSer & h, const int version, const std::set<PlayerColor> & playerIDs)
|
||||
void CClient::serialize(BinarySerializer & h, const int version, const std::set<PlayerColor> & playerIDs)
|
||||
{
|
||||
assert(h.saving);
|
||||
h & hotSeat;
|
||||
@ -597,7 +599,7 @@ void CClient::serialize(COSer & h, const int version, const std::set<PlayerColor
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::serialize(CISer & h, const int version, const std::set<PlayerColor> & playerIDs)
|
||||
void CClient::serialize(BinaryDeserializer & h, const int version, const std::set<PlayerColor> & playerIDs)
|
||||
{
|
||||
assert(!h.saving);
|
||||
h & hotSeat;
|
||||
@ -653,12 +655,12 @@ void CClient::serialize(CISer & h, const int version, const std::set<PlayerColor
|
||||
|
||||
void CClient::handlePack( CPack * pack )
|
||||
{
|
||||
if (pack == nullptr)
|
||||
if(pack == nullptr)
|
||||
{
|
||||
logNetwork->error("Dropping nullptr CPack! You should check whether client and server ABI matches.");
|
||||
return;
|
||||
}
|
||||
CBaseForCLApply *apply = applier->apps[typeList.getTypeID(pack)]; //find the applier
|
||||
CBaseForCLApply *apply = applier->getApplier(typeList.getTypeID(pack)); //find the applier
|
||||
if(apply)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> guiLock(*LOCPLINT->pim);
|
||||
|
@ -32,8 +32,8 @@ struct SharedMem;
|
||||
class CClient;
|
||||
class CScriptingModule;
|
||||
struct CPathsInfo;
|
||||
class CISer;
|
||||
class COSer;
|
||||
class BinaryDeserializer;
|
||||
class BinarySerializer;
|
||||
namespace boost { class thread; }
|
||||
|
||||
/// structure to handle running server and connecting to it
|
||||
@ -238,10 +238,10 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void serialize(COSer &h, const int version);
|
||||
void serialize(CISer &h, const int version);
|
||||
void serialize(BinarySerializer & h, const int version);
|
||||
void serialize(BinaryDeserializer & h, const int version);
|
||||
|
||||
void serialize(COSer &h, const int version, const std::set<PlayerColor>& playerIDs);
|
||||
void serialize(CISer &h, const int version, const std::set<PlayerColor>& playerIDs);
|
||||
void serialize(BinarySerializer & h, const int version, const std::set<PlayerColor>& playerIDs);
|
||||
void serialize(BinaryDeserializer & h, const int version, const std::set<PlayerColor>& playerIDs);
|
||||
void battleFinished();
|
||||
};
|
||||
|
@ -7,7 +7,8 @@
|
||||
#include "Client.h"
|
||||
#include "CPlayerInterface.h"
|
||||
#include "CGameInfo.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
#include "../lib/serializer/BinarySerializer.h"
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
|
@ -9,7 +9,8 @@
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include "Connection.h"
|
||||
#include "serializer/BinaryDeserializer.h"
|
||||
#include "serializer/BinarySerializer.h"
|
||||
|
||||
/*
|
||||
* CGameInterface.cpp, part of VCMI engine
|
||||
@ -243,29 +244,29 @@ void CAdventureAI::yourTacticPhase(int distance)
|
||||
battleAI->yourTacticPhase(distance);
|
||||
}
|
||||
|
||||
void CAdventureAI::saveGame(COSer & h, const int version) /*saving */
|
||||
void CAdventureAI::saveGame(BinarySerializer & h, const int version) /*saving */
|
||||
{
|
||||
LOG_TRACE_PARAMS(logAi, "version '%i'", version);
|
||||
CGlobalAI::saveGame(h, version);
|
||||
bool hasBattleAI = static_cast<bool>(battleAI);
|
||||
h << hasBattleAI;
|
||||
h & hasBattleAI;
|
||||
if(hasBattleAI)
|
||||
{
|
||||
h << std::string(battleAI->dllName);
|
||||
h & std::string(battleAI->dllName);
|
||||
battleAI->saveGame(h, version);
|
||||
}
|
||||
}
|
||||
|
||||
void CAdventureAI::loadGame(CISer & h, const int version) /*loading */
|
||||
void CAdventureAI::loadGame(BinaryDeserializer & h, const int version) /*loading */
|
||||
{
|
||||
LOG_TRACE_PARAMS(logAi, "version '%i'", version);
|
||||
CGlobalAI::loadGame(h, version);
|
||||
bool hasBattleAI = false;
|
||||
h >> hasBattleAI;
|
||||
h & hasBattleAI;
|
||||
if(hasBattleAI)
|
||||
{
|
||||
std::string dllName;
|
||||
h >> dllName;
|
||||
h & dllName;
|
||||
battleAI = CDynLibHandler::getNewBattleAI(dllName);
|
||||
assert(cbc); //it should have been set by the one who new'ed us
|
||||
battleAI->init(cbc);
|
||||
@ -273,10 +274,10 @@ void CAdventureAI::loadGame(CISer & h, const int version) /*loading */
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleGameInterface::saveGame(COSer & h, const int version)
|
||||
void CBattleGameInterface::saveGame(BinarySerializer & h, const int version)
|
||||
{
|
||||
}
|
||||
|
||||
void CBattleGameInterface::loadGame(CISer & h, const int version)
|
||||
void CBattleGameInterface::loadGame(BinaryDeserializer & h, const int version)
|
||||
{
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ struct CPathsInfo;
|
||||
class CCreature;
|
||||
class CLoadFile;
|
||||
class CSaveFile;
|
||||
class CISer;
|
||||
class COSer;
|
||||
class BinaryDeserializer;
|
||||
class BinarySerializer;
|
||||
struct ArtifactLocation;
|
||||
class CScriptingModule;
|
||||
|
||||
@ -73,8 +73,8 @@ public:
|
||||
virtual BattleAction activeStack(const CStack * stack)=0; //called when it's turn of that stack
|
||||
virtual void yourTacticPhase(int distance){}; //called when interface has opportunity to use Tactics skill -> use cb->battleMakeTacticAction from this function
|
||||
|
||||
virtual void saveGame(COSer &h, const int version);
|
||||
virtual void loadGame(CISer &h, const int version);
|
||||
virtual void saveGame(BinarySerializer & h, const int version);
|
||||
virtual void loadGame(BinaryDeserializer & h, const int version);
|
||||
|
||||
};
|
||||
|
||||
@ -150,6 +150,6 @@ public:
|
||||
virtual void battleEnd(const BattleResult *br) override;
|
||||
virtual void battleStacksHealedRes(const std::vector<std::pair<ui32, ui32> > & healedStacks, bool lifeDrain, bool tentHeal, si32 lifeDrainFrom) override;
|
||||
|
||||
virtual void saveGame(COSer & h, const int version) override; //saving
|
||||
virtual void loadGame(CISer & h, const int version) override; //loading
|
||||
virtual void saveGame(BinarySerializer & h, const int version) override; //saving
|
||||
virtual void loadGame(BinaryDeserializer & h, const int version) override; //loading
|
||||
};
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "CHeroHandler.h"
|
||||
#include "mapObjects/CObjectHandler.h"
|
||||
#include "CModHandler.h"
|
||||
#include "Connection.h"
|
||||
#include "mapping/CMap.h"
|
||||
#include "mapping/CMapService.h"
|
||||
#include "StartInfo.h"
|
||||
@ -25,6 +24,8 @@
|
||||
#include "rmg/CMapGenerator.h"
|
||||
#include "CStopWatch.h"
|
||||
#include "mapping/CMapEditManager.h"
|
||||
#include "serializer/CTypeList.h"
|
||||
#include "serializer/CMemorySerializer.h"
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
@ -871,7 +872,7 @@ void CGameState::initDuel()
|
||||
else
|
||||
{
|
||||
CLoadFile lf(scenarioOps->mapname);
|
||||
lf.serializer >> dp;
|
||||
lf.serializer & dp;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
@ -2059,7 +2060,7 @@ PlayerRelations::PlayerRelations CGameState::getPlayerRelations( PlayerColor col
|
||||
void CGameState::apply(CPack *pack)
|
||||
{
|
||||
ui16 typ = typeList.getTypeID(pack);
|
||||
applierGs->apps[typ]->applyOnGS(this,pack);
|
||||
applierGs->getApplier(typ)->applyOnGS(this,pack);
|
||||
}
|
||||
|
||||
void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out)
|
||||
|
@ -60,6 +60,14 @@ set(lib_SRCS
|
||||
rmg/CZoneGraphGenerator.cpp
|
||||
rmg/CZonePlacer.cpp
|
||||
|
||||
serializer/BinaryDeserializer.cpp
|
||||
serializer/BinarySerializer.cpp
|
||||
serializer/CLoadIntegrityValidator.cpp
|
||||
serializer/CMemorySerializer.cpp
|
||||
serializer/Connection.cpp
|
||||
serializer/CSerializer.cpp
|
||||
serializer/CTypeList.cpp
|
||||
|
||||
spells/CSpellHandler.cpp
|
||||
spells/ISpellMechanics.cpp
|
||||
spells/AdventureSpellMechanics.cpp
|
||||
@ -102,7 +110,6 @@ set(lib_SRCS
|
||||
CGameInfoCallback.cpp
|
||||
CPathfinder.cpp
|
||||
CGameState.cpp
|
||||
Connection.cpp
|
||||
NetPacksLib.cpp
|
||||
|
||||
serializer/JsonSerializer.cpp
|
||||
|
@ -18,8 +18,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern template void registerTypes<CISer>(CISer & s);
|
||||
extern template void registerTypes<COSer>(COSer & s);
|
||||
extern template void registerTypes<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
extern template void registerTypes<BinarySerializer>(BinarySerializer & s);
|
||||
extern template void registerTypes<CTypeList>(CTypeList & s);
|
||||
|
||||
CTypeList typeList;
|
||||
|
@ -17,7 +17,12 @@
|
||||
#include "CBonusTypeHandler.h"
|
||||
#include "CModHandler.h"
|
||||
|
||||
#include "Connection.h" // for SAVEGAME_MAGIC
|
||||
#include "serializer/CSerializer.h" // for SAVEGAME_MAGIC
|
||||
#include "serializer/BinaryDeserializer.h"
|
||||
#include "serializer/BinarySerializer.h"
|
||||
#include "serializer/CLoadIntegrityValidator.h"
|
||||
#include "rmg/CMapGenOptions.h"
|
||||
#include "mapping/CCampaignHandler.h"
|
||||
#include "mapObjects/CObjectClassesHandler.h"
|
||||
#include "StartInfo.h"
|
||||
#include "CGameState.h"
|
||||
@ -157,16 +162,16 @@ void CPrivilagedInfoCallback::loadCommonState(Loader &in)
|
||||
StartInfo *si;
|
||||
|
||||
logGlobal->infoStream() <<"\tReading header";
|
||||
in.serializer >> dum;
|
||||
in.serializer & dum;
|
||||
|
||||
logGlobal->infoStream() << "\tReading options";
|
||||
in.serializer >> si;
|
||||
in.serializer & si;
|
||||
|
||||
logGlobal->infoStream() <<"\tReading handlers";
|
||||
in.serializer >> *VLC;
|
||||
in.serializer & *VLC;
|
||||
|
||||
logGlobal->infoStream() <<"\tReading gamestate";
|
||||
in.serializer >> gs;
|
||||
in.serializer & gs;
|
||||
}
|
||||
|
||||
template<typename Saver>
|
||||
@ -175,13 +180,13 @@ void CPrivilagedInfoCallback::saveCommonState(Saver &out) const
|
||||
logGlobal->infoStream() << "Saving lib part of game...";
|
||||
out.putMagicBytes(SAVEGAME_MAGIC);
|
||||
logGlobal->infoStream() <<"\tSaving header";
|
||||
out.serializer << static_cast<CMapHeader&>(*gs->map);
|
||||
out.serializer & static_cast<CMapHeader&>(*gs->map);
|
||||
logGlobal->infoStream() << "\tSaving options";
|
||||
out.serializer << gs->scenarioOps;
|
||||
out.serializer & gs->scenarioOps;
|
||||
logGlobal->infoStream() << "\tSaving handlers";
|
||||
out.serializer << *VLC;
|
||||
out.serializer & *VLC;
|
||||
logGlobal->infoStream() << "\tSaving gamestate";
|
||||
out.serializer << gs;
|
||||
out.serializer & gs;
|
||||
}
|
||||
|
||||
// hardly memory usage for `-gdwarf-4` flag
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
// For reference: peak memory usage by gcc during compilation of register type templates
|
||||
// registerTypesMapObjects: 1.9 Gb
|
||||
// registerTypes2: 2.2 Gb
|
||||
@ -22,8 +26,8 @@
|
||||
|
||||
|
||||
#define DEFINE_EXTERNAL_METHOD(METHODNAME) \
|
||||
extern template DLL_LINKAGE void METHODNAME<CISer>(CISer & s); \
|
||||
extern template DLL_LINKAGE void METHODNAME<COSer>(COSer & s); \
|
||||
extern template DLL_LINKAGE void METHODNAME<BinaryDeserializer>(BinaryDeserializer & s); \
|
||||
extern template DLL_LINKAGE void METHODNAME<BinarySerializer>(BinarySerializer & s); \
|
||||
extern template DLL_LINKAGE void METHODNAME<CTypeList>(CTypeList & s); \
|
||||
|
||||
//DEFINE_EXTERNAL_METHOD(registerTypesMapObjects)
|
||||
@ -34,6 +38,6 @@ DEFINE_EXTERNAL_METHOD(registerTypesClientPacks2)
|
||||
DEFINE_EXTERNAL_METHOD(registerTypesServerPacks)
|
||||
DEFINE_EXTERNAL_METHOD(registerTypesPregamePacks)
|
||||
|
||||
template void registerTypes<CISer>(CISer & s);
|
||||
template void registerTypes<COSer>(COSer & s);
|
||||
template void registerTypes<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypes<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypes<CTypeList>(CTypeList & s);
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Connection.h"
|
||||
#include "../NetPacks.h"
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
@ -24,6 +23,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class BinarySerializer;
|
||||
class BinaryDeserializer;
|
||||
class CTypeList;
|
||||
|
||||
template<typename Serializer>
|
||||
void registerTypesMapObjects1(Serializer &s)
|
||||
{
|
||||
@ -376,8 +379,8 @@ void registerTypes(Serializer &s)
|
||||
|
||||
#ifndef INSTANTIATE_REGISTER_TYPES_HERE
|
||||
|
||||
extern template DLL_LINKAGE void registerTypes<CISer>(CISer & s);
|
||||
extern template DLL_LINKAGE void registerTypes<COSer>(COSer & s);
|
||||
extern template DLL_LINKAGE void registerTypes<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
extern template DLL_LINKAGE void registerTypes<BinarySerializer>(BinarySerializer & s);
|
||||
extern template DLL_LINKAGE void registerTypes<CTypeList>(CTypeList & s);
|
||||
|
||||
#endif
|
||||
|
@ -18,7 +18,11 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesClientPacks1<CISer>(CISer & s);
|
||||
template void registerTypesClientPacks1<COSer>(COSer & s);
|
||||
|
||||
template void registerTypesClientPacks1<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesClientPacks1<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesClientPacks1<CTypeList>(CTypeList & s);
|
||||
|
@ -18,9 +18,13 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesClientPacks2<CISer>(CISer & s);
|
||||
template void registerTypesClientPacks2<COSer>(COSer & s);
|
||||
|
||||
template void registerTypesClientPacks2<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesClientPacks2<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesClientPacks2<CTypeList>(CTypeList & s);
|
||||
|
||||
|
||||
|
@ -18,8 +18,12 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
template void registerTypesMapObjects1<CISer>(CISer & s);
|
||||
template void registerTypesMapObjects1<COSer>(COSer & s);
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesMapObjects1<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesMapObjects1<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesMapObjects1<CTypeList>(CTypeList & s);
|
||||
|
||||
|
||||
|
@ -18,8 +18,12 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesMapObjects2<CISer>(CISer & s);
|
||||
template void registerTypesMapObjects2<COSer>(COSer & s);
|
||||
|
||||
template void registerTypesMapObjects2<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesMapObjects2<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesMapObjects2<CTypeList>(CTypeList & s);
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
template void registerTypesMapObjectTypes<CISer>(CISer & s);
|
||||
template void registerTypesMapObjectTypes<COSer>(COSer & s);
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesMapObjectTypes<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesMapObjectTypes<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesMapObjectTypes<CTypeList>(CTypeList & s);
|
||||
|
@ -17,8 +17,13 @@
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
#include "../rmg/CMapGenOptions.h"
|
||||
|
||||
template void registerTypesPregamePacks<CISer>(CISer & s);
|
||||
template void registerTypesPregamePacks<COSer>(COSer & s);
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesPregamePacks<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesPregamePacks<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesPregamePacks<CTypeList>(CTypeList & s);
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
template void registerTypesServerPacks<CISer>(CISer & s);
|
||||
template void registerTypesServerPacks<COSer>(COSer & s);
|
||||
#include "../serializer/BinaryDeserializer.h"
|
||||
#include "../serializer/BinarySerializer.h"
|
||||
#include "../serializer/CTypeList.h"
|
||||
|
||||
template void registerTypesServerPacks<BinaryDeserializer>(BinaryDeserializer & s);
|
||||
template void registerTypesServerPacks<BinarySerializer>(BinarySerializer & s);
|
||||
template void registerTypesServerPacks<CTypeList>(CTypeList & s);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "../lib/NetPacks.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/mapping/CMap.h"
|
||||
#include "../lib/rmg/CMapGenOptions.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
#include "../lib/ScopeGuard.h"
|
||||
#include "../lib/CSoundBase.h"
|
||||
@ -29,6 +30,8 @@
|
||||
#include "../lib/CThreadHelper.h"
|
||||
#include "../lib/GameConstants.h"
|
||||
#include "../lib/registerTypes/RegisterTypes.h"
|
||||
#include "../lib/serializer/CTypeList.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
|
||||
/*
|
||||
* CGameHandler.cpp, part of VCMI engine
|
||||
@ -957,9 +960,8 @@ void CGameHandler::handleConnection(std::set<PlayerColor> players, CConnection &
|
||||
boost::unique_lock<boost::mutex> lock(*c.wmx);
|
||||
c << &applied;
|
||||
};
|
||||
|
||||
CBaseForGHApply *apply = applier->apps[packType]; //and appropriate applier object
|
||||
if (isBlockedByQueries(pack, player))
|
||||
CBaseForGHApply *apply = applier->getApplier(packType); //and appropriate applier object
|
||||
if(isBlockedByQueries(pack, player))
|
||||
{
|
||||
sendPackageResponse(false);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
|
||||
#include "../lib/FunctionList.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/IGameCallback.h"
|
||||
#include "../lib/BattleAction.h"
|
||||
#include "CQuery.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "../lib/filesystem/Filesystem.h"
|
||||
#include "../lib/mapping/CCampaignHandler.h"
|
||||
#include "../lib/CThreadHelper.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
#include "../lib/CModHandler.h"
|
||||
#include "../lib/CArtHandler.h"
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
@ -18,6 +18,7 @@
|
||||
#include "CVCMIServer.h"
|
||||
#include "../lib/StartInfo.h"
|
||||
#include "../lib/mapping/CMap.h"
|
||||
#include "../lib/rmg/CMapGenOptions.h"
|
||||
#ifndef VCMI_ANDROID
|
||||
#include "../lib/Interprocess.h"
|
||||
#endif
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "../lib/CGameState.h"
|
||||
#include "../lib/BattleState.h"
|
||||
#include "../lib/BattleAction.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
|
||||
|
||||
#define PLAYER_OWNS(id) (gh->getPlayerAt(c)==gh->getOwner(id))
|
||||
|
Loading…
Reference in New Issue
Block a user