FIX: loading BigMaps

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5592 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2012-09-30 14:59:32 +00:00
parent 2850011b11
commit 84c86d96ad
2 changed files with 15 additions and 3 deletions
+13 -2
View File
@@ -2477,12 +2477,23 @@ BOOLEAN StackedObjectData::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 u
{
int size;
// When saving maps with the new map editor that has weapon overheated feature included!
if (dMajorMapVersion >= 7 && ubMinorMapVersion >= 28)
if (dMajorMapVersion >= 7 && ubMinorMapVersion >= 30)
{
// 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) );
}
// When saving maps with the new map editor that has weapon overheated feature included!
else if (dMajorMapVersion >= 7 && ubMinorMapVersion >= 28)
{
// Flugente 12-09-30: ok, this will look really odd, so I'll explain. We have to account for padding of structures. Before map version 30, ObjectData had size 32 due to padding.
// Up to ubWireNetworkFlag the size is 28, then bDefuseFrequency adds size 1 - but due to padding, the size was 32. Now, upon adding sRepairThreshold, the size is still 32, as the padded 3 bytes
// are now used. Due to this, we only have to reduce for the sizes of bDirtLevel and sObjectFlag, but not sRepairThreshold (sizeof(ObjectData) is now 40).
// But of course, we now 'read' the values for sRepairThreshold, but there weren't any in older map versions, resulting in garbage values - we therefore set that manually to 100
// Of course, once the ObjectData-Class is altered, this has to be altered as well!
LOADDATA(&(this->data), *hBuffer, sizeof(ObjectData) - (sizeof(this->data.bDirtLevel) + sizeof(this->data.sObjectFlag) ) );
this->data.sRepairThreshold = 100;
}
else
{
// WF Maps have old format
+2 -1
View File
@@ -42,7 +42,8 @@ class SOLDIERTYPE;
#define MAJOR_MAP_VERSION 7.0
//Current minor map version updater.
//#define MINOR_MAP_VERSION 28 // 27 -> 28: increased to 28 because of included weapon overheated and tripwire feature. See ObjectClass for the new Tags!
#define MINOR_MAP_VERSION 29 // 28 -> 29: increased range of roomnumbers to full UINT16 by DBrot
//#define MINOR_MAP_VERSION 29 // 28 -> 29: increased range of roomnumbers to full UINT16 by DBrot
#define MINOR_MAP_VERSION 30 // 30 -> 29: necessary change due to repair system by Flugente
//dnl ch33 230909
#define VANILLA_MAJOR_MAP_VERSION 5.00
#define VANILLA_MINOR_MAP_VERSION 25