Ensure stored PCs don't reference a party
This commit is contained in:
@@ -3253,7 +3253,7 @@ void affect_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
|
|||||||
univ.party.stuff_done[spec.sd1][spec.sd2] = univ.party[pc_num].unique_id - 1000;
|
univ.party.stuff_done[spec.sd1][spec.sd2] = univ.party[pc_num].unique_id - 1000;
|
||||||
if(spec.ex1a == 1) break;
|
if(spec.ex1a == 1) break;
|
||||||
who->main_status += eMainStatus::SPLIT;
|
who->main_status += eMainStatus::SPLIT;
|
||||||
univ.stored_pcs[who->unique_id] = who;
|
univ.stored_pcs[who->unique_id] = who->leave_party();
|
||||||
univ.party.new_pc(pc_num);
|
univ.party.new_pc(pc_num);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -232,6 +232,7 @@ void cParty::new_pc(size_t spot) {
|
|||||||
|
|
||||||
void cParty::replace_pc(size_t spot, cPlayer* with) {
|
void cParty::replace_pc(size_t spot, cPlayer* with) {
|
||||||
if(spot < 6 && with != nullptr) {
|
if(spot < 6 && with != nullptr) {
|
||||||
|
with->join_party(*this);
|
||||||
delete adven[spot];
|
delete adven[spot];
|
||||||
adven[spot] = with;
|
adven[spot] = with;
|
||||||
}
|
}
|
||||||
|
@@ -111,6 +111,9 @@ public:
|
|||||||
short stat_adj(eSkill skill) const;
|
short stat_adj(eSkill skill) const;
|
||||||
eBuyStatus ok_to_buy(short cost,cItem item) const;
|
eBuyStatus ok_to_buy(short cost,cItem item) const;
|
||||||
|
|
||||||
|
void join_party(cParty& p) {party = &p;}
|
||||||
|
cPlayer* leave_party() {party = nullptr; return this;}
|
||||||
|
|
||||||
void append(legacy::pc_record_type old);
|
void append(legacy::pc_record_type old);
|
||||||
cPlayer(cParty& party);
|
cPlayer(cParty& party);
|
||||||
cPlayer(cParty& party,long key,short slot);
|
cPlayer(cParty& party,long key,short slot);
|
||||||
|
@@ -319,7 +319,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ){
|
|||||||
std::string fname = "save/pc~" + std::to_string(next_uid) + ".txt";
|
std::string fname = "save/pc~" + std::to_string(next_uid) + ".txt";
|
||||||
cPlayer* stored_pc = new cPlayer(univ.party);
|
cPlayer* stored_pc = new cPlayer(univ.party);
|
||||||
stored_pc->readFrom(partyIn.getFile(fname));
|
stored_pc->readFrom(partyIn.getFile(fname));
|
||||||
univ.stored_pcs[next_uid] = stored_pc;
|
univ.stored_pcs[next_uid] = stored_pc->leave_party();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user