- convert outofbounds check to inline macro. (This gets called a lot in render map. The Visual Studio profiler highlighted this one though probably not a real optimization.) (by tazpn)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5367 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-07-09 08:11:27 +00:00
parent 863d079252
commit b1b98417ce
2 changed files with 6 additions and 15 deletions
-14
View File
@@ -874,20 +874,6 @@ INT32 OutOfBounds(INT32 sGridNo, INT32 sProposedGridNo)
return(FALSE);
}
//Lalien: This function should be used to check if the tile is not inside map array,
// it will return FALSE if the tile index is NOWHERE (-1) too.
// If the tile index has some special meaning ("-1" = does not exist) the check for NOWHERE should be used
BOOLEAN TileIsOutOfBounds(INT32 sGridNo)
{
if( (sGridNo < 0) || (sGridNo >= MAX_MAP_POS) )
{
return TRUE;
}
return FALSE;
}
INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc)
{
INT32 sProposedGridNo = sGridNo + sDirInc;
+6 -1
View File
@@ -49,8 +49,13 @@ void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc);
INT16 DirectionInc(UINT8 ubDirection);
INT32 OutOfBounds(INT32 sGridNo, INT32 sProposedGridNo);
BOOLEAN TileIsOutOfBounds(INT32 sGridNo);
//Lalien: This function should be used to check if the tile is not inside map array,
// it will return FALSE if the tile index is NOWHERE (-1) too.
// If the tile index has some special meaning ("-1" = does not exist) the check for NOWHERE should be used
//
// tazpn: inline this routine due to high call count
#define TileIsOutOfBounds(sGridNo) (( (sGridNo < 0) || (sGridNo >= MAX_MAP_POS) ) ? TRUE : FALSE)
// Functions
BOOLEAN GetMouseCell( INT32 *piMouseMapPos );