Fix: if a map was saved before entry points had been defined, it could not be loaded again.

This has been fixed, and we also print out a warning to that a mapper can fix the map.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7802 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-03-31 18:36:19 +00:00
parent 01bdeb2c7f
commit c241c0ea7b
2 changed files with 17 additions and 11 deletions
+10 -11
View File
@@ -6759,7 +6759,6 @@ void SetInterfaceHeightLevel( )
{
INT16 sHeight;
static INT16 sOldHeight = 0;
INT32 sGridNo;
if( gfBasement || gfCaves )
{
@@ -6769,25 +6768,25 @@ void SetInterfaceHeightLevel( )
return;
}
// ATE: Use an entry point to determine what height to use....
if( gMapInformation.sNorthGridNo != NOWHERE )
sGridNo = gMapInformation.sNorthGridNo;
sHeight = gpWorldLevelData[gMapInformation.sNorthGridNo].sHeight;
else if( gMapInformation.sEastGridNo != NOWHERE )
sGridNo = gMapInformation.sEastGridNo;
sHeight = gpWorldLevelData[gMapInformation.sEastGridNo].sHeight;
else if( gMapInformation.sSouthGridNo != NOWHERE )
sGridNo = gMapInformation.sSouthGridNo;
sHeight = gpWorldLevelData[gMapInformation.sSouthGridNo].sHeight;
else if( gMapInformation.sWestGridNo != NOWHERE )
sGridNo = gMapInformation.sWestGridNo;
sHeight = gpWorldLevelData[gMapInformation.sWestGridNo].sHeight;
else if ( gMapInformation.sCenterGridNo != NOWHERE )
sHeight = gpWorldLevelData[gMapInformation.sCenterGridNo].sHeight;
else
{
Assert(0);
return;
// we're merely interested in the terrain height. If the map has no entry points at all, we will have other problems than rooftops, so just use height of 0 and be done with it
// however, print out a warning, so that a mapper can fix this!
ScreenMsg( MSG_FONT_YELLOW, MSG_ERROR, L"Map has no entry points - please fix this!" );
sHeight = 0;
}
sHeight = gpWorldLevelData[ sGridNo ].sHeight;
if ( sHeight != sOldHeight )
{
gsRenderHeight = sHeight;
+7
View File
@@ -171,6 +171,13 @@ BOOLEAN MAPCREATE_STRUCT::Save(HWFILE hFile, FLOAT dMajorMapVersion, UINT8 ubMin
pData = &OldMapCreateStruct;
uiBytesToWrite = sizeof(_OLD_MAPCREATE_STRUCT);
}
// a map without entry points would be fatal in a campaign, so print out a warning to the maper
if ( sNorthGridNo == NOWHERE && sEastGridNo == NOWHERE && sSouthGridNo == NOWHERE && sWestGridNo == NOWHERE && sCenterGridNo == NOWHERE )
{
ScreenMsg( MSG_FONT_YELLOW, MSG_ERROR, L"Map has no entry points - please fix this!" );
}
UINT32 uiBytesWritten = 0;
FileWrite(hFile, pData, uiBytesToWrite, &uiBytesWritten);
if(uiBytesToWrite == uiBytesWritten)