special.cpp: retrieve correctly allow/deny enter in legacy scenario,

universe.cpp: correct a memory problem...
This commit is contained in:
Laurent alonso
2020-10-30 14:30:14 +01:00
committed by Celtic Minstrel
parent 303674da10
commit 1bf43ee01e
2 changed files with 5 additions and 1 deletions

View File

@@ -316,7 +316,7 @@ void cSpecial::import_legacy(legacy::special_node_type& old){
break; break;
case 11: // Can't enter case 11: // Can't enter
type = eSpecType::CANT_ENTER; type = eSpecType::CANT_ENTER;
ex1a = 1; ex1a = ex1a==0 ? 0 : 1;
ex2a = 0; ex2a = 0;
break; break;
case 26: // Wandering will fight case 26: // Wandering will fight

View File

@@ -901,6 +901,10 @@ bool cCurOut::is_road(int x, int y) {
if(y >= 48) sector_y++, y -= 48; if(y >= 48) sector_y++, y -= 48;
sector_x += univ.party.outdoor_corner.x; sector_x += univ.party.outdoor_corner.x;
sector_y += univ.party.outdoor_corner.y; sector_y += univ.party.outdoor_corner.y;
// ASAN can happens if a hole allows to goes out the scenario...
if (sector_x<0 || sector_x>=univ.scenario.outdoors.width() ||
sector_y<0 || sector_y>=univ.scenario.outdoors.height())
return false;
return univ.scenario.outdoors[sector_x][sector_y]->roads[x][y]; return univ.scenario.outdoors[sector_x][sector_y]->roads[x][y];
} }