mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Merged revision(s) 7523 from branches/ja2_source_official_2014:
Fix: enemy radio operators called in artillery even though it could not fire git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7524 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -17421,6 +17421,15 @@ BOOLEAN SOLDIERTYPE::CanUseSkill( INT8 iSkill, BOOLEAN fAPCheck )
|
|||||||
{
|
{
|
||||||
// radio operator
|
// radio operator
|
||||||
case SKILLS_RADIO_ARTILLERY:
|
case SKILLS_RADIO_ARTILLERY:
|
||||||
|
if ( (!fAPCheck || EnoughPoints( this, APBPConstants[AP_RADIO], APBPConstants[BP_RADIO], FALSE )) && CanUseRadio() )
|
||||||
|
{
|
||||||
|
// we also have to check wether we can really order a strike from a sector
|
||||||
|
UINT32 sector = 0;
|
||||||
|
if ( this->CanAnyArtilleryStrikeBeOrdered( §or ) )
|
||||||
|
canuse = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case SKILLS_RADIO_JAM:
|
case SKILLS_RADIO_JAM:
|
||||||
case SKILLS_RADIO_SCAN_FOR_JAM:
|
case SKILLS_RADIO_SCAN_FOR_JAM:
|
||||||
case SKILLS_RADIO_LISTEN:
|
case SKILLS_RADIO_LISTEN:
|
||||||
@@ -17460,13 +17469,13 @@ BOOLEAN SOLDIERTYPE::UseSkill( UINT8 iSkill, INT32 usMapPos, UINT8 ID )
|
|||||||
// radio operator
|
// radio operator
|
||||||
// the call for SKILLS_RADIO_ARTILLERY is only used by the AI
|
// the call for SKILLS_RADIO_ARTILLERY is only used by the AI
|
||||||
case SKILLS_RADIO_ARTILLERY:
|
case SKILLS_RADIO_ARTILLERY:
|
||||||
{
|
{
|
||||||
UINT32 sector = 0;
|
UINT32 sector = 0;
|
||||||
if ( this->CanAnyArtilleryStrikeBeOrdered( §or ) )
|
if ( this->CanAnyArtilleryStrikeBeOrdered( §or ) )
|
||||||
{
|
{
|
||||||
return OrderArtilleryStrike( sector, usMapPos, this->bTeam );
|
return OrderArtilleryStrike( sector, usMapPos, this->bTeam );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKILLS_RADIO_JAM:
|
case SKILLS_RADIO_JAM:
|
||||||
@@ -17535,10 +17544,10 @@ STR16 SOLDIERTYPE::PrintSkillDesc( INT8 iSkill )
|
|||||||
switch ( iSkill )
|
switch ( iSkill )
|
||||||
{
|
{
|
||||||
// radio operator
|
// radio operator
|
||||||
case SKILLS_RADIO_ARTILLERY:
|
case SKILLS_RADIO_ARTILLERY:
|
||||||
case SKILLS_RADIO_JAM:
|
case SKILLS_RADIO_JAM:
|
||||||
case SKILLS_RADIO_SCAN_FOR_JAM:
|
case SKILLS_RADIO_SCAN_FOR_JAM:
|
||||||
case SKILLS_RADIO_LISTEN:
|
case SKILLS_RADIO_LISTEN:
|
||||||
case SKILLS_RADIO_CALLREINFORCEMENTS:
|
case SKILLS_RADIO_CALLREINFORCEMENTS:
|
||||||
case SKILLS_RADIO_TURNOFF:
|
case SKILLS_RADIO_TURNOFF:
|
||||||
|
|
||||||
@@ -17548,7 +17557,7 @@ STR16 SOLDIERTYPE::PrintSkillDesc( INT8 iSkill )
|
|||||||
swprintf( atStr, pTraitSkillsDenialStrings[TEXT_SKILL_DENIAL_X_TXT], New113Message[MSG113_WORKING_RADIO_SET] );
|
swprintf( atStr, pTraitSkillsDenialStrings[TEXT_SKILL_DENIAL_X_TXT], New113Message[MSG113_WORKING_RADIO_SET] );
|
||||||
wcscat( skilldescarray, atStr );
|
wcscat( skilldescarray, atStr );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKILLS_SPOTTER:
|
case SKILLS_SPOTTER:
|
||||||
swprintf( atStr, pTraitSkillsDenialStrings[TEXT_SKILL_DENIAL_X_AP], APBPConstants[AP_SPOTTER] );
|
swprintf( atStr, pTraitSkillsDenialStrings[TEXT_SKILL_DENIAL_X_AP], APBPConstants[AP_SPOTTER] );
|
||||||
@@ -22126,16 +22135,23 @@ BOOLEAN IsValidArtilleryOrderSector( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
|||||||
if ( bSectorZ > 0 || sSectorX < 1 || sSectorX >= MAP_WORLD_X - 1 || sSectorY < 1 || sSectorY >= MAP_WORLD_Y - 1 )
|
if ( bSectorZ > 0 || sSectorX < 1 || sSectorX >= MAP_WORLD_X - 1 || sSectorY < 1 || sSectorY >= MAP_WORLD_Y - 1 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
BOOLEAN fEnemies = (NumEnemiesInAnySector( sSectorX, sSectorY, bSectorZ ) > 0);
|
UINT16 usEnemies = (UINT16)NumEnemiesInAnySector( sSectorX, sSectorY, bSectorZ );
|
||||||
BOOLEAN fMilitia = (GetNumberOfMilitiaInSector( sSectorX, sSectorY, (INT16)bSectorZ ) > 0);
|
UINT16 usMilitia = (UINT16)GetNumberOfMilitiaInSector( sSectorX, sSectorY, (INT16)bSectorZ );
|
||||||
BOOLEAN fMercs = (PlayerMercsInSector( (UINT8)sSectorX, (UINT8)sSectorY, (UINT8)bSectorZ ) > 0);
|
UINT16 usMercs = (UINT16)PlayerMercsInSector( (UINT8)sSectorX, (UINT8)sSectorY, (UINT8)bSectorZ );
|
||||||
|
|
||||||
SECTORINFO *pSectorInfo = &(SectorInfo[SECTOR( sSectorX, sSectorY )]);
|
SECTORINFO *pSectorInfo = &(SectorInfo[SECTOR( sSectorX, sSectorY )]);
|
||||||
|
|
||||||
// sector must be free of members of an opposing team
|
// sector must be free of members of an opposing team
|
||||||
if ( bTeam == ENEMY_TEAM )
|
if ( bTeam == ENEMY_TEAM )
|
||||||
{
|
{
|
||||||
if ( !fEnemies || fMilitia || fMercs )
|
if ( !usEnemies || usMilitia || usMercs )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// there have to be enough guys here to fire at least one shot
|
||||||
|
if ( usEnemies < gSkillTraitValues.usVOMortarCountDivisor )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if ( (usEnemies * gSkillTraitValues.usVOMortarPointsAdmin) < (gSkillTraitValues.usVOMortarShellDivisor * (usEnemies / gSkillTraitValues.usVOMortarCountDivisor)) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// cannot fire if artillery was used recently
|
// cannot fire if artillery was used recently
|
||||||
@@ -22144,7 +22160,14 @@ BOOLEAN IsValidArtilleryOrderSector( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
|||||||
}
|
}
|
||||||
else if ( bTeam == MILITIA_TEAM )
|
else if ( bTeam == MILITIA_TEAM )
|
||||||
{
|
{
|
||||||
if ( fEnemies || !fMilitia )
|
if ( usEnemies || !usMilitia )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// there have to be enough guys here to fire at least one shot
|
||||||
|
if ( usMilitia < gSkillTraitValues.usVOMortarCountDivisor )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if ( (usMilitia * gSkillTraitValues.usVOMortarPointsAdmin) < (gSkillTraitValues.usVOMortarShellDivisor * (usMilitia / gSkillTraitValues.usVOMortarCountDivisor)) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// cannot fire if artillery was used recently
|
// cannot fire if artillery was used recently
|
||||||
@@ -22153,7 +22176,7 @@ BOOLEAN IsValidArtilleryOrderSector( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
|||||||
}
|
}
|
||||||
else if ( bTeam == OUR_TEAM )
|
else if ( bTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if ( fEnemies || !fMercs )
|
if ( usEnemies || !usMercs )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// we can relay orders only if someone in the sector has a working radio set and a mortar
|
// we can relay orders only if someone in the sector has a working radio set and a mortar
|
||||||
|
|||||||
Reference in New Issue
Block a user