From 5826dd63a6099f073efa9ae0815d81bcdfce5507 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 12 Feb 2015 18:53:23 +0000 Subject: [PATCH] Female admins and troops can appear in autoresolve. Requires GameDir >= r2206. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7730 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Auto Resolve.cpp | 20 +++++++++++++++++-- Tactical/Soldier Create.cpp | 39 ++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 16505ca6..c70c3a5d 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -284,6 +284,8 @@ enum HUMAN_SKULL, TANK_WRECK, CREATURE_SKULL, + ADMINF_FACE, + TROOPF_FACE, ELITEF_FACE, MILITIA1F_FACE, MILITIA2F_FACE, @@ -2520,7 +2522,14 @@ void CreateAutoResolveInterface() { gpEnemies[index].pSoldier = TacticalCreateArmyTroop(); gpEnemies[index].uiVObjectID = gpAR->iFaces; - gpEnemies[index].usIndex = TROOP_FACE; + if ( gpEnemies[i].pSoldier->ubBodyType == REGFEMALE ) + { + gpEnemies[index].usIndex = TROOPF_FACE; + } + else + { + gpEnemies[index].usIndex = TROOP_FACE; + } gpEnemies[index].pSoldier->sSectorX = gpAR->ubSectorX; gpEnemies[index].pSoldier->sSectorY = gpAR->ubSectorY; swprintf( gpEnemies[index].pSoldier->name, gpStrategicString[ STR_AR_TROOP_NAME ] ); @@ -2529,7 +2538,14 @@ void CreateAutoResolveInterface() { gpEnemies[index].pSoldier = TacticalCreateAdministrator(); gpEnemies[index].uiVObjectID = gpAR->iFaces; - gpEnemies[index].usIndex = ADMIN_FACE; + if ( gpEnemies[i].pSoldier->ubBodyType == REGFEMALE ) + { + gpEnemies[index].usIndex = ADMINF_FACE; + } + else + { + gpEnemies[index].usIndex = ADMIN_FACE; + } gpEnemies[index].pSoldier->sSectorX = gpAR->ubSectorX; gpEnemies[index].pSoldier->sSectorY = gpAR->ubSectorY; swprintf( gpEnemies[index].pSoldier->name, gpStrategicString[ STR_AR_ADMINISTRATOR_NAME ] ); diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 6a0c17e4..a4c9272b 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -1711,35 +1711,30 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT pSoldier->ubSoldierClass = pCreateStruct->ubSoldierClass; // Flugente: soldier profiles - if ( 1 ) + // silversurfer: Don't replace tanks! + if ( pCreateStruct->bBodyType != TANK_NE && pCreateStruct->bBodyType != TANK_NW ) { - INT8 type = -1; + // We have a function for this + INT8 type = pSoldier->GetSoldierProfileType( pCreateStruct->bTeam ); - // silversurfer: Don't replace tanks! - if ( pCreateStruct->bBodyType != TANK_NE && pCreateStruct->bBodyType != TANK_NW ) + if ( type > -1 ) { - // We have a function for this - type = pSoldier->GetSoldierProfileType( pCreateStruct->bTeam ); + INT16 availablenames[NUM_SOLDIER_PROFILES]; + UINT16 cnt = 0; - if ( type > -1 ) + for (UINT16 i = 1; i < num_found_soldier_profiles[type]; ++i) { - INT16 availablenames[NUM_SOLDIER_PROFILES]; - UINT16 cnt = 0; + // make sure the name isn't already currently in use! + if ( !IsProfileInUse(pCreateStruct->bTeam, type, i) ) + availablenames[cnt++] = i; + } - for (UINT16 i = 1; i < num_found_soldier_profiles[type]; ++i) - { - // make sure the name isn't already currently in use! - if ( !IsProfileInUse(pCreateStruct->bTeam, type, i) ) - availablenames[cnt++] = i; - } - - if ( cnt > 0 ) - { - pSoldier->usSoldierProfile = availablenames[Random(cnt)]; + if ( cnt > 0 ) + { + pSoldier->usSoldierProfile = availablenames[Random(cnt)]; - if ( zSoldierProfile[type][pSoldier->usSoldierProfile].uiBodyType > 0 && zSoldierProfile[type][pSoldier->usSoldierProfile].uiBodyType < 5 ) - pSoldier->ubBodyType = zSoldierProfile[type][pSoldier->usSoldierProfile].uiBodyType - 1; - } + if ( zSoldierProfile[type][pSoldier->usSoldierProfile].uiBodyType > 0 && zSoldierProfile[type][pSoldier->usSoldierProfile].uiBodyType < 5 ) + pSoldier->ubBodyType = zSoldierProfile[type][pSoldier->usSoldierProfile].uiBodyType - 1; } } }