mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Bug fix for militia movement on strategic screen not setting group ID for battles.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1312 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1957,6 +1957,10 @@ static void ARCreateMilitia( UINT8 mclass, INT32 i, INT16 sX, INT16 sY)
|
|||||||
// reset counter of how many mortars this team has rolled
|
// reset counter of how many mortars this team has rolled
|
||||||
ResetMortarsOnTeamCount();
|
ResetMortarsOnTeamCount();
|
||||||
|
|
||||||
|
if( !gpBattleGroup ) {
|
||||||
|
AssertMsg(0, "No battle group set while creating militia");
|
||||||
|
}
|
||||||
|
|
||||||
if( mclass == SOLDIER_CLASS_ELITE_MILITIA )
|
if( mclass == SOLDIER_CLASS_ELITE_MILITIA )
|
||||||
{
|
{
|
||||||
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_ELITE_MILITIA );
|
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_ELITE_MILITIA );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "Auto Resolve.h"
|
#include "Auto Resolve.h"
|
||||||
#include "Vehicles.h"
|
#include "Vehicles.h"
|
||||||
|
#include "Tactical Save.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "MilitiaSquads.h"
|
#include "MilitiaSquads.h"
|
||||||
@@ -506,6 +507,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
|||||||
{
|
{
|
||||||
if( GetWorldHour() % 2 )return;
|
if( GetWorldHour() % 2 )return;
|
||||||
|
|
||||||
|
memset(pMoveDir, 0, sizeof(pMoveDir));
|
||||||
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, FALSE, FALSE );
|
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, FALSE, FALSE );
|
||||||
|
|
||||||
if( uiDirNumber )
|
if( uiDirNumber )
|
||||||
@@ -543,32 +545,39 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ), FALSE );
|
// WDS bug fix for moving militia
|
||||||
AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
|
int targetX = SECTORX( pMoveDir[ iRandomRes ][0] );
|
||||||
|
int targetY = SECTORY( pMoveDir[ iRandomRes ][0] );
|
||||||
|
Assert(targetX >= 0 && targetX < MAP_WORLD_X);
|
||||||
|
Assert(targetY >= 0 && targetY < MAP_WORLD_Y);
|
||||||
|
MoveMilitiaSquad( sMapX, sMapY, targetX, targetY, FALSE );
|
||||||
|
AddToBlockMoveList( targetX, targetY );
|
||||||
if ( gfStrategicMilitiaChangesMade)
|
if ( gfStrategicMilitiaChangesMade)
|
||||||
{
|
{
|
||||||
ResetMilitia();
|
ResetMilitia();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NumEnemiesInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) )
|
if( NumEnemiesInSector( targetX, targetY ) )
|
||||||
{
|
{
|
||||||
/* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) );
|
extern GROUP *gpBattleGroup;
|
||||||
|
gpBattleGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) );
|
||||||
|
/* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) );
|
||||||
|
|
||||||
if(pEnemyGroup && pEnemyGroup->ubGroupID)
|
if(pEnemyGroup && pEnemyGroup->ubGroupID)
|
||||||
{
|
{
|
||||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID ));
|
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, targetX, SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID ));
|
||||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arrival 1, Arrival 2");
|
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arrival 1, Arrival 2");
|
||||||
|
|
||||||
pEnemyGroup->ubPrevX = sMapX;
|
pEnemyGroup->ubPrevX = sMapX;
|
||||||
pEnemyGroup->ubPrevY = sMapY;
|
pEnemyGroup->ubPrevY = sMapY;
|
||||||
|
|
||||||
pEnemyGroup->ubNextX = SECTORX( pMoveDir[ iRandomRes ][0] );
|
pEnemyGroup->ubNextX = targetX;
|
||||||
pEnemyGroup->ubNextY = SECTORY( pMoveDir[ iRandomRes ][0] );
|
pEnemyGroup->ubNextY = targetY;
|
||||||
*/
|
*/
|
||||||
gfMSBattle = TRUE;
|
gfMSBattle = TRUE;
|
||||||
|
|
||||||
// GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE );
|
// GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE );
|
||||||
EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
|
EnterAutoResolveMode( targetX, targetY );
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user