- Fix attempt at accessing invalid placed town locations
- Fix attempt at accessing invalid terrain in editor when checking whether to apply transformations
This commit is contained in:
2015-06-20 12:43:16 -04:00
parent c2970295d6
commit 3239d8e503
3 changed files with 3 additions and 2 deletions

View File

@@ -1306,7 +1306,7 @@ void erase_out_specials() {
if(quadrant_legal(i,j)) {
cOutdoors& sector = *univ.scenario.outdoors[univ.party.outdoor_corner.x + i][univ.party.outdoor_corner.y + j];
for(short k = 0; k < sector.city_locs.size(); k++) {
if(sector.city_locs[k].spec >= 0 &&
if(sector.city_locs[k].spec >= 0 && sector.city_locs[k].x < 48 &&
univ.scenario.ter_types[sector.terrain[sector.city_locs[k].x][sector.city_locs[k].y]].special == eTerSpec::TOWN_ENTRANCE &&
(sector.city_locs[k].x == minmax(0,47,sector.city_locs[k].x)) &&
(sector.city_locs[k].y == minmax(0,47,sector.city_locs[k].y))) {

View File

@@ -749,7 +749,7 @@ int uAbility::get_ap_cost(eMonstAbil key) const {
case eMonstAbil::NO_ABIL:
return -256;
}
// return -256;
return -256;
}
void cMonster::writeTo(std::ostream& file) const {

View File

@@ -1992,6 +1992,7 @@ void set_terrain(location l,ter_num_t terrain_type) {
unsigned int ground_there = scenario.ter_types[ter_there].ground_type;
if(ground_there != main_ground && ground_there != trim_ground) {
ter_num_t new_ter = scenario.get_ter_from_ground(trim_ground);
if(new_ter > scenario.ter_types.size()) continue;
cTerrain& ter_type = scenario.ter_types[new_ter];
// We need to be very cautious here.
// Only make the change if the terrain already there is the archetype for the ground type