From 7aee4abe81979cfb0d3e8632da6652e008153399 Mon Sep 17 00:00:00 2001 From: "Laurent Alonso(fr)" Date: Thu, 7 May 2020 11:41:46 +0200 Subject: [PATCH] talk_note: try to save/reread them correctly... --- src/game/boe.dlgutil.cpp | 2 +- src/universe/party.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index cb87c10b..c2b95f8f 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -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."); diff --git a/src/universe/party.cpp b/src/universe/party.cpp index f77ef98c..b91d3f08 100644 --- a/src/universe/party.cpp +++ b/src/universe/party.cpp @@ -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;