mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Improved code to avoid dangerous locations.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8756 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1478,6 +1478,59 @@ BOOLEAN RemoveStruct( INT32 iMapIndex, UINT16 usIndex )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
BOOLEAN FindStruct(INT32 sSpot, INT8 bLevel, UINT16 usIndex)
|
||||
{
|
||||
if (TileIsOutOfBounds(sSpot))
|
||||
return FALSE;
|
||||
|
||||
LEVELNODE *pStruct = NULL;
|
||||
LEVELNODE *pOldStruct = NULL;
|
||||
|
||||
if (bLevel == 0)
|
||||
{
|
||||
pStruct = gpWorldLevelData[sSpot].pStructHead;
|
||||
}
|
||||
else
|
||||
{
|
||||
pStruct = gpWorldLevelData[sSpot].pOnRoofHead;
|
||||
}
|
||||
|
||||
// Look through all structs
|
||||
while (pStruct != NULL)
|
||||
{
|
||||
if (pStruct->usIndex == usIndex)
|
||||
{
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
pOldStruct = pStruct;
|
||||
pStruct = pStruct->pNext;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN FindStructFlag(INT32 sSpot, INT8 bLevel, UINT32 uiFlag)
|
||||
{
|
||||
if (bLevel > 0)
|
||||
return FALSE;
|
||||
|
||||
if (TileIsOutOfBounds(sSpot))
|
||||
return FALSE;
|
||||
|
||||
STRUCTURE * pStructure;
|
||||
|
||||
pStructure = FindStructure(sSpot, uiFlag);
|
||||
|
||||
if (pStructure)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// same as RemoveStruct(...), except that this focuses on .pOnRoofHead instead of .pStructHead
|
||||
BOOLEAN RemoveOnRoofStruct( INT32 iMapIndex, UINT16 usIndex )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user