Fix issue with calculating town lighting, and do it on load instead of save since the new format doesn't store it

This commit is contained in:
2015-02-05 22:19:47 -05:00
parent 089fa1a32b
commit 7d67c0c85b
3 changed files with 5 additions and 3 deletions

View File

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

View File

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

View File

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