- Prisoners of war are now spawned in prison sectors. They have fitting dialogue etc. Harming them slightly lowers global loyalty.

- Prisoner system: added ini options that allow display of surrender strength sum, and externalised surrender strength modifier
- Fix: wrong assignment string in strategic view

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5895 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-03-05 01:02:59 +00:00
parent ca20403bc4
commit 36f7399d3b
23 changed files with 319 additions and 13 deletions
+64
View File
@@ -918,6 +918,10 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum )
if ( bTeam == MILITIA_TEAM )
SectorAddAssassins(gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
// Flugente: spawn prisoners of war in prison sectors
if ( bTeam == CIV_TEAM )
SectorAddPrisonersofWar(gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
//There aren't any basic placements of desired team, so exit.
return ubNumAdded;
}
@@ -965,6 +969,10 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum )
if ( bTeam == MILITIA_TEAM )
SectorAddAssassins(gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
// Flugente: spawn prisoners of war in prison sectors
if ( bTeam == CIV_TEAM )
SectorAddPrisonersofWar(gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
return ubNumAdded;
}
@@ -2793,3 +2801,59 @@ void SectorAddAssassins( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
++numberofcivs;
}
}
// Flugente: decide wether to create prisoners of war in a sector. Not to be confused with player POWs
void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
{
// this needs to be turned on on
if ( !gGameExternalOptions.fAllowPrisonerSystem )
return;
// not in underground sectors
if ( sMapZ > 0 )
return;
// get sector
SECTORINFO *pSector = &SectorInfo[ SECTOR( sMapX, sMapY ) ];
if ( !pSector )
return;
// only continue if there are prisoners in this sector that need to be placed
UINT32 numprisoners = pSector->uiNumberOfPrisonersOfWar;
numprisoners = 30;
if ( !numprisoners )
return;
// count current number of civilians and already placed pows
UINT16 numberofcivs = 0;
UINT16 numberofpows = 0;
SOLDIERTYPE* pTeamSoldier = NULL;
INT32 cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID;
INT32 lastid = gTacticalStatus.Team[ CIV_TEAM ].bLastID;
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt < lastid; ++cnt, ++pTeamSoldier)
{
// check if teamsoldier exists in this sector
if ( pTeamSoldier && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->sSectorX == sMapX && pTeamSoldier->sSectorY == sMapY && pTeamSoldier->bSectorZ == sMapZ )
++numberofcivs;
// count how many pows are already placed
if ( pTeamSoldier->bSoldierFlagMask & SOLDIER_POW_PRISON )
++numberofpows;
}
// we can't spawn if all civilian slots are already taken (we leave a bit of reserve for more important civs)
UINT8 maxcivs = max(0, gGameExternalOptions.ubGameMaximumNumberOfCivilians - 3);
for (UINT8 i = numberofpows; i < numprisoners; ++i)
{
if ( numberofcivs < maxcivs )
{
CreatePrisonerOfWar();
++numberofcivs;
}
else
break;
}
}