From b541d759a83e65cb4644ba255caef4421ad50c01 Mon Sep 17 00:00:00 2001 From: Wanne Date: Mon, 14 May 2012 09:25:44 +0000 Subject: [PATCH] - Reverted the changes from Revision 5270, because it crashes the map editor on saving - I hope now, maps saved with a Map Editor Version <= 5216 will now load again and can be saved without problems. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5271 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 17 +++++++++++++---- TileEngine/worlddef.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index b9773625..667488e4 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2388,10 +2388,18 @@ BOOLEAN StackedObjectData::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 u { int size; - // Flugente: changed this, otherwise game would crash when reading WF maps if class ObjectData was different. this is a rough fix and by no means perfect - // LOADDATA(&(this->data), *hBuffer, sizeof(ObjectData) ); - // +1 because we have to account for endOfPOD itself - LOADDATA(&(this->data), *hBuffer, SIZEOF_OBJECTDATA_POD+1 ); + // When saving maps with the new map editor that has weapon overheated feature included! + if (dMajorMapVersion >= 7 && ubMinorMapVersion >= 28) + { + // Flugente: changed this, otherwise game would crash when reading WF maps if class ObjectData was different. this is a rough fix and by no means perfect + LOADDATA(&(this->data), *hBuffer, sizeof(ObjectData) ); + } + else + { + // WF Maps have old format + // +1 because we have to account for endOfPOD itself + LOADDATA(&(this->data), *hBuffer, SIZEOF_OBJECTDATA_POD+1 ); + } LOADDATA(&size, *hBuffer, sizeof(int) ); attachments.resize(size); @@ -2408,6 +2416,7 @@ BOOLEAN StackedObjectData::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 u return TRUE; } + BOOLEAN StackedObjectData::Load( HWFILE hFile ) { UINT32 uiNumBytesRead; diff --git a/TileEngine/worlddef.h b/TileEngine/worlddef.h index 92ac6bc6..48218c3d 100644 --- a/TileEngine/worlddef.h +++ b/TileEngine/worlddef.h @@ -41,7 +41,7 @@ class SOLDIERTYPE; // SB: new map version, with map dimensions added #define MAJOR_MAP_VERSION 7.0 //Current minor map version updater. -#define MINOR_MAP_VERSION 27 +#define MINOR_MAP_VERSION 28 // 27 -> 28: increased to 28 because of included weapon overheated and tripwire feature. See ObjectClass for the new Tags! //dnl ch33 230909 #define VANILLA_MAJOR_MAP_VERSION 5.00