Fix: Items that were placed by function AutoPlaceObjectToWorld() had incorrect sGridNo so they could end up in inaccessible places.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8690 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2019-08-20 17:41:56 +00:00
parent 837709a448
commit 6a1fd17026
3 changed files with 21 additions and 5 deletions
+2 -2
View File
@@ -55,8 +55,8 @@
#endif
CHAR8 czVersionNumber[16] = { "Build 19.08.14" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 19.08.20" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
CHAR16 zRevisionNumber[16] = { L"Revision 8689" };
CHAR16 zRevisionNumber[16] = { L"Revision 8690" };
// SAVE_GAME_VERSION is defined in header, change it there
@@ -2702,6 +2702,8 @@ BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr, INT32 sGridNo, IN
pInventoryPoolList[cnt].bVisible = 1;
pInventoryPoolList[cnt].fExists = TRUE;
}
if(sGridNo == -1)
pInventoryPoolList[cnt].usFlags |= WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT;
}
else
{
+17 -3
View File
@@ -7059,8 +7059,20 @@ BOOLEAN AutoPlaceObjectToWorld(SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, INT8 b
if(pObj->exists() == false)
return FALSE;
INT32 sGridNo = pSoldier?pSoldier->sGridNo:0;
INT8 bLevel = pSoldier?pSoldier->pathing.bLevel:0;
// silversurfer: Bad idea. Our pSoldier always has sGridNo set but it could be from a previous sector so the tile is completely irrelevant if the sector isn't the current merc sector.
// The same applies to bLevel. So before we assign anything we need to check if the merc sector is loaded.
// INT32 sGridNo = pSoldier?pSoldier->sGridNo:0;
// INT8 bLevel = pSoldier?pSoldier->pathing.bLevel:0;
INT32 sGridNo = -1;
INT8 bLevel = 0;
// is this sector loaded?
if ( pSoldier && (pSoldier->sSectorX == gWorldSectorX) && (pSoldier->sSectorY == gWorldSectorY) && (pSoldier->bSectorZ == gbWorldSectorZ) )
{
sGridNo = pSoldier->sGridNo;
bLevel = pSoldier->pathing.bLevel;
}
if( guiCurrentScreen == MAP_SCREEN )
{
@@ -7088,6 +7100,8 @@ BOOLEAN AutoPlaceObjectToWorld(SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, INT8 b
CreateDestroyMapInventoryPoolButtons(FALSE);
}
// silversurfer: No, let the game handle item placement by setting WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT in function AutoPlaceObjectInInventoryStash().
/*
// set a grid no for item from mercs with invalid grid no in sector inventory, e.g. merc arriving in sector with a different tactical map loaded
if(!GridNoOnVisibleWorldTile(sGridNo))
{
@@ -7105,7 +7119,7 @@ BOOLEAN AutoPlaceObjectToWorld(SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, INT8 b
// empty sector to use the center grid no of the loaded tactical sector, hope that it's accessible
if(!GridNoOnVisibleWorldTile(sGridNo))
sGridNo = gMapInformation.sCenterGridNo;
}
}*/
fMapPanelDirty = TRUE;
return( AutoPlaceObjectInInventoryStash(pObj, sGridNo, bLevel) );