Fix several issues when loading legacy saves
This commit is contained in:
@@ -192,6 +192,7 @@ void cParty::swap(cParty& other) {
|
||||
}
|
||||
|
||||
void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
|
||||
scen_name = old.scen_name;
|
||||
age = old.age;
|
||||
gold = old.gold;
|
||||
food = old.food;
|
||||
@@ -220,6 +221,8 @@ void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
|
||||
left_in = -1;
|
||||
}
|
||||
party_event_timers.reserve(30);
|
||||
boats.resize(30);
|
||||
horses.resize(30);
|
||||
for(short i = 0; i < 30; i++){
|
||||
boats[i].import_legacy(old.boats[i]);
|
||||
horses[i].import_legacy(old.horses[i]);
|
||||
@@ -274,7 +277,6 @@ void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
|
||||
total_dam_done = old.total_dam_done;
|
||||
total_xp_gained = old.total_xp_gained;
|
||||
total_dam_taken = old.total_dam_taken;
|
||||
scen_name = old.scen_name;
|
||||
}
|
||||
|
||||
void cParty::import_legacy(legacy::stored_items_list_type& old,short which_list){
|
||||
|
||||
@@ -63,7 +63,7 @@ void cCurTown::import_legacy(legacy::town_item_list& old){
|
||||
}
|
||||
|
||||
void cUniverse::import_legacy(legacy::stored_town_maps_type& old){
|
||||
for(int n = 0; n < 200; n++)
|
||||
for(int n = 0; n < scenario.towns.size(); n++)
|
||||
for(int i = 0; i < 64; i++)
|
||||
for(int j = 0; j < 64; j++)
|
||||
scenario.towns[n]->maps[j][i] = old.town_maps[n][i / 8][j] & (1 << (i % 8));
|
||||
|
||||
@@ -223,7 +223,7 @@ bool load_party_v1(fs::path file_to_load, cUniverse& real_univ, bool town_restor
|
||||
|
||||
if(in_scen){
|
||||
fs::path path;
|
||||
path = progDir/"Blades of Exile Scenarios"/univ.party.scen_name;
|
||||
path = progDir/"Blades of Exile Scenarios"/store_party.scen_name;
|
||||
|
||||
if(!load_scenario(path, univ.scenario))
|
||||
return false;
|
||||
@@ -247,18 +247,18 @@ bool load_party_v1(fs::path file_to_load, cUniverse& real_univ, bool town_restor
|
||||
univ.import_legacy(town_maps);
|
||||
univ.import_legacy(o_maps);
|
||||
univ.town.import_legacy(sfx, misc_i);
|
||||
if(!town_restore) univ.party.town_num = 200;
|
||||
// Check items in crates/barrels
|
||||
for(int i = 0; i < univ.town->max_dim(); i++) {
|
||||
for(int j = 0; j < univ.town->max_dim(); j++) {
|
||||
if(univ.town.is_barrel(i,j) || univ.town.is_crate(i,j)) {
|
||||
for(cItem item : univ.town.items) {
|
||||
if(item.item_loc == loc(i,j) && item.contained)
|
||||
item.held = true;
|
||||
if(town_restore) // Check items in crates/barrels
|
||||
for(int i = 0; i < univ.town->max_dim(); i++) {
|
||||
for(int j = 0; j < univ.town->max_dim(); j++) {
|
||||
if(univ.town.is_barrel(i,j) || univ.town.is_crate(i,j)) {
|
||||
for(cItem item : univ.town.items) {
|
||||
if(item.item_loc == loc(i,j) && item.contained)
|
||||
item.held = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else univ.party.town_num = 200;
|
||||
}
|
||||
|
||||
real_univ = std::move(univ);
|
||||
|
||||
Reference in New Issue
Block a user