mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Hack fixed serializer assertion by completely disabling AI goals serialization
This commit is contained in:
committed by
ArseniyShestakov
parent
3c67e12620
commit
166c04e2e0
@@ -714,7 +714,10 @@ void VCAI::saveGame(BinarySerializer & h, const int version)
|
||||
NET_EVENT_HANDLER;
|
||||
validateVisitableObjs();
|
||||
|
||||
#if 0
|
||||
//disabled due to issue 2890
|
||||
registerGoals(h);
|
||||
#endif // 0
|
||||
CAdventureAI::saveGame(h, version);
|
||||
serializeInternal(h, version);
|
||||
}
|
||||
@@ -724,7 +727,10 @@ void VCAI::loadGame(BinaryDeserializer & h, const int version)
|
||||
LOG_TRACE_PARAMS(logAi, "version '%i'", version);
|
||||
NET_EVENT_HANDLER;
|
||||
|
||||
#if 0
|
||||
//disabled due to issue 2890
|
||||
registerGoals(h);
|
||||
#endif // 0
|
||||
CAdventureAI::loadGame(h, version);
|
||||
serializeInternal(h, version);
|
||||
}
|
||||
|
@@ -327,6 +327,8 @@ public:
|
||||
//special function that can be called ONLY from game events handling thread and will send request ASAP
|
||||
void requestActionASAP(std::function<void()> whatToDo);
|
||||
|
||||
#if 0
|
||||
//disabled due to issue 2890
|
||||
template <typename Handler> void registerGoals(Handler &h)
|
||||
{
|
||||
//h.template registerType<Goals::AbstractGoal, Goals::BoostHero>();
|
||||
@@ -350,6 +352,7 @@ public:
|
||||
h.template registerType<Goals::AbstractGoal, Goals::VisitTile>();
|
||||
h.template registerType<Goals::AbstractGoal, Goals::Win>();
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename Handler> void serializeInternal(Handler &h, const int version)
|
||||
{
|
||||
@@ -357,7 +360,48 @@ public:
|
||||
h & knownSubterraneanGates;
|
||||
h & destinationTeleport;
|
||||
h & townVisitsThisWeek;
|
||||
|
||||
#if 0
|
||||
//disabled due to issue 2890
|
||||
h & lockedHeroes;
|
||||
#else
|
||||
{
|
||||
ui32 length = 0;
|
||||
h & length;
|
||||
if(!h.saving)
|
||||
{
|
||||
std::set<ui32> loadedPointers;
|
||||
lockedHeroes.clear();
|
||||
for(ui32 index = 0; index < length; index++)
|
||||
{
|
||||
HeroPtr ignored1;
|
||||
h & ignored1;
|
||||
|
||||
ui8 flag = 0;
|
||||
h & flag;
|
||||
|
||||
if(flag)
|
||||
{
|
||||
ui32 pid = 0xffffffff;
|
||||
h & pid;
|
||||
|
||||
if(!vstd::contains(loadedPointers, pid))
|
||||
{
|
||||
loadedPointers.insert(pid);
|
||||
|
||||
ui16 typeId = 0;
|
||||
//this is the problem requires such hack
|
||||
//we have to explicitly ignore invalid goal class type id
|
||||
h & typeId;
|
||||
Goals::AbstractGoal ignored2;
|
||||
ignored2.serialize(h, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
h & reservedHeroesMap; //FIXME: cannot instantiate abstract class
|
||||
h & visitableObjs;
|
||||
h & alreadyVisited;
|
||||
|
@@ -13,7 +13,6 @@
|
||||
<Option object_output="../obj/Client/Debug/x86" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option parameters="--donotstartserver" />
|
||||
<Compiler>
|
||||
<Add option="-Og" />
|
||||
<Add option="-g" />
|
||||
|
@@ -215,7 +215,8 @@ class CApplier : boost::noncopyable
|
||||
public:
|
||||
T * getApplier(ui16 ID)
|
||||
{
|
||||
assert(apps.count(ID));
|
||||
if(!apps.count(ID))
|
||||
throw std::runtime_error("No applier found.");
|
||||
return apps[ID].get();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user