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...
This commit is contained in:
Laurent Alonso(fr)
2020-05-26 20:05:00 +02:00
committed by Celtic Minstrel
parent 4881471f20
commit abe8287616
2 changed files with 19 additions and 12 deletions

View File

@@ -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){

View File

@@ -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;