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:
@@ -192,12 +192,14 @@ bool load_party_v1(fs::path file_to_load, cUniverse& real_univ, bool town_restor
|
|||||||
|
|
||||||
len = (long) sizeof(legacy::town_item_list);
|
len = (long) sizeof(legacy::town_item_list);
|
||||||
fin.read((char*)&t_i, len);
|
fin.read((char*)&t_i, len);
|
||||||
|
if(must_port) port_t_i(&t_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOAD STORED ITEMS
|
// LOAD STORED ITEMS
|
||||||
for(int i = 0; i < 3; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
len = (long) sizeof(legacy::stored_items_list_type);
|
len = (long) sizeof(legacy::stored_items_list_type);
|
||||||
fin.read((char*)&stored_items[i], len);
|
fin.read((char*)&stored_items[i], len);
|
||||||
|
if(must_port) port_stored_items_list(&stored_items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOAD SAVED MAPS
|
// LOAD SAVED MAPS
|
||||||
|
@@ -346,8 +346,10 @@ namespace legacy {
|
|||||||
town_record_type town;
|
town_record_type town;
|
||||||
int8_t explored[64][64];
|
int8_t explored[64][64];
|
||||||
Boolean hostile;
|
Boolean hostile;
|
||||||
|
pad_t pad1;
|
||||||
creature_list_type monst;
|
creature_list_type monst;
|
||||||
Boolean in_boat;
|
Boolean in_boat;
|
||||||
|
pad_t pad2;
|
||||||
location p_loc;
|
location p_loc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -68,6 +68,22 @@ void port_t_d(legacy::big_tr_type* old) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void port_t_i(legacy::town_item_list* old)
|
||||||
|
{
|
||||||
|
if(cur_scen_is_mac != mac_is_intel)
|
||||||
|
return;
|
||||||
|
for(short i = 0; i < 115; i++)
|
||||||
|
port_item_record(&(old->items[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
void port_stored_items_list(legacy::stored_items_list_type *old)
|
||||||
|
{
|
||||||
|
if(cur_scen_is_mac != mac_is_intel)
|
||||||
|
return;
|
||||||
|
for(short i = 0; i < 115; i++)
|
||||||
|
port_item_record(&(old->items[i]));
|
||||||
|
}
|
||||||
|
|
||||||
void port_ave_t(legacy::ave_tr_type* old) {
|
void port_ave_t(legacy::ave_tr_type* old) {
|
||||||
if(cur_scen_is_mac != mac_is_intel)
|
if(cur_scen_is_mac != mac_is_intel)
|
||||||
return;
|
return;
|
||||||
@@ -178,16 +194,21 @@ void port_scenario(legacy::scenario_data_type* temp_scenario) {
|
|||||||
flip_short(&temp_scenario->last_town_edited);
|
flip_short(&temp_scenario->last_town_edited);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void port_item_record(legacy::item_record_type *old) {
|
||||||
|
if(cur_scen_is_mac != mac_is_intel)
|
||||||
|
return;
|
||||||
|
|
||||||
|
flip_short(&(old->variety));
|
||||||
|
flip_short(&(old->item_level));
|
||||||
|
flip_short(&(old->value));
|
||||||
|
}
|
||||||
|
|
||||||
void port_item_list(legacy::scen_item_data_type* old){
|
void port_item_list(legacy::scen_item_data_type* old){
|
||||||
if(cur_scen_is_mac != mac_is_intel)
|
if(cur_scen_is_mac != mac_is_intel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(short i = 0; i < 400; i++) {
|
for(short i = 0; i < 400; i++)
|
||||||
flip_short(&(old->scen_items[i].variety));
|
port_item_record(&(old->scen_items[i]));
|
||||||
flip_short(&(old->scen_items[i].item_level));
|
|
||||||
flip_short(&(old->scen_items[i].value));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void port_out(legacy::outdoor_record_type *out) {
|
void port_out(legacy::outdoor_record_type *out) {
|
||||||
|
@@ -15,11 +15,14 @@ void flip_spec_node(legacy::special_node_type *spec);
|
|||||||
void flip_short(int16_t *s);
|
void flip_short(int16_t *s);
|
||||||
void flip_rect(legacy::Rect* s);
|
void flip_rect(legacy::Rect* s);
|
||||||
|
|
||||||
|
void port_t_i(legacy::town_item_list* old);
|
||||||
void port_t_d(legacy::big_tr_type* old);
|
void port_t_d(legacy::big_tr_type* old);
|
||||||
void port_ave_t(legacy::ave_tr_type* old);
|
void port_ave_t(legacy::ave_tr_type* old);
|
||||||
void port_tiny_t(legacy::tiny_tr_type* old);
|
void port_tiny_t(legacy::tiny_tr_type* old);
|
||||||
void port_scenario(legacy::scenario_data_type* old);
|
void port_scenario(legacy::scenario_data_type* old);
|
||||||
|
void port_item_record(legacy::item_record_type *old);
|
||||||
void port_item_list(legacy::scen_item_data_type* old);
|
void port_item_list(legacy::scen_item_data_type* old);
|
||||||
|
void port_stored_items_list(legacy::stored_items_list_type *old);
|
||||||
void port_out(legacy::outdoor_record_type* out);
|
void port_out(legacy::outdoor_record_type* out);
|
||||||
void port_talk_nodes(legacy::talking_record_type* dummy_talk_ptr);
|
void port_talk_nodes(legacy::talking_record_type* dummy_talk_ptr);
|
||||||
void port_town(legacy::town_record_type* dummy_town_ptr);
|
void port_town(legacy::town_record_type* dummy_town_ptr);
|
||||||
|
@@ -269,6 +269,10 @@ void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
|
|||||||
at_which_save_slot = old.at_which_save_slot;
|
at_which_save_slot = old.at_which_save_slot;
|
||||||
for(short i = 0; i < 20 ; i++)
|
for(short i = 0; i < 20 ; i++)
|
||||||
alchemy[i] = old.alchemy[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++){
|
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]->can_find = old.can_find_town[i];
|
||||||
univ.scenario.towns[i]->m_killed = old.m_killed[i];
|
univ.scenario.towns[i]->m_killed = old.m_killed[i];
|
||||||
|
@@ -67,8 +67,8 @@ void cCurTown::import_legacy(legacy::town_item_list& old){
|
|||||||
|
|
||||||
void cUniverse::import_legacy(legacy::stored_town_maps_type& old){
|
void cUniverse::import_legacy(legacy::stored_town_maps_type& old){
|
||||||
for(int n = 0; n < scenario.towns.size(); n++)
|
for(int n = 0; n < scenario.towns.size(); n++)
|
||||||
for(int i = 0; i < 64; i++)
|
for(size_t j = 0; j < scenario.towns[n]->maps.size(); j++)
|
||||||
for(int j = 0; j < 64; 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));
|
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);
|
getline(bin, cur);
|
||||||
sin.str(cur);
|
sin.str(cur);
|
||||||
sin >> cur;
|
sin >> cur;
|
||||||
if(cur == "TOWN")
|
if(cur == "TOWN") {
|
||||||
sin >> univ.party.town_num;
|
sin >> univ.party.town_num;
|
||||||
|
monst.which_town=univ.party.town_num; // OSNOLA, checkme: to fix the creature save
|
||||||
|
}
|
||||||
else if(cur == "DIFFICULTY")
|
else if(cur == "DIFFICULTY")
|
||||||
sin >> difficulty;
|
sin >> difficulty;
|
||||||
else if(cur == "HOSTILE")
|
else if(cur == "HOSTILE")
|
||||||
|
Reference in New Issue
Block a user