From abe8287616d866b03024d45d8e5897527fb016b9 Mon Sep 17 00:00:00 2001 From: "Laurent Alonso(fr)" Date: Tue, 26 May 2020 20:05:00 +0200 Subject: [PATCH] special[legacy]: make_town_hostile has only one meaning... set_town_attitude: lo=-1,hi=-1 seems to mean all monsters at least in special... --- src/game/boe.items.cpp | 29 ++++++++++++++++++----------- src/scenario/special.cpp | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/game/boe.items.cpp b/src/game/boe.items.cpp index 3c9a48f2..ba8ff99a 100644 --- a/src/game/boe.items.cpp +++ b/src/game/boe.items.cpp @@ -312,17 +312,24 @@ void set_town_attitude(short lo,short hi,eAttitude att) { univ.town.monst.hostile = true; long long num_monst = univ.town.monst.size(); - // Nice smart indexing, like Python :D - if(lo <= -num_monst) - lo = 0; - if(lo < 0) - lo = num_monst + lo; - if(hi <= -num_monst) - hi = 0; - if(hi < 0) - hi = num_monst + hi; - if(hi < lo) - std::swap(lo, hi); + if (lo==-1 && hi==-1) { + // All monsters + lo=0; + hi=num_monst-1; + } + else { + // Nice smart indexing, like Python :D + if(lo <= -num_monst) + lo = 0; + if(lo < 0) + lo = num_monst + lo; + if(hi <= -num_monst) + hi = 0; + if(hi < 0) + hi = num_monst + hi; + if(hi < lo) + std::swap(lo, hi); + } for(short i = lo; i <= hi; i++) { if(univ.town.monst[i].active > 0 && univ.town.monst[i].summon_time == 0){ diff --git a/src/scenario/special.cpp b/src/scenario/special.cpp index 0a493181..772a7199 100644 --- a/src/scenario/special.cpp +++ b/src/scenario/special.cpp @@ -131,7 +131,7 @@ void cSpecial::import_legacy(legacy::special_node_type& old){ // 154 was if text response case 155: type = eSpecType::IF_SDF_EQ; break; // 156-169 were undefined - case 170: type = eSpecType::MAKE_TOWN_HOSTILE; break; + case 170: type = eSpecType::MAKE_TOWN_HOSTILE; ex2a=1; break; // OSNOLA: make town always hostile // 171-173 were change/swap/transform terrain case 174: type = eSpecType::TOWN_MOVE_PARTY; break; case 175: type = eSpecType::TOWN_HIT_SPACE; break;