From 74c6e3c56cafb86457a4e739138fb5c9ae85844f Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 10 Apr 2012 17:25:39 +0000 Subject: [PATCH] - Fixed error when playing / loading maps that have been saved with a new Map Editor after Revision 5064 (when the Overheated Weapon feature was included) o The gMapInformation struct (Version, Edgepoints, ...) was not read correctly from the map file. Now it should work again! git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5178 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 17 +++++++++++++---- TileEngine/worlddef.h | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index c039894a5..3a174ea6e 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2386,10 +2386,19 @@ BOOLEAN StackedObjectData::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 u || (dMajorMapVersion == gdMajorMapVersion && gubMinorMapVersion == ubMinorMapVersion)) { 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); diff --git a/TileEngine/worlddef.h b/TileEngine/worlddef.h index be14acc29..444b68b97 100644 --- a/TileEngine/worlddef.h +++ b/TileEngine/worlddef.h @@ -39,9 +39,9 @@ class OBJECTTYPE; class SOLDIERTYPE; // SB: new map version, with map dimensions added -#define MAJOR_MAP_VERSION 7.0 +#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 feature! //dnl ch33 230909 #define VANILLA_MAJOR_MAP_VERSION 5.00