Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+41 -42
View File
@@ -67,12 +67,12 @@ MINE_STATUS_TYPE gMineStatus[ MAX_NUMBER_OF_MINES ];
// this table holds mine values that never change and don't need to be saved
MINE_LOCATION_TYPE gMineLocation[MAX_NUMBER_OF_MINES] =
{
{ 4, 4, SAN_MONA },
{ 4, 4, SAN_MONA },
{ 13, 4, DRASSEN },
{ 14, 9, ALMA },
{ 8, 8, CAMBRIA },
{ 2, 2, CHITZENA },
{ 3, 8, GRUMM },
{ 8, 8, CAMBRIA },
{ 2, 2, CHITZENA },
{ 3, 8, GRUMM },
};
// the are not being randomized at all at this time
@@ -87,16 +87,16 @@ UINT8 gubMineTypes[]={
// These values also determine the most likely ratios of mine sizes after random production increases are done
UINT32 guiMinimumMineProduction[]={
0, // SAN MONA
1000, // DRASSEN
1500, // ALMA
1500, // CAMBRIA
500, // CHITZENA
2000, // GRUMM
0, // SAN MONA
1000, // DRASSEN
1500, // ALMA
1500, // CAMBRIA
500, // CHITZENA
2000, // GRUMM
};
HEAD_MINER_TYPE gHeadMinerData[NUM_HEAD_MINERS] =
HEAD_MINER_TYPE gHeadMinerData[NUM_HEAD_MINERS] =
{
// Profile # running out creatures! all dead! creatures again! external face graphic
{ FRED, 17, 18, 27, 26, MINER_FRED_EXTERNAL_FACE },
@@ -159,7 +159,7 @@ void InitializeMines( void )
gMineStatus->fShutDownIsPermanent = FALSE;
}
// randomize the exact size each mine. The total production is always the same and depends on the game difficulty,
// randomize the exact size each mine. The total production is always the same and depends on the game difficulty,
// but some mines will produce more in one game than another, while others produce less
// adjust for game difficulty
@@ -195,7 +195,7 @@ void InitializeMines( void )
}
// choose which mine will run out of production. This will never be the Alma mine or an empty mine (San Mona)...
// choose which mine will run out of production. This will never be the Alma mine or an empty mine (San Mona)...
do
{
ubDepletedMineIndex = ( UINT8 ) Random(MAX_NUMBER_OF_MINES);
@@ -271,7 +271,7 @@ void HourlyMinesUpdate(void)
IssueHeadMinerQuote( ubMineIndex, HEAD_MINER_STRATEGIC_QUOTE_CREATURES_GONE );
}
//Force the creatures to avoid the mine for a period of time. This gives the
//Force the creatures to avoid the mine for a period of time. This gives the
//player a chance to rest and decide how to deal with the problem.
ForceCreaturesToAvoidMineTemporarily( ubMineIndex );
@@ -282,7 +282,7 @@ void HourlyMinesUpdate(void)
else // mine is monster infested
{
// 'Der be monsters crawling around in there, lad!!!
// if it's still producing
if (!IsMineShutDown( ubMineIndex ))
{
@@ -312,7 +312,7 @@ void HourlyMinesUpdate(void)
IssueHeadMinerQuote( ubMineIndex, ubQuoteType );
}
// and immediately halt all work at the mine (whether it's ours or the queen's). This is a temporary shutdown
// and immediately halt all work at the mine (whether it's ours or the queen's). This is a temporary shutdown
ShutOffMineProduction( ubMineIndex );
}
}
@@ -350,7 +350,7 @@ UINT32 GetMaxDailyRemovalFromMine( INT8 bMineIndex )
{
UINT32 uiAmtExtracted;
// returns max amount that can be mined in one day
// returns max amount that can be mined in one day
Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) );
@@ -405,7 +405,6 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount )
{
// will remove the ore from the mine and return the amount that was removed
UINT32 uiAmountExtracted = 0;
UINT32 uiOreRunningOutPoint = 0;
INT16 sSectorX, sSectorY;
@@ -437,11 +436,11 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount )
GetMineSector( bMineIndex, &sSectorX, &sSectorY );
StrategicHandleMineThatRanOut( ( UINT8 ) SECTOR( sSectorX, sSectorY ) );
AddHistoryToPlayersLog( HISTORY_MINE_RAN_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_RAN_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
else // still some left after this extraction
{
// set amount used, and decrement ore remaining in mine
// set amount used, and decrement ore remaining in mine
uiAmountExtracted = uiAmount;
gMineStatus[ bMineIndex ].uiRemainingOreSupply -= uiAmount;
@@ -463,7 +462,7 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount )
// that mine's head miner tells player that the mine is running out
IssueHeadMinerQuote( bMineIndex, HEAD_MINER_STRATEGIC_QUOTE_RUNNING_OUT );
gMineStatus[ bMineIndex ].fWarnedOfRunningOut = TRUE;
AddHistoryToPlayersLog( HISTORY_MINE_RUNNING_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_RUNNING_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
}
}
@@ -479,7 +478,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex )
INT8 bTownId = 0;
// return the loyalty of the town associated with the mine
Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) );
// if mine is shut down
@@ -493,7 +492,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex )
{
return ( 0 );
}
bTownId = gMineLocation[ bMineIndex ].bAssociatedTown;
@@ -503,7 +502,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex )
// get workforce size (is 0-100 based on local town's loyalty)
iWorkForceSize = gTownLoyalty[ bTownId ].ubRating;
/*
/*
// adjust for monster infestation
iWorkForceSize *= gubMonsterMineInfestation[ gMineStatus[ bMineIndex ].bMonsters ];
iWorkForceSize /= 100;
@@ -523,7 +522,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex )
INT8 bTownId = 0;
// return the loyalty of the town associated with the mine
Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) );
// if mine is shut down
@@ -534,7 +533,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex )
bTownId = gMineLocation[ bMineIndex ].bAssociatedTown;
if( GetTownSectorSize( bTownId ) == 0 )
if( GetTownSectorSize( bTownId ) == 0 )
{
return 0;
}
@@ -542,7 +541,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex )
// get workforce size (is 0-100 based on REVERSE of local town's loyalty)
iWorkForceSize = 100 - gTownLoyalty[ bTownId ].ubRating;
/*
/*
// adjust for monster infestation
iWorkForceSize *= gubMonsterMineInfestation[ gMineStatus[ bMineIndex ].bMonsters ];
iWorkForceSize /= 100;
@@ -599,7 +598,7 @@ INT32 MineAMine( INT8 bMineIndex )
}
// who controls the PRODUCTION in the mine ? (Queen receives production unless player has spoken to the head miner)
// who controls the PRODUCTION in the mine ? (Queen receives production unless player has spoken to the head miner)
if( PlayerControlsMine(bMineIndex) )
{
// player controlled
@@ -628,7 +627,7 @@ INT32 MineAMine( INT8 bMineIndex )
{
// we didn't want mines to run out without player ever even going to them, so now the queen doesn't reduce the
// amount remaining until the mine has produced for the player first (so she'd have to capture it).
// WANNE: We do not want to give money to the player, when the queen has captured the mine!
if ( gMineStatus[ bMineIndex ].fMineHasProducedForPlayer )
{
@@ -667,7 +666,7 @@ void HandleIncomeFromMines( void )
}
if( iIncome )
{
AddTransactionToPlayersBook( DEPOSIT_FROM_SILVER_MINE, 0, GetWorldTotalMin( ), iIncome );
AddTransactionToPlayersBook( DEPOSIT_FROM_SILVER_MINE, 0, GetWorldTotalMin( ), iIncome );
}
}
@@ -690,7 +689,7 @@ UINT32 PredictDailyIncomeFromAMine( INT8 bMineIndex )
uiAmtExtracted = gMineStatus[ bMineIndex ].uiRemainingOreSupply;
}
}
return( uiAmtExtracted );
}
@@ -865,7 +864,7 @@ void ShutOffMineProduction( INT8 bMineIndex )
if ( !gMineStatus[ bMineIndex ].fShutDown )
{
gMineStatus[ bMineIndex ].fShutDown = TRUE;
AddHistoryToPlayersLog( HISTORY_MINE_SHUTDOWN, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_SHUTDOWN, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
}
@@ -879,7 +878,7 @@ void RestartMineProduction( INT8 bMineIndex )
if ( gMineStatus[ bMineIndex ].fShutDown )
{
gMineStatus[ bMineIndex ].fShutDown = FALSE;
AddHistoryToPlayersLog( HISTORY_MINE_REOPENED, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_REOPENED, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
}
}
@@ -1019,7 +1018,7 @@ UINT8 GetHeadMinersMineIndex( UINT8 ubMinerProfileId)
}
}
// not found! Illegal profile id receieved or something is very wrong
// not found! Illegal profile id receieved or something is very wrong
Assert(FALSE);
return( 0 );
}
@@ -1030,11 +1029,11 @@ void PlayerSpokeToHeadMiner( UINT8 ubMinerProfileId )
UINT8 ubMineIndex;
ubMineIndex = GetHeadMinersMineIndex( ubMinerProfileId );
// if this is our first time set a history fact
// if this is our first time set a history fact
if( gMineStatus[ ubMineIndex ].fSpokeToHeadMiner == FALSE )
{
AddHistoryToPlayersLog( HISTORY_TALKED_TO_MINER, gMineLocation[ ubMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ ubMineIndex ].sSectorX, gMineLocation[ ubMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_TALKED_TO_MINER, gMineLocation[ ubMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ ubMineIndex ].sSectorX, gMineLocation[ ubMineIndex ].sSectorY );
gMineStatus[ ubMineIndex ].fSpokeToHeadMiner = TRUE;
}
}
@@ -1187,7 +1186,7 @@ BOOLEAN HasHisMineBeenProducingForPlayerForSomeTime( UINT8 ubMinerProfileId )
ubMineIndex = GetHeadMinersMineIndex( ubMinerProfileId );
if ( gMineStatus[ ubMineIndex ].fMineHasProducedForPlayer &&
if ( gMineStatus[ ubMineIndex ].fMineHasProducedForPlayer &&
( ( GetWorldTotalMin() - gMineStatus[ ubMineIndex ].uiTimePlayerProductionStarted ) >= ( 24 * 60 ) ) )
{
return ( TRUE );
@@ -1287,10 +1286,10 @@ BOOLEAN PlayerForgotToTakeOverMine( UINT8 ubMineIndex )
// player hasn't spoken to the head miner, but hasn't attacked him either
// miner is alive
if ( (StrategicMap[( gMineLocation[ ubMineIndex ].sSectorX ) + ( MAP_WORLD_X * ( gMineLocation[ ubMineIndex ].sSectorY ) )].fEnemyControlled == FALSE ) &&
( !pMineStatus->fEmpty ) &&
( !pMineStatus->fSpokeToHeadMiner ) &&
( !pMineStatus->fAttackedHeadMiner ) &&
( gMercProfiles[ GetHeadMinerProfileIdForMine( ubMineIndex ) ].bLife > 0 ) )
( !pMineStatus->fEmpty ) &&
( !pMineStatus->fSpokeToHeadMiner ) &&
( !pMineStatus->fAttackedHeadMiner ) &&
( gMercProfiles[ GetHeadMinerProfileIdForMine( ubMineIndex ) ].bLife > 0 ) )
{
return( TRUE );
}