save[legacy]: try to solve many problem

+ force monst.which_town to be set ( to fix a problem when saving context)
This commit is contained in:
ALONSO Laurent
2021-09-20 11:54:38 +02:00
committed by Celtic Minstrel
parent a1e0158c56
commit afda3a09f5
6 changed files with 42 additions and 8 deletions

View File

@@ -269,6 +269,10 @@ void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
at_which_save_slot = old.at_which_save_slot;
for(short i = 0; i < 20 ; i++)
alchemy[i] = old.alchemy[i];
for (short i=0; i<50; i++) {
if (old.spec_items[i]>0)
spec_items.insert(i);
}
for(short i = 0; i < univ.scenario.towns.size(); i++){
univ.scenario.towns[i]->can_find = old.can_find_town[i];
univ.scenario.towns[i]->m_killed = old.m_killed[i];

View File

@@ -67,8 +67,8 @@ void cCurTown::import_legacy(legacy::town_item_list& old){
void cUniverse::import_legacy(legacy::stored_town_maps_type& old){
for(int n = 0; n < scenario.towns.size(); n++)
for(int i = 0; i < 64; i++)
for(int j = 0; j < 64; j++)
for(size_t j = 0; j < scenario.towns[n]->maps.size(); j++)
for(int i = 0; i < scenario.towns[n]->maps[j].size(); i++)
scenario.towns[n]->maps[j][i] = old.town_maps[n][i / 8][j] & (1 << (i % 8));
}
@@ -834,8 +834,10 @@ void cCurTown::readFrom(std::istream& file){
getline(bin, cur);
sin.str(cur);
sin >> cur;
if(cur == "TOWN")
if(cur == "TOWN") {
sin >> univ.party.town_num;
monst.which_town=univ.party.town_num; // OSNOLA, checkme: to fix the creature save
}
else if(cur == "DIFFICULTY")
sin >> difficulty;
else if(cur == "HOSTILE")