mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +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:
@@ -2526,7 +2526,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Flugente: take care of promotions and individual militia update
|
// Flugente: take care of promotions and individual militia update
|
||||||
HandlePossibleMilitiaPromotion( gpCivs[i].pSoldier );
|
HandlePossibleMilitiaPromotion( gpCivs[i].pSoldier, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
TacticalRemoveSoldierPointer( gpCivs[ i ].pSoldier, FALSE );
|
TacticalRemoveSoldierPointer( gpCivs[ i ].pSoldier, FALSE );
|
||||||
@@ -5802,7 +5802,7 @@ void AutoResolveMilitiaDropAndPromote()
|
|||||||
else if ( gpCivs[i].pSoldier->stats.bLife >= OKLIFE / 2 )
|
else if ( gpCivs[i].pSoldier->stats.bLife >= OKLIFE / 2 )
|
||||||
{
|
{
|
||||||
// Flugente: take care of promotions and individual militia update
|
// Flugente: take care of promotions and individual militia update
|
||||||
HandlePossibleMilitiaPromotion( gpCivs[i].pSoldier );
|
HandlePossibleMilitiaPromotion( gpCivs[i].pSoldier, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// DO NOT DELETE HERE!!!!
|
// DO NOT DELETE HERE!!!!
|
||||||
@@ -5811,3 +5811,19 @@ void AutoResolveMilitiaDropAndPromote()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN IndividualMilitiaInUse_AutoResolve( UINT32 aMilitiaId )
|
||||||
|
{
|
||||||
|
if ( gpAR )
|
||||||
|
{
|
||||||
|
for ( INT32 i = 0; i < gpAR->ubCivs; ++i )
|
||||||
|
{
|
||||||
|
if ( gpCivs[i].pSoldier && aMilitiaId == gpCivs[i].pSoldier->usIndividualMilitiaID && IsLegalMilitiaId( gpCivs[i].pSoldier->usIndividualMilitiaID ) )
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
@@ -53,4 +53,6 @@ void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors();
|
|||||||
// Flugente: have all militia in autoresolve drop their gear and be promoted in necessary
|
// Flugente: have all militia in autoresolve drop their gear and be promoted in necessary
|
||||||
void AutoResolveMilitiaDropAndPromote();
|
void AutoResolveMilitiaDropAndPromote();
|
||||||
|
|
||||||
|
BOOLEAN IndividualMilitiaInUse_AutoResolve( UINT32 aMilitiaId );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "CampaignStats.h"
|
#include "CampaignStats.h"
|
||||||
#include "Town Militia.h"
|
#include "Town Militia.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
|
#include "Auto Resolve.h" // added for IndividualMilitiaInUse_AutoResolve(...)
|
||||||
|
|
||||||
MilitiaOriginData gMilitiaOriginData[MO_MAX];
|
MilitiaOriginData gMilitiaOriginData[MO_MAX];
|
||||||
|
|
||||||
@@ -538,6 +539,11 @@ UINT32 GetIdOfUnusedindividualMilitia( UINT8 aSoldierClass, UINT8 aSector )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( IndividualMilitiaInUse_AutoResolve( (*it).id ) )
|
||||||
|
{
|
||||||
|
found = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !found )
|
if ( !found )
|
||||||
{
|
{
|
||||||
return (*it).id;
|
return (*it).id;
|
||||||
@@ -554,7 +560,7 @@ UINT32 GetIdOfUnusedindividualMilitia( UINT8 aSoldierClass, UINT8 aSector )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle possible militia promotion and individual militia update
|
// 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
|
// we not only handle promotions here, but basically update this guy
|
||||||
MILITIA militia;
|
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
|
// 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_REGULAR] +
|
||||||
gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_ELITE] )
|
gCurrentIncident.usParticipants[CAMPAIGNHISTORY_SD_MILITIA_ELITE]) )
|
||||||
{
|
{
|
||||||
MILITIA_BATTLEREPORT report;
|
MILITIA_BATTLEREPORT report;
|
||||||
report.id = GetIdOfCurrentlyOngoingIncident( );
|
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 )
|
if ( pSoldier->stats.bLife < OKLIFE )
|
||||||
report.flagmask |= MILITIA_BATTLEREPORT_FLAG_WOUNDED_COMA;
|
report.flagmask |= MILITIA_BATTLEREPORT_FLAG_WOUNDED_COMA;
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ UINT32 CreateNewIndividualMilitia( UINT8 aSoldierClass, UINT8 aOrigin, UINT8 aSe
|
|||||||
UINT32 GetIdOfUnusedindividualMilitia( UINT8 aSoldierClass, UINT8 aSector );
|
UINT32 GetIdOfUnusedindividualMilitia( UINT8 aSoldierClass, UINT8 aSector );
|
||||||
|
|
||||||
// handle possible militia promotion and individual militia update
|
// handle possible militia promotion and individual militia update
|
||||||
void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier );
|
void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve );
|
||||||
|
|
||||||
void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites );
|
void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites );
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ void HandleMilitiaPromotions( void )
|
|||||||
if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 )
|
if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 )
|
||||||
{
|
{
|
||||||
// Flugente: take care of promotions and individual militia update
|
// Flugente: take care of promotions and individual militia update
|
||||||
HandlePossibleMilitiaPromotion( pTeamSoldier );
|
HandlePossibleMilitiaPromotion( pTeamSoldier, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3324,6 +3324,15 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass, INT16 sX, INT16 sY )
|
|||||||
//bp.bAttitude = AGGRESSIVE;
|
//bp.bAttitude = AGGRESSIVE;
|
||||||
bp.ubBodyType = -1;
|
bp.ubBodyType = -1;
|
||||||
CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp, sX, sY );
|
CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp, sX, sY );
|
||||||
|
|
||||||
|
// Flugente: this might not be properly filled in autoresolve
|
||||||
|
if ( guiCurrentScreen == AUTORESOLVE_SCREEN )
|
||||||
|
{
|
||||||
|
pp.sSectorX = sX;
|
||||||
|
pp.sSectorY = sY;
|
||||||
|
pp.bSectorZ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
pSoldier = TacticalCreateSoldier( &pp, &ubID );
|
pSoldier = TacticalCreateSoldier( &pp, &ubID );
|
||||||
|
|
||||||
return pSoldier;
|
return pSoldier;
|
||||||
|
|||||||
Reference in New Issue
Block a user