- 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

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