Date is OK. There are still a few remaining issues concerning campaigns and probably I will fix them during next week. Do not wait further for dev build
One thing I forgot about - serialization of AI is partially disabled due to some problems with serializer encountered earlier. However, this thing makes savegames totally buggy and any game won’t load.
Could you just disable goal serialization altogether for the time being? It would reset AI “thinking” at the loading but it should work.
Goals are not registered, polymorphic serialization won’t work. And even if it did, serialzier doesn’t properly work with shared_ptr. [And if it did, I have no idea how to make it work both with shared-ptr and polymorphic serialization.]
Class hierarchies and pointers are so much trouble, that’s why I used value semantics (and huge switch). Now you’d probably need a similar switch to handle serialziation.
So I guess you need to disable as much of AI serialziation as is needed to make game loading again. (Does it work when AI load/save are total no-ops?)
Still, I don’t see how disabling some aprts of AI serialziation can break savegame. Breaks happen basically when save/load oparations are not symmetrical.
Try — as soon before the crash as possible, to avoid false exceptions — to make debugger break on throwing exceptions.
Enter Debug -> Exceptions, check the checkbox next to “C++ exceptions”.
The debugger will stop the program when exception is thrown (regardless if it is handled), so you’ll be able to tell where it comes from, get the stacktraces, variables and so on.
It looks as if typeid was called on a invalid pointer. Serializing invalid pointer is illegal. The question is — who tries that and why.
KernelBase.dll!7648c41f() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
> msvcr110.dll!_CxxThrowException(void * pExceptionObject, const _s__ThrowInfo * pThrowInfo) Line 152 C++
msvcr110.dll!__RTtypeid(void * inptr) Line 147 C++
VCMI_lib.dll!CTypeList::getTypeID<CCreature>(const CCreature * t) Line 103 C++
VCMI_lib.dll!COSer<CSaveFile>::savePointer<CCreature *>(CCreature * const & data) Line 668 C++
VCMI_lib.dll!CHeroClass::serialize<COSer<CSaveFile> >(COSer<CSaveFile> & h, const int version) Line 141 C++
VCMI_lib.dll!COSer<CSaveFile>::savePointer<CHeroClass *>(CHeroClass * const & data) Line 671 C++
VCMI_lib.dll!CHeroClassHandler::serialize<COSer<CSaveFile> >(COSer<CSaveFile> & h, const int version) Line 186 C++
VCMI_lib.dll!CHeroHandler::serialize<COSer<CSaveFile> >(COSer<CSaveFile> & h, const int version) Line 255 C++
VCMI_lib.dll!COSer<CSaveFile>::savePointer<CHeroHandler *>(CHeroHandler * const & data) Line 671 C++
VCMI_lib.dll!LibClasses::serialize<COSer<CSaveFile> >(COSer<CSaveFile> & h, const int version) Line 63 C++
VCMI_lib.dll!CPrivilagedInfoCallback::saveCommonState<CSaveFile>(CSaveFile & out) Line 249 C++
VCMI_client.exe!SaveGame::applyCl(CClient * cl) Line 802 C++
VCMI_client.exe!CApplyOnCL<SaveGame>::applyOnClAfter(CClient * cl, void * pack) Line 74 C++
VCMI_client.exe!CClient::handlePack(CPack * pack) Line 517 C++
VCMI_client.exe!CClient::run() Line 151 C++
VCMI_client.exe!boost::`anonymous namespace'::thread_start_function(void *) C++
msvcr110.dll!_callthreadstartex() Line 354 C
msvcr110.dll!_threadstartex(void * ptd) Line 332 C
kernel32.dll!76e5336a() Unknown
ntdll.dll!77949f72() Unknown
ntdll.dll!77949f45() Unknown
At this line:
//write type identifier
ui16 tid = typeList.getTypeID(data);
*this << tid;
tid value is bogus magic bytes (0xbcda). Exception is thrown when evaluating the initializing expression.
The crahs is apparently caused by a invalid poitner CHeroClass::commander. Apparently it wasn’t initialized. I have committed a fix. Please check if the issue is gone.
I figured out how to solve this issue.
Basically registering classees should not register the class but the relationship between base and its descendant. With that serializaer can build proper inheritance graph and instantiate helpers for all conversions it needs.
TCP serialization treats shared/weak/unique pointer as usual pointer.
File serialization keeps shared_ptr copy for each loaded type.
This will give exactly the semantics we need.