mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
If 'GetItem' assignment isn't possible due to no valid items in target sector, indicate this to the player.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8386 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -798,6 +798,63 @@ BOOLEAN GetNumberOfWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bM
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
UINT32 GetNumberOfMovableItems( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
{
|
||||
// not underground!
|
||||
if ( bMapZ )
|
||||
return 0;
|
||||
|
||||
// open the inventory of the sector we are taking stuff from
|
||||
SECTORINFO *pSectorInfo_Target = &(SectorInfo[SECTOR( sMapX, sMapY )]);
|
||||
UINT32 uiTotalNumberOfRealItems_Target = 0;
|
||||
|
||||
// use the new map
|
||||
std::vector<WORLDITEM> pWorldItem_Target;
|
||||
|
||||
if ( (gWorldSectorX == sMapX) && (gWorldSectorY == sMapY) && (gbWorldSectorZ == bMapZ) )
|
||||
{
|
||||
uiTotalNumberOfRealItems_Target = guiNumWorldItems;
|
||||
pWorldItem_Target = gWorldItems;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not loaded, load
|
||||
// get total number, visable and invisible
|
||||
BOOLEAN fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &(uiTotalNumberOfRealItems_Target), FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
if ( uiTotalNumberOfRealItems_Target > 0 )
|
||||
{
|
||||
// allocate space for the list
|
||||
pWorldItem_Target.resize( uiTotalNumberOfRealItems_Target );//dnl ch75 271013
|
||||
|
||||
// now load into mem
|
||||
LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItem_Target );
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 validitems = 0;
|
||||
|
||||
for ( UINT32 uiCount = 0; uiCount < uiTotalNumberOfRealItems_Target; ++uiCount ) // ... for all items in the world ...
|
||||
{
|
||||
if ( pWorldItem_Target[uiCount].fExists ) // ... if item exists ...
|
||||
{
|
||||
// test wether item is reachable and allowed to be moved by this assignment
|
||||
if ( (pWorldItem_Target[uiCount].usFlags & WORLD_ITEM_REACHABLE) && !(pWorldItem_Target[uiCount].usFlags & WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE) && pWorldItem_Target[uiCount].bVisible > 0 )
|
||||
{
|
||||
OBJECTTYPE* pObj = &(pWorldItem_Target[uiCount].object); // ... get pointer for this item ...
|
||||
|
||||
if ( pObj != NULL && pObj->exists( ) ) // ... if pointer is not obviously useless ...
|
||||
{
|
||||
++validitems;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validitems;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItemsToAdd, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, BOOLEAN fReplaceEntireFile )
|
||||
{
|
||||
|
||||
@@ -40,6 +40,9 @@ BOOLEAN DeleteTempItemMapFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
|
||||
//Retrieves the number of items in the sectors temp item file
|
||||
BOOLEAN GetNumberOfWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 *puiNumberOfItems, BOOLEAN fIfEmptyCreate );
|
||||
|
||||
// Flugente: how many items in this sector can be moved via the MOVE_EQUIPMENT assignement?
|
||||
UINT32 GetNumberOfMovableItems( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
|
||||
|
||||
//Saves the Current Sectors, ( world Items, rotting corpses, ... ) to the temporary file used to store the sectors items
|
||||
BOOLEAN SaveCurrentSectorsInformationToTempItemFile( );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user