mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
New feature: food system requires mercs to eat and drink in order to survive
- food and water levels are lowered every hour, eat food to survive - not doing so leads to various penalties and ultimately death - added food items for that purpose. Food can degrade over time. Rotten food poisons. - Mercs automatically consume food if hungry/thirsty and food is in their inventories - for more info, see http://www.bears-pit.com/board/ubbthreads.php/topics/307396/Re_Mercs_need_food_and_water_t.html#Post307396 - this feature requires new STI files from the GameDir trunk. - added a bunch of filler variable to the soldier type, so hopefully savegame compatibility can be maintained easier in the future. WARNING: This will break savegame compatibility git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5411 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "SaveLoadGame.h"//dnl ch51 081009
|
||||
#include "Map Information.h"//dnl ch51 091009
|
||||
#include "Interface Items.h"
|
||||
#include "Food.h" // added by Flugente
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
@@ -290,6 +291,8 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2);
|
||||
void SortSectorInventory( std::vector<WORLDITEM>& pInventory, UINT32 uiSizeOfArray );
|
||||
BOOLEAN CanPlayerUseSectorInventory( SOLDIERTYPE *pSelectedSoldier );
|
||||
|
||||
void BuildStashForSelectedSectorAndDecayFood( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); // Flugente: for food decay
|
||||
|
||||
extern void MAPEndItemPointer( );
|
||||
extern BOOLEAN GetCurrentBattleSectorXYZAndReturnTRUEIfThereIsABattle( INT16 *psSectorX, INT16 *psSectorY, INT16 *psSectorZ );
|
||||
extern BOOLEAN MAPInternalInitItemDescriptionBox( OBJECTTYPE *pObject, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier );
|
||||
@@ -5019,4 +5022,53 @@ void HandleSetFilterButtons()
|
||||
{
|
||||
ButtonList[guiMapInvenFilterButton[ 8 ]]->uiFlags &=~ (BUTTON_CLICKED_ON);
|
||||
}
|
||||
}
|
||||
|
||||
void BuildStashForSelectedSectorAndDecayFood( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
{
|
||||
UINT32 uiTotalNumberOfRealItems = 0;
|
||||
WORLDITEM * pTotalSectorList = NULL;
|
||||
|
||||
// #ifdef _DEBUG
|
||||
BOOLEAN fReturn = TRUE;
|
||||
// #endif
|
||||
|
||||
// now load these items into memory, based on fact if sector is in fact loaded
|
||||
if( ( sMapX == gWorldSectorX )&&( gWorldSectorY == sMapY ) &&(gbWorldSectorZ == sMapZ ) )
|
||||
{
|
||||
fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 )( sMapZ ), &( uiTotalNumberOfRealItems ), FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
if ( !uiTotalNumberOfRealItems )
|
||||
return;
|
||||
|
||||
pTotalSectorList = gWorldItems;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not loaded, load
|
||||
// get total number, visable and invisible
|
||||
fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 )( sMapZ ), &( uiTotalNumberOfRealItems ), FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
if( uiTotalNumberOfRealItems > 0 )
|
||||
{
|
||||
// allocate space for the list
|
||||
pTotalSectorList = new WORLDITEM[ uiTotalNumberOfRealItems ];
|
||||
|
||||
if ( !uiTotalNumberOfRealItems )
|
||||
return;
|
||||
|
||||
// now load into mem
|
||||
LoadWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 ) ( sMapZ ), pTotalSectorList );
|
||||
}
|
||||
}
|
||||
|
||||
//Check to see if any of the items in the list have a gridno of NOWHERE and the entry point flag NOT set
|
||||
//CheckGridNoOfItemsInMapScreenMapInventory();
|
||||
|
||||
SectorFoodDecay( pTotalSectorList, uiTotalNumberOfRealItems );
|
||||
|
||||
//Save the Items to the the file
|
||||
SaveWorldItemsToTempItemFile( sMapX, sMapY, (INT8)sMapZ, uiTotalNumberOfRealItems, pTotalSectorList );
|
||||
}
|
||||
Reference in New Issue
Block a user