Merged from revision: 7579

Externalized (by Buggler):
- Kingpin's faction sector and roaming gridno around tony shop if they become hostile
- Queen's alternate grid no if basement sector is cleared
- Doreen's kids sector that is being freed
- Single sector towns does not give global loyalty bonus instead of previously hardcoded Tixa and Orta sector
- Enemy investigation town sectors if current loaded sector is player-controlled
- Associated town sectors to mine when mine runs out

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7580 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-10-17 16:25:58 +00:00
parent a87e977769
commit f9cad94471
5 changed files with 54 additions and 109 deletions
+10 -5
View File
@@ -269,17 +269,21 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
if ((bTownId != OMERTA) || (GetWorldDay() != 1))
{
ubSectorID = (UINT8)SECTOR( sMapX, sMapY );
if( !bMapZ && ubSectorID != SEC_J9 && ubSectorID != SEC_K4 )
if( !bMapZ )
{
HandleMoraleEvent( NULL, MORALE_TOWN_LIBERATED, sMapX, sMapY, bMapZ );
// single sector towns does not give global loyalty bonus
if( GetTownSectorSize( bTownId ) != 1 )
{
#ifdef JA2UB
//Ja25: no loyalty
#else
HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_TOWN_SECTOR, sMapX, sMapY, bMapZ );
#endif
// liberation by definition requires that the place was enemy controlled in the first place
CheckIfEntireTownHasBeenLiberated( bTownId, sMapX, sMapY );
}
// liberation by definition requires that the place was enemy controlled in the first place
CheckIfEntireTownHasBeenLiberated( bTownId, sMapX, sMapY );
}
}
}
@@ -368,8 +372,9 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
//Ja25 No strategic ai
#else
if( sMapX == 3 && sMapY == 16 && bMapZ == 1 )
{ //Basement sector (P3_b1)
if( sMapX == gModSettings.ubQueenBasementSectorX && sMapY == gModSettings.ubQueenBasementSectorY
&& bMapZ == gModSettings.ubQueenBasementSectorZ )
{ //Basement sector
gfUseAlternateQueenPosition = TRUE;
}
#endif
+26 -97
View File
@@ -454,6 +454,9 @@ void ClearStrategicLog();
void RecalculatePatrolWeight( INT32 iPatrolID );
void RecalculateGarrisonWeight( INT32 iGarrisonID );
extern INT8 GetTownAssociatedWithMine( INT8 bMineIndex );
extern INT8 GetMineIndexForSector( INT16 sX, INT16 sY );
INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinforcements );
INT32 PatrolReinforcementsRequested( INT32 iPatrolID );
@@ -5712,81 +5715,21 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY,
//will cause them to avoid the sector. Returns the number of redirected groups.
RedirectEnemyGroupsMovingThroughSector( (UINT8)sSectorX, (UINT8)sSectorY );
//For the purposes of a town being lost, we shall check to see if the queen wishes to investigate quickly after
//losing. This is done in town sectors when the character first takes it.
switch( ubSectorID )
//For the purposes of a town being lost, we shall check to see if the queen wishes to investigate quickly after losing.
//This is done in town sectors when the character first takes it.
//Only town size greater than 1 will be investigated from other sectors of the same town
UINT8 ubTownId = GetTownIdForSector( sSectorX, sSectorY );
if( ubTownId != BLANK_SECTOR && GetTownSectorSize( ubTownId ) != 1 )
{
case SEC_B13:
case SEC_C13:
case SEC_D13:
//Drassen
SectorInfo[ SEC_B13 ].ubInvestigativeState++;
SectorInfo[ SEC_C13 ].ubInvestigativeState++;
SectorInfo[ SEC_D13 ].ubInvestigativeState++;
break;
case SEC_A2:
case SEC_B2:
//Chitzena
SectorInfo[ SEC_A2 ].ubInvestigativeState++;
SectorInfo[ SEC_B2 ].ubInvestigativeState++;
break;
case SEC_G1:
case SEC_G2:
case SEC_H1:
case SEC_H2:
case SEC_H3:
//Grumm
SectorInfo[ SEC_G1 ].ubInvestigativeState++;
SectorInfo[ SEC_G2 ].ubInvestigativeState++;
SectorInfo[ SEC_H1 ].ubInvestigativeState++;
SectorInfo[ SEC_H2 ].ubInvestigativeState++;
SectorInfo[ SEC_H3 ].ubInvestigativeState++;
break;
case SEC_F8:
case SEC_F9:
case SEC_G8:
case SEC_G9:
case SEC_H8:
//Cambria
SectorInfo[ SEC_F8 ].ubInvestigativeState++;
SectorInfo[ SEC_F9 ].ubInvestigativeState++;
SectorInfo[ SEC_G8 ].ubInvestigativeState++;
SectorInfo[ SEC_G9 ].ubInvestigativeState++;
SectorInfo[ SEC_H8 ].ubInvestigativeState++;
break;
case SEC_H13:
case SEC_H14:
case SEC_I13:
case SEC_I14:
//Alma
SectorInfo[ SEC_H13 ].ubInvestigativeState++;
SectorInfo[ SEC_H14 ].ubInvestigativeState++;
SectorInfo[ SEC_I13 ].ubInvestigativeState++;
SectorInfo[ SEC_I14 ].ubInvestigativeState++;
break;
case SEC_L11:
case SEC_L12:
//Balime
SectorInfo[ SEC_L11 ].ubInvestigativeState++;
SectorInfo[ SEC_L12 ].ubInvestigativeState++;
break;
case SEC_N3:
case SEC_N4:
case SEC_N5:
case SEC_O3:
case SEC_O4:
case SEC_P3:
//Meduna
SectorInfo[ SEC_N3 ].ubInvestigativeState++;
SectorInfo[ SEC_N4 ].ubInvestigativeState++;
SectorInfo[ SEC_N5 ].ubInvestigativeState++;
SectorInfo[ SEC_O3 ].ubInvestigativeState++;
SectorInfo[ SEC_O4 ].ubInvestigativeState++;
SectorInfo[ SEC_P3 ].ubInvestigativeState++;
break;
default:
return;
for( INT32 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y + 1; i++ )
{
if( StrategicMap[ i ].bNameId == ubTownId )
SectorInfo[ STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ].ubInvestigativeState++;
}
}
else
return;
//Madd: tweaked to increase attacks for experienced and expert to 8 and 12, and unlimited for insane
UINT8 value9;
@@ -6080,32 +6023,18 @@ void RenderAIViewerGarrisonInfo( INT32 x, INT32 y, SECTORINFO *pSector )
void StrategicHandleMineThatRanOut( UINT8 ubSectorID )
{
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
// Queen will then have little interest in the town
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
switch( ubSectorID )
UINT8 ubTownId = GetTownAssociatedWithMine( GetMineIndexForSector( SECTORX( ubSectorID ), SECTORY( ubSectorID ) ) );
if( ubTownId != BLANK_SECTOR )
{
case SEC_B2:
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_A2 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_B2 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
break;
case SEC_D13:
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_B13 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_C13 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_D13 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
break;
case SEC_H8:
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_F8 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_F9 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_G8 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_G9 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_H8 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
break;
case SEC_I14:
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_H13 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_H14 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_I13 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_I14 ].ubGarrisonID ].ubComposition ].bPriority /= 4;
break;
for( INT32 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y + 1; i++ )
{
if( StrategicMap[ i ].bNameId == ubTownId )
gArmyComp[ gGarrisonGroup[ SectorInfo[ STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ].ubGarrisonID ].ubComposition ].bPriority /= 4;
}
}
}