From 9e058edf5e267da832fd6cb4949c6674aec62ad1 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 11 Oct 2012 19:17:13 +0000 Subject: [PATCH] Fix: it was still possible to resolve random items in the map editor git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5625 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Inventory Choosing.cpp | 2 +- Tactical/Item Types.cpp | 3 --- Tactical/Items.cpp | 16 +++++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index ec54f1f7..01bc9c2a 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -1042,7 +1042,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC if ( GetItemFromRandomItem(usGunIndex, &newitemfromrandom) ) usGunIndex = newitemfromrandom; - // if item is still radnom, use default gun -> GLOCK 17 + // if item is still random, use default gun -> GLOCK 17 if ( Item[usGunIndex].randomitem > 0 ) usGunIndex = GLOCK_17; diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 4400af8e..189cd23d 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -1332,9 +1332,6 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) if ( GetItemFromRandomItem(src.usItem, &newitemfromrandom) ) this->usItem = newitemfromrandom; - if ( Item[this->usItem].randomitem > 0 ) - this->usItem = NONE; - //and now the big change, the union //copy the old data, making sure not to write over, since the old size is actually 9 bytes if (ubNumberOfObjects == 1) { diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 643a8d42..5664f29e 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -7661,13 +7661,10 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) return( FALSE ); } - // Flugente: random items - not while editing! - if ( guiCurrentScreen != EDIT_SCREEN ) - { - UINT16 newitemfromrandom = 0; - if ( GetItemFromRandomItem(usItem, &newitemfromrandom) ) - usItem = newitemfromrandom; - } + // Flugente: random items + UINT16 newitemfromrandom = 0; + if ( GetItemFromRandomItem(usItem, &newitemfromrandom) ) + usItem = newitemfromrandom; if (usItem == 0) { @@ -14762,6 +14759,11 @@ BOOLEAN GetItemFromRandomItem( UINT16 usRandomItem, UINT16* pusNewItem ) { *pusNewItem = 0; + // no random item solving in the map editor +#ifdef JA2EDITOR + return FALSE; +#endif + // is this a random item? if ( Item[usRandomItem].randomitem > 0 ) {