- added more messages

- remaining interrogation points are taken over to the next hour

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5713 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2012-12-05 01:29:08 +00:00
parent 3bb14a870b
commit c68b5e482f
15 changed files with 123 additions and 106 deletions
+51 -80
View File
@@ -2614,7 +2614,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
extern INT32 CalcThreateningEffectiveness( UINT8 ubMerc );
// Flugente: calculate interrogation value
FLOAT CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
{
UINT32 usInterrogationPoints = 0;
@@ -2629,7 +2629,7 @@ FLOAT CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
// no prisoners -> no interrogation (this should not happen)
if ( !*pusMaxPts )
return .0f;
return 0;
usInterrogationPoints = 50 + 10 * EffectiveExpLevel( pSoldier ) + EffectiveLeadership( pSoldier );
@@ -2649,7 +2649,7 @@ FLOAT CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
}
// Flugente: calculate prison guard value
FLOAT CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
{
// this is not an assignment. Simply being in the sector will allow us to be counted as guards
UINT32 usValue = 0;
@@ -5480,6 +5480,10 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
if ( !gGameExternalOptions.fAllowPrisonerSystem )
return;
// no underground prisons!
if ( bZ )
return;
// Is there a prison in this sector?
UINT16 prisonerbaselimit = 0;
for (UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt)
@@ -5500,19 +5504,13 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
return;
// Are there any prisoners in this prison?
UINT32 numprisoners = 0;
if ( !bZ )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
numprisoners = pSectorInfo->uiNumberOfPrisonersOfWar;
}
else
{
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
UINT32 numprisoners = pSectorInfo->uiNumberOfPrisonersOfWar;
numprisoners = pSectorInfo->uiNumberOfPrisonersOfWar;
}
// add interrogation progress from last hour and erase it in data
UINT32 interrogationpoints = pSectorInfo->uiInterrogationHundredsLeft;
pSectorInfo->uiInterrogationHundredsLeft = 0;
if ( !numprisoners )
return;
@@ -5521,13 +5519,12 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
if (!SectorOursAndPeaceful( sMapX, sMapY, bZ ))
return;
// loop over all mercs in this sector that are on the FACILITY_INTERROGATE_PRISONERS assignment and determine their interrogation progress
// loop over all mercs in this sector that are on the FACILITY_INTERROGATE_PRISONERS assignment and determine their interrogation progress
UINT8 numinterrogators = 0;
// count any interrogators found here, and sum up their interrogation values
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt=0;
UINT8 numinterrogators = 0;
FLOAT interrogationpoints = .0f;
// count any interrogators found here, and sum up their interrogation values
for ( uiCnt = 0, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++uiCnt, ++pSoldier)
{
if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) )
@@ -5545,14 +5542,18 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
if ( !numinterrogators )
return;
// for every x points, we can interrogate 1 prisoner
// TODO: for now, we lose the remaining points
UINT32 prisonersinterrogated = interrogationpoints / 100;
// the part that gets left behind is saved to the map (but not the part that gets lost due to there not being enough prisoners)
interrogationpoints -= prisonersinterrogated * 100;
pSectorInfo->uiInterrogationHundredsLeft = (UINT8)(interrogationpoints);
if ( prisonersinterrogated > numprisoners )
prisonersinterrogated = numprisoners;
if ( !prisonersinterrogated )
return;
@@ -5675,27 +5676,12 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
}
}
// remove interrogated prisoners...
if ( !bZ )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
// safety first...
if ( prisonersinterrogated > pSectorInfo->uiNumberOfPrisonersOfWar )
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
else
pSectorInfo->uiNumberOfPrisonersOfWar -= prisonersinterrogated;
}
// remove interrogated prisoners...
// safety first...
if ( prisonersinterrogated > pSectorInfo->uiNumberOfPrisonersOfWar )
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
else
{
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
// safety first...
if ( prisonersinterrogated > pSectorInfo->uiNumberOfPrisonersOfWar )
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
else
pSectorInfo->uiNumberOfPrisonersOfWar -= prisonersinterrogated;
}
pSectorInfo->uiNumberOfPrisonersOfWar -= prisonersinterrogated;
}
// Flugente: prisons can riot if there aren't enough guards around
@@ -5704,6 +5690,10 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ )
if ( !gGameExternalOptions.fAllowPrisonerSystem )
return;
// no underground prisons!
if ( bZ )
return;
BOOLEAN fBeginRiot = FALSE;
// Is there a prison in this sector?
@@ -5726,44 +5716,38 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ )
return;
// Are there any prisoners in this prison?
UINT32 numprisoners = 0;
if ( !bZ )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
numprisoners = pSectorInfo->uiNumberOfPrisonersOfWar;
}
else
{
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
numprisoners = pSectorInfo->uiNumberOfPrisonersOfWar;
}
UINT32 numprisoners = pSectorInfo->uiNumberOfPrisonersOfWar;
if ( !numprisoners )
return;
CHAR16 wSectorName[ 64 ];
GetShortSectorString( sMapX, sMapY, wSectorName );
// if sector is not under our control, the prisoners are added to the local garrison
if( !bZ && StrategicMap[ sMapX + sMapY * MAP_WORLD_X ].fEnemyControlled == TRUE )
if( StrategicMap[ sMapX + sMapY * MAP_WORLD_X ].fEnemyControlled == TRUE )
{
// add enemies
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
pSectorInfo->ubNumTroops += numprisoners;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_ARMY_FREED_PRISON], wSectorName );
return;
}
// if sector not under our control, has enemies in it, or is currently in combat mode
if (!SectorOursAndPeaceful( sMapX, sMapY, bZ ))
return;
// loop over all mercs in this sector that are on the FACILITY_INTERROGATE_PRISONERS assignment and determine their interrogation progress
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt = 0;
// loop over all mercs in this sector that are on the FACILITY_INTERROGATE_PRISONERS assignment and add up their interrogation values
UINT8 numprisonguards = 0;
FLOAT prisonguardvalue = .0f;
UINT32 prisonguardvalue = 0;
// count any interrogators found here, and sum up their interrogation values
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt = 0;
UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID;
for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier)
@@ -5776,45 +5760,32 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ )
prisonguardvalue += CalculatePrisonGuardValue(pSoldier, &tmp );
}
}
// add militia strength
if ( !bZ )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
prisonguardvalue += 100 * pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + 150 * pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + 200 * pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
}
else
{
// there are no underground prisons, so screw this...
}
// add militia strength
prisonguardvalue += 100 * pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + 150 * pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + 200 * pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
if ( !numprisonguards )
fBeginRiot = TRUE;
// we now have to determine the combined strength of the prisoners
FLOAT prisonerriotvalue = .0f;
UINT32 prisonerriotvalue = 0;
for ( UINT32 i = 0; i < numprisoners; ++i )
{
prisonerriotvalue += 100.0f;
prisonerriotvalue += 100;
}
if ( prisonerriotvalue > prisonguardvalue )
{
if ( numprisoners > prisonerbaselimit && Random( (UINT32)(prisonerriotvalue) ) > Random( (UINT32)(prisonguardvalue) ) )
if ( numprisoners > prisonerbaselimit && Random( prisonerriotvalue ) > Random( prisonguardvalue ) )
fBeginRiot = TRUE;
}
if ( fBeginRiot )
{
// add enemies
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
pSectorInfo->ubNumTroops += numprisoners;
CHAR16 zShortTownIDString[ 50 ];
GetShortSectorString( sMapX, sMapX, zShortTownIDString );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_RIOT], zShortTownIDString );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_RIOT], wSectorName );
}
}
+2 -2
View File
@@ -191,8 +191,8 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts,
UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts, BOOLEAN fMakeSureKitIsInHand );
// Flugente: calculate interrogation and prison guard values
FLOAT CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts );
FLOAT CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts );
UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts );
UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts );
// get bonus tarining pts due to an instructor for this student
// HEADROCK HAM 3.5: Three functions below have lost an argument which is no longer required ("uiAtGunRange", which was "uiAtFacility" in HAM 3.4)
+3 -2
View File
@@ -480,8 +480,9 @@ typedef struct SECTORINFO
#endif
UINT32 uiNumberOfPrisonersOfWar;
INT8 bPadding[ 37 ];
UINT8 uiInterrogationHundredsLeft;
INT8 bPadding[ 36 ];
}SECTORINFO;
+1 -1
View File
@@ -2408,7 +2408,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
case FACILITY_INTERROGATE_PRISONERS:
sIconIndex = 23;
fDoIcon = TRUE;
sPtsAvailable = (INT16)( CalculateInterrogationValue(pSoldier, &usMaximumPts ) ) / 100;
sPtsAvailable = (INT16)( CalculateInterrogationValue(pSoldier, &usMaximumPts )/100 );
fShowNumber = TRUE;
fShowMaximum = TRUE;
break;
+31 -15
View File
@@ -6674,14 +6674,21 @@ extern INT32 giReinforcementPool;
void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
{
if (ubExitValue == MSG_BOX_RETURN_NO)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_RELEASED] );
}
UINT32 prisonerstobemoved = 0;
BOOLEAN success = FALSE;
if ( !gbWorldSectorZ )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
UINT32 prisonerstobemoved = pSectorInfo->uiNumberOfPrisonersOfWar;
prisonerstobemoved = pSectorInfo->uiNumberOfPrisonersOfWar;
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
if (ubExitValue == MSG_BOX_RETURN_YES)
{
UINT32 uSectorID = 0;
@@ -6690,21 +6697,23 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ uSectorID ] );
if ( pPrisonSectorInfo )
{
success = TRUE;
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
CHAR16 wString[ 64 ];
GetShortSectorString( gWorldSectorX, gWorldSectorY, wString );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
}
}
}
else
{
// send some prisoners back to queen's pool
// there is a chance that escaped prisoners may return to the queen...
giReinforcementPool += (prisonerstobemoved * gGameExternalOptions.ubPrisonerReturntoQueenChance) / 100;
}
}
else
{
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
UINT32 prisonerstobemoved = pSectorInfo->uiNumberOfPrisonersOfWar;
prisonerstobemoved = pSectorInfo->uiNumberOfPrisonersOfWar;
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
@@ -6716,16 +6725,23 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ uSectorID ] );
if ( pPrisonSectorInfo )
{
success = TRUE;
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
CHAR16 wString[ 64 ];
GetShortSectorString( gWorldSectorX, gWorldSectorY, wString );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
}
}
}
else
{
// send some prisoners back to queen's pool
// there is a chance that escaped prisoners may return to the queen...
giReinforcementPool += (prisonerstobemoved * gGameExternalOptions.ubPrisonerReturntoQueenChance) / 100;
}
}
if ( !success )
// send some prisoners back to queen's pool
// there is a chance that escaped prisoners may return to the queen...
giReinforcementPool += (prisonerstobemoved * gGameExternalOptions.ubPrisonerReturntoQueenChance) / 100;
}
void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
+3
View File
@@ -735,6 +735,9 @@ enum
STR_PRISONER_DETECTION,
STR_PRISONER_TURN_MILITIA,
STR_PRISONER_RIOT,
STR_PRISONER_SENTTOSECTOR,
STR_PRISONER_RELEASED,
STR_PRISONER_ARMY_FREED_PRISON,
TEXT_NUM_PRISONER_STR
};
+3
View File
@@ -7494,6 +7494,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //CHINESE
+3
View File
@@ -7487,6 +7487,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //DUTCH
+3
View File
@@ -7474,6 +7474,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //ENGLISH
+3
View File
@@ -7461,6 +7461,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //FRENCH
+8 -6
View File
@@ -7294,14 +7294,16 @@ STR16 szFoodTextStr[]=
L"Sectorwide canteen filling not possible, Food System is off!"
};
// TODO.Translate
STR16 szPrisonerTextStr[]=
{
L"%d prisoners were interrogated.",
L"%d prisoners paid ransom money.",
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"%d Gefangenge wurden verhört.",
L"%d Gefangene wurden gegen Lösegeld freigelassen.",
L"%d Gefangene haben uns Truppenstandorte verraten.",
L"%d Gefangene schliessen sich uns an.",
L"Gefangenenaufstand in %s!",
L"Gefangene wurden nach %s geschickt!",
L"Gefangene freigelassen!",
L"Die Armee hat das Gefängnis in %s besetzt, die Gefangenen wurden befreit!",
};
#endif //GERMAN
+3
View File
@@ -7474,6 +7474,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //ITALIAN
+3
View File
@@ -7488,6 +7488,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //POLISH
+3
View File
@@ -7440,6 +7440,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //RUSSIAN
+3
View File
@@ -7491,6 +7491,9 @@ STR16 szPrisonerTextStr[]=
L"%d prisoners revealed enemy positions.",
L"%d prisoners joined our cause.",
L"Prisoners start a massive riot in %s!",
L"Prisoners were sent to %s!",
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
};
#endif //TAIWANESE