mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
- Fix: same militia profile is used several times in autoresolve
- Fix: sometimes no battle repoer is written for autoresolve - Fix: no militia profile found in autoresolve due to bad sector git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8229 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "CampaignStats.h"
|
||||
#include "Town Militia.h"
|
||||
#include "message.h"
|
||||
#include "Auto Resolve.h" // added for IndividualMilitiaInUse_AutoResolve(...)
|
||||
|
||||
MilitiaOriginData gMilitiaOriginData[MO_MAX];
|
||||
|
||||
@@ -538,6 +539,11 @@ UINT32 GetIdOfUnusedindividualMilitia( UINT8 aSoldierClass, UINT8 aSector )
|
||||
}
|
||||
}
|
||||
|
||||
if ( IndividualMilitiaInUse_AutoResolve( (*it).id ) )
|
||||
{
|
||||
found = TRUE;
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
{
|
||||
return (*it).id;
|
||||
@@ -554,7 +560,7 @@ UINT32 GetIdOfUnusedindividualMilitia( UINT8 aSoldierClass, UINT8 aSector )
|
||||
}
|
||||
|
||||
// handle possible militia promotion and individual militia update
|
||||
void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier )
|
||||
void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve )
|
||||
{
|
||||
// we not only handle promotions here, but basically update this guy
|
||||
MILITIA militia;
|
||||
@@ -608,13 +614,17 @@ void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier )
|
||||
}
|
||||
|
||||
// add a battle report if there was a battle (if there was a battle there will have been participants
|
||||
if ( gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_GREEN] +
|
||||
if ( aAutoResolve || (gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_GREEN] +
|
||||
gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_REGULAR] +
|
||||
gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_ELITE] )
|
||||
gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_ELITE]) )
|
||||
{
|
||||
MILITIA_BATTLEREPORT report;
|
||||
report.id = GetIdOfCurrentlyOngoingIncident( );
|
||||
|
||||
// if we are in autoresolve, then the report has already been created at this point
|
||||
if ( aAutoResolve )
|
||||
report.id = max( 0, report.id - 1 );
|
||||
|
||||
if ( pSoldier->stats.bLife < OKLIFE )
|
||||
report.flagmask |= MILITIA_BATTLEREPORT_FLAG_WOUNDED_COMA;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user