From 613e59b2c68d46ee439e32dfdab32cb71f78979e Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 25 Sep 2011 09:17:45 +0000 Subject: [PATCH] MERGED source code from development trunk (revision: 4658) - Bugfix: Militia do not stop enemy invasion on strategic map (fix by tazpn) o see here: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=290508#Post290508 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4659 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/PreBattle Interface.cpp | 51 ++++++++++++++++++------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index f7cfe619..468cf345 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -349,27 +349,30 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gfDisplayPotentialRetreatPaths = FALSE; - gpBattleGroup = pBattleGroup; - - //calc sector values - if( gpBattleGroup ) - { - gubPBSectorX = gpBattleGroup->ubSectorX; - gubPBSectorY = gpBattleGroup->ubSectorY; - gubPBSectorZ = gpBattleGroup->ubSectorZ; - - // get number of enemies thought to be here - SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = NumEnemiesInSector( gubPBSectorX, gubPBSectorY ); - fMapPanelDirty = TRUE; - } - else - { - gubPBSectorX = (UINT8)SECTORX( gubSectorIDOfCreatureAttack ); - gubPBSectorY = (UINT8)SECTORY( gubSectorIDOfCreatureAttack ); - gubPBSectorZ = 0; - } } - else + + gpBattleGroup = pBattleGroup; + + //calc sector values + if( gpBattleGroup ) + { + gubPBSectorX = gpBattleGroup->ubSectorX; + gubPBSectorY = gpBattleGroup->ubSectorY; + gubPBSectorZ = gpBattleGroup->ubSectorZ; + + // get number of enemies thought to be here + SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = NumEnemiesInSector( gubPBSectorX, gubPBSectorY ); + fMapPanelDirty = TRUE; + } + else if( gfPersistantPBI ) + { + gubPBSectorX = (UINT8)SECTORX( gubSectorIDOfCreatureAttack ); + gubPBSectorY = (UINT8)SECTORY( gubSectorIDOfCreatureAttack ); + gubPBSectorZ = 0; + } + + + if( !gfPersistantPBI ) { //calculate the non-persistant situation gfBlinkHeader = TRUE; @@ -381,7 +384,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) { //There are bloodcats in the sector, so no autoresolve allowed gubExplicitEnemyEncounterCode = HOSTILE_BLOODCATS_CODE; } - else if( gbWorldSectorZ ) + else if( gbWorldSectorZ > 0 ) { //We are underground, so no autoresolve allowed pSector = &SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ]; if( pSector->ubCreaturesInBattle ) @@ -393,6 +396,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE; } } + else if (pBattleGroup && !pBattleGroup->fPlayer && CountAllMilitiaInSector( pBattleGroup->ubSectorX, pBattleGroup->ubSectorY ) > 0) + { + gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE; + } else if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE || gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || @@ -1772,7 +1779,7 @@ void CalculateNonPersistantPBIInfo() { //There are bloodcats in the sector, so no autoresolve allowed gubExplicitEnemyEncounterCode = HOSTILE_BLOODCATS_CODE; } - else if( gbWorldSectorZ ) + else if( gbWorldSectorZ > 0 ) { UNDERGROUND_SECTORINFO *pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); Assert( pSector );