mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Bugfix: Finding and swapping shadow tiles when swapping a structure tile (by Realist)
o example: When cutting a fence tile, the proper shadow tile was not swapped and correctly updated git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5465 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3599,6 +3599,8 @@ LEVELNODE * FindLevelNodeBasedOnStructure( INT32 sGridNo, STRUCTURE * pStructure
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
// WANNE: Old JA2 vanilla version to find the shadow tile
|
||||
/*
|
||||
LEVELNODE * FindShadow( INT32 sGridNo, UINT16 usStructIndex )
|
||||
{
|
||||
LEVELNODE * pLevelNode;
|
||||
@@ -3621,7 +3623,27 @@ LEVELNODE * FindShadow( INT32 sGridNo, UINT16 usStructIndex )
|
||||
pLevelNode = pLevelNode->pNext;
|
||||
}
|
||||
return( pLevelNode );
|
||||
}
|
||||
*/
|
||||
|
||||
// WANNE: Improved v1.13 version to find the shadow tile. (by Realist)
|
||||
// This should fix the bug, finding and swapping shadows when swapping structures
|
||||
// e.g: When curring a fence tile, the shadow tile was not swapped. Now it should be fixed.
|
||||
LEVELNODE* FindShadow(INT32 sGridNo, UINT16 usStructIndex)
|
||||
{
|
||||
TILE_ELEMENT const * const te = &gTileDatabase[usStructIndex];
|
||||
if (te->uiFlags & HAS_SHADOW_BUDDY && te->sBuddyNum != -1)
|
||||
{
|
||||
LEVELNODE* pLevelNode;
|
||||
for (pLevelNode = gpWorldLevelData[sGridNo].pShadowHead; pLevelNode != NULL; pLevelNode = pLevelNode->pNext)
|
||||
{
|
||||
if (pLevelNode->usIndex == te->sBuddyNum)
|
||||
{
|
||||
return pLevelNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user