mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Bugfix: dissolve all militia groups involved in a battle when it is completed. this fixes bad/immobile militia groups created by safehouses (ARC feature) (by rftr).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9170 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2678,21 +2678,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
||||
// Flugente: after we fought, move any militia in groups into the sector garrison - the player will likely want to rethink orders for the survivors
|
||||
// Flugente: in case militia died we have to lower the group sizes
|
||||
// loop over all militia groups that are in this sector and alter their size. If a group has size 0 delete it. If any militia are left place them into this sector
|
||||
{
|
||||
GROUP* pGroup = gpGroupList;
|
||||
while ( pGroup )
|
||||
{
|
||||
if ( pGroup->usGroupTeam == MILITIA_TEAM && pGroup->ubSectorX == gpAR->ubSectorX && pGroup->ubSectorY == gpAR->ubSectorY )
|
||||
{
|
||||
GROUP* pDeleteGroup = pGroup;
|
||||
pGroup = pGroup->next;
|
||||
|
||||
DissolveMilitiaGroup( pDeleteGroup->ubGroupID );
|
||||
}
|
||||
else
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
}
|
||||
DissolveAllMilitiaGroupsInSector(gpAR->ubSectorX, gpAR->ubSectorY);
|
||||
|
||||
//Record and process all enemy deaths
|
||||
for( i = 0; i < MAX_AR_TEAM_SIZE; ++i )
|
||||
|
||||
@@ -1776,3 +1776,21 @@ void DissolveMilitiaGroup( UINT8 uGroupId )
|
||||
RemovePGroup( pGroup );
|
||||
}
|
||||
}
|
||||
|
||||
void DissolveAllMilitiaGroupsInSector( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
GROUP* pGroup = gpGroupList;
|
||||
while ( pGroup )
|
||||
{
|
||||
if ( pGroup->usGroupTeam == MILITIA_TEAM && pGroup->ubSectorX == sMapX && pGroup->ubSectorY == sMapY )
|
||||
{
|
||||
GROUP* pDeleteGroup = pGroup;
|
||||
pGroup = pGroup->next;
|
||||
|
||||
DissolveMilitiaGroup( pDeleteGroup->ubGroupID );
|
||||
}
|
||||
else
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ BOOLEAN LoadMilitiaMovementInformationFromSavedGameFile( HWFILE hFile, UINT32 ui
|
||||
// delete a militia group and transfer its militia to the sector they are in
|
||||
void DissolveMilitiaGroup( UINT8 uGroupId );
|
||||
|
||||
void DissolveAllMilitiaGroupsInSector( INT16 sMapX, INT16 sMapY );
|
||||
|
||||
BOOLEAN MilitiaGroupEntersCurrentSector( UINT8 usGroupId, INT16 sMapX, INT16 sMapY );
|
||||
|
||||
#endif
|
||||
@@ -117,6 +117,7 @@
|
||||
#include "finances.h" // added by Flugente
|
||||
#include "MilitiaIndividual.h" // added by Flugente
|
||||
#include "Rebel Command.h"
|
||||
#include "MilitiaSquads.h"
|
||||
#endif
|
||||
#include "connect.h"
|
||||
|
||||
@@ -7927,6 +7928,8 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
||||
}
|
||||
|
||||
HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap();
|
||||
// rftr: dissolve any militia groups in the sector
|
||||
DissolveAllMilitiaGroupsInSector( gWorldSectorX, gWorldSectorY );
|
||||
//gfStrategicMilitiaChangesMade = TRUE;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user