talk_note: try to save/reread them correctly...

This commit is contained in:
Laurent Alonso(fr)
2020-05-07 11:41:46 +02:00
committed by Celtic Minstrel
parent 32672d2dc8
commit 7aee4abe81
2 changed files with 8 additions and 4 deletions

View File

@@ -740,7 +740,7 @@ void handle_talk_event(location p) {
beep();
return;
}
if(univ.party.save_talk(univ.town->talking.people[store_personality].title, univ.town->name, save_talk_str1, save_talk_str2)) {
if(univ.party.save_talk(univ.town->talking.people[store_personality%10].title, univ.town->name, save_talk_str1, save_talk_str2)) {
give_help(57,0);
play_sound(0);
ASB("Noted in journal.");

View File

@@ -836,7 +836,7 @@ void cParty::writeTo(std::ostream& file) const {
if(talk_save.size() > 0) {
file << '\f';
for(const cConvers& note : talk_save) {
file << "TALKNOTE";
file << "TALKNOTE\n";
file << "WHO " << maybe_quote_string(note.who_said) << '\n';
file << "WHERE " << maybe_quote_string(note.in_town) << ' ' << maybe_quote_string(note.in_scen) << '\n';
file << "-\n" << note.the_str1 << '\n' << note.the_str2 << '\n';
@@ -1061,12 +1061,14 @@ void cParty::readFrom(std::istream& file){
entry.in_scen = read_maybe_quoted_string(bin);
bin >> std::ws;
getline(bin, entry.the_str);
journal.push_back(entry);
} else if(cur == "ENCNOTE") {
cEncNote note;
bin >> note.type;
note.where = read_maybe_quoted_string(bin);
bin >> std::ws;
getline(bin, note.the_str);
special_notes.push_back(note);
} else if(cur == "TALKNOTE") {
cConvers note;
while(bin) {
@@ -1074,15 +1076,17 @@ void cParty::readFrom(std::istream& file){
std::istringstream sin(cur);
sin >> cur;
if(cur == "WHO")
note.who_said = read_maybe_quoted_string(bin);
note.who_said = read_maybe_quoted_string(sin);
else if(cur == "WHERE") {
note.in_town = read_maybe_quoted_string(bin);
note.in_town = read_maybe_quoted_string(sin);
note.in_scen = read_maybe_quoted_string(sin);
} else if(cur == "-") break;
}
bin >> std::ws;
getline(bin, note.the_str1);
getline(bin, note.the_str2);
note.filled=true;
talk_save.push_back(note);
} else if(cur == "JOB_BANK") {
int i;
bin >> i;