From 671b4527ac9638f772725baf4a5a0898bd51d61d Mon Sep 17 00:00:00 2001 From: silversurfer Date: Fri, 27 May 2016 07:52:32 +0000 Subject: [PATCH] Fixes (by Sevenfm): - Armor search routine had incorrect calculations - Tiles adjacent to buildings could be assigned to a building git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8239 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 18 ++++++++-------- TacticalAI/FindLocations.cpp | 42 ++++++++---------------------------- TileEngine/Buildings.cpp | 3 ++- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 7877dcdcd..13f17a0a6 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -15,9 +15,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8239 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8239 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8239 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8239 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8239 (Development Build)" }; #endif #elif defined CRIPPLED_VERSION @@ -46,16 +46,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8239 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8239 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.8212 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.8239 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 16.05.15" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 16.05.27" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index b20866724..b0f845008 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1981,9 +1981,6 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) } else if (pItem->usItemClass == IC_ARMOUR && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { - INT32 effectivearmour_obj = EffectiveArmour( pObj ); - INT32 effectivearmour_currentpos = 0; - iTempValue = 0; switch( Armour[pItem->ubClassIndex].ubArmourClass ) @@ -1991,56 +1988,35 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) case ARMOURCLASS_HELMET: if (pSoldier->inv[HELMETPOS].exists() == false) { - iTempValue = 200 + effectivearmour_obj; + iTempValue = 200 + EffectiveArmour( pObj ); } - else + else if ( EffectiveArmour( &(pSoldier->inv[HELMETPOS]) ) < EffectiveArmour( pObj ) ) { - effectivearmour_currentpos = EffectiveArmour( &(pSoldier->inv[HELMETPOS]) ); - - if ( effectivearmour_currentpos > 0 && effectivearmour_currentpos > effectivearmour_obj ) - { - iTempValue = 100 * effectivearmour_obj / effectivearmour_currentpos; - } + iTempValue = 100 * EffectiveArmour( pObj ) / EffectiveArmour( &(pSoldier->inv[HELMETPOS]) ); } break; case ARMOURCLASS_VEST: if (pSoldier->inv[VESTPOS].exists() == false) { - iTempValue = 200 + effectivearmour_obj; + iTempValue = 200 + EffectiveArmour( pObj ); } - else + else if ( EffectiveArmour( &(pSoldier->inv[VESTPOS]) ) < EffectiveArmour( pObj ) ) { - effectivearmour_currentpos = EffectiveArmour( &(pSoldier->inv[VESTPOS]) ); - - if ( effectivearmour_currentpos > 0 && effectivearmour_currentpos > effectivearmour_obj ) - { - iTempValue = 100 * effectivearmour_obj / effectivearmour_currentpos; - } + iTempValue = 100 * EffectiveArmour( pObj ) / EffectiveArmour( &(pSoldier->inv[VESTPOS]) ); } break; case ARMOURCLASS_LEGGINGS: if (pSoldier->inv[LEGPOS].exists() == false) { - iTempValue = 200 + effectivearmour_obj; + iTempValue = 200 + EffectiveArmour( pObj ); } - else + else if ( EffectiveArmour( &(pSoldier->inv[LEGPOS]) ) < EffectiveArmour( pObj ) ) { - effectivearmour_currentpos = EffectiveArmour( &(pSoldier->inv[LEGPOS]) ); - - if ( effectivearmour_currentpos > 0 && effectivearmour_currentpos > effectivearmour_obj ) - { - iTempValue = 100 * effectivearmour_obj / effectivearmour_currentpos; - } + iTempValue = 100 * EffectiveArmour( pObj ) / EffectiveArmour( &(pSoldier->inv[LEGPOS]) ); } break; default: - // WANNE: Fix a vanilla bug: When an enemy soldier is looking for items and finds a non-helmet/vest/leggings piece of armour it was incorrectly considered for pickup. - // Fixed by Tron (Stracciatella): Revision: 5719 - // break; - // continue; <- silversurfer: bad idea, this causes the game to hang - // to make sure that the item isn't considered set iTempValue to zero and get out { - iTempValue = 0; break; } } diff --git a/TileEngine/Buildings.cpp b/TileEngine/Buildings.cpp index 075f67976..f54509c88 100644 --- a/TileEngine/Buildings.cpp +++ b/TileEngine/Buildings.cpp @@ -432,7 +432,8 @@ BUILDING * GenerateBuilding( INT32 sDesiredSpot ) { gpWorldLevelData[ sCurrGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_ROOFCODE_VISITED; - gubBuildingInfo[ sCurrGridNo ] = ubBuildingID; + if( InARoom(sCurrGridNo, NULL) ) + gubBuildingInfo[ sCurrGridNo ] = ubBuildingID; // consider this location as possible climb gridno // there must be a regular wall adjacent to this for us to consider it a