diff --git a/src/classes/town.cpp b/src/classes/town.cpp index 72fdf83b..84d4d603 100644 --- a/src/classes/town.cpp +++ b/src/classes/town.cpp @@ -225,8 +225,8 @@ void cTown::set_up_lights() { where_lit[where.x][where.y] = true; } } - for(short i = 0; i < 8; i++) - for(short j = 0; j < 64; j++) + for(short i = 0; i < this->max_dim() / 8; i++) + for(short j = 0; j < this->max_dim(); j++) this->lighting(i,j) = 0; for(where.x = 0; where.x < this->max_dim(); where.x++) for(where.y = 0; where.y < this->max_dim(); where.y++) { diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index d465e75e..7f7a413f 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -197,7 +197,6 @@ void handle_menu_choice(eMenu item_hit) { } break; case eMenu::FILE_SAVE: - town->set_up_lights(); save_scenario(scenario.scen_file); break; case eMenu::FILE_NEW: diff --git a/src/tools/fileio_scen.cpp b/src/tools/fileio_scen.cpp index 46b807fe..6861d492 100644 --- a/src/tools/fileio_scen.cpp +++ b/src/tools/fileio_scen.cpp @@ -398,6 +398,9 @@ bool load_town_v1(fs::path scen_file, short which_town, cTown& the_town, legacy: // Do this after strings are loaded because porting shops requires access to strings the_town.talking.append(store_talk, shops); + // And lastly, calculate lighting + the_town.set_up_lights(); + n = fclose(file_id); if(n != 0) { oopsError(18, 0, 0);