- When ordering a merc to interrogate, one can now select what type of prisoners should be interrogated primarily. Thus one no longer has to empty the prison just to get to the one remaining officer.

- Generals are now a separate prisoner type. They cannot join militia, but yield an impressive ransom.
- various prisoner fixes

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7327 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-07-10 21:19:26 +00:00
parent 7fb31cc9c8
commit 0efc3b7241
31 changed files with 1000 additions and 310 deletions
+45 -53
View File
@@ -6693,10 +6693,7 @@ BOOLEAN GetPlayerControlledPrisonList( std::vector<UINT32>& arSectorIDVector )
extern INT32 giReinforcementPool;
// we cannot simply move all prisoners of a sector. It might be a prison we are already using, so we would move all inmates, not just the new ones
UINT16 gusPrisonersOfficer = 0;
UINT16 gusPrisonersElite = 0;
UINT16 gusPrisonersRegular = 0;
UINT16 gusPrisonersAdmin = 0;
INT16 gsNumPrisoner[PRISONER_MAX] = {0};
void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
{
@@ -6727,7 +6724,9 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
}
BOOLEAN success = FALSE;
UINT16 prisonerstobemoved = gusPrisonersOfficer + gusPrisonersElite + gusPrisonersRegular + gusPrisonersAdmin;
INT16 prisonerstobemoved = 0;
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
prisonerstobemoved += gsNumPrisoner[i];
if ( usSectorID > 0 )
{
@@ -6737,7 +6736,7 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
{
success = TRUE;
ChangeNumberOfPrisoners( pPrisonSectorInfo, gusPrisonersOfficer, gusPrisonersElite, gusPrisonersRegular, gusPrisonersAdmin );
ChangeNumberOfPrisoners( pPrisonSectorInfo, gsNumPrisoner );
CHAR16 wString[64];
GetShortSectorString( SECTORX( usSectorID ), SECTORY( usSectorID ), wString );
@@ -6745,10 +6744,8 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
}
}
gusPrisonersOfficer = 0;
gusPrisonersElite = 0;
gusPrisonersRegular = 0;
gusPrisonersAdmin = 0;
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
gsNumPrisoner[i] = 0;
if ( !success )
{
@@ -6760,13 +6757,10 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
{
SOLDIERTYPE *pTeamSoldier;
INT32 cnt = 0;
UINT16 ubNumPrisoners = 0;
UINT16 ubNumPrisonerAdmin = 0;
UINT16 ubNumPrisonerTroop = 0;
UINT16 ubNumPrisonerElite = 0;
UINT16 ubNumPrisonerOfficer = 0;
SOLDIERTYPE* pTeamSoldier;
INT32 cnt = 0;
UINT16 ubNumPrisoners = 0;
INT16 sNumPrisoner[PRISONER_MAX] = {0};
// Check if the battle is won!
// Loop through all mercs and make go
@@ -6781,18 +6775,18 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// if we arrive here and the guy has lifepoints < OKLIFE, something is very odd... better take him prisoner and remove him anyway
//if ( pTeamSoldier->stats.bLife > OKLIFE && pTeamSoldier->stats.bLife != 0 )
{
// officers are 'special' prisoners...
if ( pTeamSoldier->usSoldierFlagMask & SOLDIER_ENEMY_OFFICER )
{
++ubNumPrisonerOfficer;
}
// officers and generals are 'special' prisoners...
if ( pTeamSoldier->usSoldierFlagMask & SOLDIER_VIP )
++sNumPrisoner[PRISONER_GENERAL];
else if ( pTeamSoldier->usSoldierFlagMask & SOLDIER_ENEMY_OFFICER )
++sNumPrisoner[PRISONER_OFFICER];
else
{
switch ( pTeamSoldier->ubSoldierClass )
{
case SOLDIER_CLASS_ADMINISTRATOR: ++ubNumPrisonerAdmin; break;
case SOLDIER_CLASS_ARMY: ++ubNumPrisonerTroop; break;
case SOLDIER_CLASS_ELITE: ++ubNumPrisonerElite; break;
case SOLDIER_CLASS_ADMINISTRATOR: ++sNumPrisoner[PRISONER_ADMIN]; break;
case SOLDIER_CLASS_ARMY: ++sNumPrisoner[PRISONER_REGULAR]; break;
case SOLDIER_CLASS_ELITE: ++sNumPrisoner[PRISONER_ELITE]; break;
default:
// if none of the above classes, ignore this one
continue;
@@ -6802,9 +6796,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// Flugente: VIPs
if ( pTeamSoldier->usSoldierFlagMask & SOLDIER_VIP )
{
DeleteVIP( pTeamSoldier->sSectorX, pTeamSoldier->sSectorY );
}
// Flugente: campaign stats
gCurrentIncident.AddStat( pTeamSoldier, CAMPAIGNHISTORY_TYPE_PRISONER );
@@ -6911,10 +6903,8 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
}
// remember all prisoners...
gusPrisonersOfficer = ubNumPrisonerOfficer;
gusPrisonersElite = ubNumPrisonerElite;
gusPrisonersRegular = ubNumPrisonerTroop;
gusPrisonersAdmin = ubNumPrisonerAdmin;
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
gsNumPrisoner[i] = sNumPrisoner[i];
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ PRISONER_DECIDE_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS, PrisonerMessageBoxCallBack, NULL );
}
@@ -10637,52 +10627,54 @@ BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr)
return FALSE;
}
UINT16 GetNumberOfPrisoners( SECTORINFO *pSectorInfo, UINT8* aOfficer, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
UINT16 GetNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aPrisoners[] )
{
if ( !pSectorInfo )
return 0;
*aOfficer = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER];
*apElite = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE];
*apRegular = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR];
*apAdmin = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN];
UINT16 sum = 0;
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
{
aPrisoners[i] = pSectorInfo->uiNumberOfPrisonersOfWar[i];
return (UINT16)(pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN]);
sum += pSectorInfo->uiNumberOfPrisonersOfWar[i];
}
return sum;
}
UINT16 GetNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, UINT8* aOfficer, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
UINT16 GetNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aPrisoners[] )
{
if ( !pSectorInfo )
return 0;
*aOfficer = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER];
*apElite = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE];
*apRegular = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR];
*apAdmin = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN];
UINT16 sum = 0;
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
{
aPrisoners[i] = pSectorInfo->uiNumberOfPrisonersOfWar[i];
return (UINT16)(pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN]);
sum += pSectorInfo->uiNumberOfPrisonersOfWar[i];
}
return sum;
}
void ChangeNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aOfficer, INT16 aElite, INT16 aRegular, INT16 aAdmin, INT16 sX, INT16 sY )
void ChangeNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aPrisoners[] )
{
if ( !pSectorInfo )
return;
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER] + aOfficer ) );
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + aElite) );
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + aRegular) );
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] + aAdmin) );
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
pSectorInfo->uiNumberOfPrisonersOfWar[i] = max( 0, min( 255, pSectorInfo->uiNumberOfPrisonersOfWar[i] + aPrisoners[i] ) );
}
void ChangeNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aOfficer, INT16 aElite, INT16 aRegular, INT16 aAdmin )
void ChangeNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aPrisoners[] )
{
if ( !pSectorInfo )
return;
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_OFFICER] + aOfficer ) );
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + aElite) );
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + aRegular) );
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] + aAdmin) );
for ( int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i )
pSectorInfo->uiNumberOfPrisonersOfWar[i] = max( 0, min( 255, pSectorInfo->uiNumberOfPrisonersOfWar[i] + aPrisoners[i] ) );
}
void DeleteAllPrisoners( SECTORINFO *pSectorInfo )
+4 -4
View File
@@ -373,11 +373,11 @@ BOOLEAN AllowedToStealFromTeamMate( UINT8 aAccessorID, UINT8 aTargetID );
BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr);
// Flugente: functions altering a sector's prisoners
UINT16 GetNumberOfPrisoners( SECTORINFO *pSectorInfo, UINT8* aOfficer, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin );
UINT16 GetNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, UINT8* aOfficer, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin );
UINT16 GetNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aPrisoners[] );
UINT16 GetNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aPrisoners[] );
void ChangeNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aOfficer, INT16 aElite, INT16 aRegular, INT16 aAdmin, INT16 sX = 0, INT16 sY = 0 );
void ChangeNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aOfficer, INT16 aElite, INT16 aRegular, INT16 aAdmin );
void ChangeNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aPrisoners[] );
void ChangeNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aPrisoners[] );
void DeleteAllPrisoners( SECTORINFO *pSectorInfo );
void DeleteAllPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo );
+2 -2
View File
@@ -16085,8 +16085,8 @@ BOOLEAN SOLDIERTYPE::CanProcessPrisoners( )
{
SECTORINFO *pSectorInfo = &(SectorInfo[SECTOR( this->sSectorX, this->sSectorY )]);
UINT8 tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
if ( GetNumberOfPrisoners( pSectorInfo, &tmp1, &tmp2, &tmp3, &tmp4 ) > 0 )
INT16 aPrisoners[PRISONER_MAX] = {0};
if ( GetNumberOfPrisoners( pSectorInfo, aPrisoners ) > 0 )
return TRUE;
}
+8
View File
@@ -399,6 +399,14 @@ enum
#define SOLDIER_SNITCHING_OFF 0x00000001 //1 // isn't allowed to snitch
#define SOLDIER_PREVENT_MISBEHAVIOUR_OFF 0x00000002 //2 // isn't allowed to prevent misbehaviour
#define SOLDIER_RAM_THROUGH_OBSTACLES 0x00000004 //4 // vehicle
#define SOLDIER_INTERROGATE_ADMIN 0x00000008 //8 // interrogate admins. Flags might not be the best solution, but I won't add an extra variable for this
#define SOLDIER_INTERROGATE_TROOP 0x00000010 //16 // interrogate troops
#define SOLDIER_INTERROGATE_ELITE 0x00000020 //32 // interrogate elites
#define SOLDIER_INTERROGATE_OFFICER 0x00000040 //64 // interrogate officers
#define SOLDIER_INTERROGATE_GENERAL 0x00000080 //128 // interrogate generals
#define SOLDIER_INTERROGATE_ALL 0x000000F8 // all interrogation flags
// ----------------------------------------------------------------
// -------- added by Flugente: background property flags --------
+2 -2
View File
@@ -2875,8 +2875,8 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
return;
// only continue if there are prisoners in this sector that need to be placed
UINT8 tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
UINT16 numprisoners = GetNumberOfPrisoners(pSector, &tmp1, &tmp2, &tmp3, &tmp4);
INT16 aPrisoners[PRISONER_MAX] = {0};
UINT16 numprisoners = GetNumberOfPrisoners( pSector, aPrisoners );
if ( !numprisoners )
return;