Added a function that quickly identifies whether a tileset contains a specific tileset

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8053 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-02-07 14:25:15 +00:00
parent f20b638214
commit c3fd7373ae
2 changed files with 28 additions and 1 deletions
+26
View File
@@ -6878,6 +6878,32 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent,
SetCustomizableTimerCallbackAndDelay( 1000, CheckForPickedOwnership, TRUE );
}
INT16 GetTileSetTindexToTileSetName( INT32 asTileSetId, std::string aTileSetName )
{
// search wether structure exists in the current tilesets. If not, well, too bad
for ( INT16 iType = 0; iType < giNumberOfTileTypes; ++iType )
{
// if tileset is from the current tileset, check that
if ( gTilesets[asTileSetId].TileSurfaceFilenames[iType][0] )
{
if ( !strcmp( aTileSetName.c_str( ), gTilesets[asTileSetId].TileSurfaceFilenames[iType] ) )
{
return iType;
}
}
// otherwise, check first tileset (GENERIC 1)
else if ( gTilesets[0].TileSurfaceFilenames[iType][0] )
{
if ( !strcmp( aTileSetName.c_str( ), gTilesets[0].TileSurfaceFilenames[iType] ) )
{
return iType;
}
}
}
return -1;
}
// can we construct a structure with this item?
BOOLEAN IsStructureConstructItem(UINT16 usItem, INT32 sGridNo, SOLDIERTYPE* pSoldier)
{
+2 -1
View File
@@ -207,7 +207,8 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
BOOLEAN MarblesExistAtLocation( INT32 sGridNo, UINT8 ubLevel, INT32 * piItemIndex );
// Flugente: build an deconstruct structures
// Flugente: build and deconstruct structures
INT16 GetTileSetTindexToTileSetName( INT32 asTileSetId, std::string aTileSetName );
BOOLEAN IsStructureConstructItem( UINT16 usItem, INT32 sGridNo, SOLDIERTYPE* pSoldier ); // can we construct a structure with this item?
BOOLEAN IsStructureDeconstructItem( UINT16 usItem, INT32 sGridNo, SOLDIERTYPE* pSoldier ); // can we remove a structure with this item?
BOOLEAN BuildFortification( INT32 sGridNo, SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ); // build a structure, return true if sucessful