#include "types.h" #include "saveload.h" #include "../script/script.h" static uint32 SaveLoad_Script_Script(void *object, uint32 value, bool loading) { ScriptEngine *script = (ScriptEngine *)object; if (loading) { script->script = (uint16 *)(size_t)value; return 0; } if (script->script == NULL) return 0; return (script->script - script->scriptInfo->start); } const SaveLoadDesc g_saveScriptEngine[] = { SLD_ENTRY (ScriptEngine, SLDT_UINT16, delay), SLD_CALLB (ScriptEngine, SLDT_UINT32, script, &SaveLoad_Script_Script), SLD_EMPTY ( SLDT_UINT32), SLD_ENTRY (ScriptEngine, SLDT_UINT16, returnValue), SLD_ENTRY (ScriptEngine, SLDT_UINT8, framePointer), SLD_ENTRY (ScriptEngine, SLDT_UINT8, stackPointer), SLD_ARRAY (ScriptEngine, SLDT_UINT16, variables, 5), SLD_ARRAY (ScriptEngine, SLDT_UINT16, stack, 15), SLD_ENTRY (ScriptEngine, SLDT_UINT8, isSubroutine), SLD_END };
#include <stdio.h> #include <string.h> #include "types.h" #include "saveload.h" #include "../house.h" #include "../structure.h" #include "../pool/structure.h" #include "../pool/pool.h" static const SaveLoadDesc s_saveStructure[] = { SLD_SLD (Structure, o, g_saveObject), SLD_ENTRY (Structure, SLDT_UINT16, creatorHouseID), SLD_ENTRY (Structure, SLDT_UINT16, rotationSpriteDiff), SLD_EMPTY ( SLDT_UINT8), SLD_ENTRY (Structure, SLDT_UINT16, objectType), SLD_ENTRY (Structure, SLDT_UINT8, upgradeLevel), SLD_ENTRY (Structure, SLDT_UINT8, upgradeTimeLeft), SLD_ENTRY (Structure, SLDT_UINT16, countDown), SLD_ENTRY (Structure, SLDT_UINT16, buildCostRemainder), SLD_ENTRY (Structure, SLDT_INT16, state), SLD_ENTRY (Structure, SLDT_UINT16, hitpointsMax), SLD_END }; /** * Load all Structures from a file. * @param fp The file to load from. * @param length The length of the data chunk. * @return True if and only if all bytes were read successful.