journal: try to delete correctly the talking notes
This commit is contained in:
@@ -523,7 +523,7 @@ void adventure_notes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void put_talk(cDialog& me) {
|
static void put_talk(cDialog& me) {
|
||||||
if(univ.party.talk_save[store_page_on].filled) {
|
if(store_page_on<store_num_i) {
|
||||||
me["loc"].setText(univ.party.talk_save[store_page_on].in_town);
|
me["loc"].setText(univ.party.talk_save[store_page_on].in_town);
|
||||||
me["who"].setText(univ.party.talk_save[store_page_on].who_said);
|
me["who"].setText(univ.party.talk_save[store_page_on].who_said);
|
||||||
me["str1"].setText(univ.party.talk_save[store_page_on].the_str1);
|
me["str1"].setText(univ.party.talk_save[store_page_on].the_str1);
|
||||||
@@ -542,18 +542,18 @@ static bool talk_notes_event_filter(cDialog& me, std::string item_hit, eKeyMod)
|
|||||||
store_page_on = 0;
|
store_page_on = 0;
|
||||||
else store_page_on++;
|
else store_page_on++;
|
||||||
} else if(item_hit == "del") {
|
} else if(item_hit == "del") {
|
||||||
// TODO: Actually remove it rather than filled to false
|
univ.party.talk_save.erase(univ.party.talk_save.begin()+store_page_on);
|
||||||
univ.party.talk_save[store_page_on].filled = false;
|
if(store_page_on == store_num_i - 1)
|
||||||
|
store_page_on = 0;
|
||||||
|
if(--store_num_i==0) me.toast(true);
|
||||||
|
// TODO: if store_num_i==1, we must also hide the right/left buttons
|
||||||
}
|
}
|
||||||
put_talk(me);
|
put_talk(me);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void talk_notes() {
|
void talk_notes() {
|
||||||
store_num_i = 0;
|
store_num_i = univ.party.talk_save.size();
|
||||||
for(size_t i = 0; i < univ.party.talk_save.size(); i++)
|
|
||||||
if(univ.party.talk_save[i].filled)
|
|
||||||
store_num_i = i + 1;
|
|
||||||
store_page_on = 0;
|
store_page_on = 0;
|
||||||
if(store_num_i == 0) {
|
if(store_num_i == 0) {
|
||||||
ASB("Nothing in your talk journal.");
|
ASB("Nothing in your talk journal.");
|
||||||
|
@@ -385,7 +385,6 @@ void cParty::swap_pcs(size_t a, size_t b) {
|
|||||||
bool cParty::save_talk(const std::string& who, const std::string& where, const std::string& str1, const std::string& str2){
|
bool cParty::save_talk(const std::string& who, const std::string& where, const std::string& str1, const std::string& str2){
|
||||||
if(talk_save.size() == talk_save.max_size()) return false; // This is extremely unlikely
|
if(talk_save.size() == talk_save.max_size()) return false; // This is extremely unlikely
|
||||||
cConvers talk;
|
cConvers talk;
|
||||||
talk.filled = true; // TODO: Remove this member
|
|
||||||
talk.who_said = who;
|
talk.who_said = who;
|
||||||
talk.in_town = where;
|
talk.in_town = where;
|
||||||
talk.the_str1 = str1;
|
talk.the_str1 = str1;
|
||||||
@@ -1051,7 +1050,6 @@ void cParty::readFrom(const cTagFile& file) {
|
|||||||
page["WHERE"] >> note.in_town >> note.in_scen;
|
page["WHERE"] >> note.in_town >> note.in_scen;
|
||||||
page["STRING"] >> note.the_str1;
|
page["STRING"] >> note.the_str1;
|
||||||
page["STRING"] >> note.the_str2;
|
page["STRING"] >> note.the_str2;
|
||||||
note.filled = true;
|
|
||||||
talk_save.push_back(note);
|
talk_save.push_back(note);
|
||||||
} else if(page.getFirstKey() == "JOBBANK") {
|
} else if(page.getFirstKey() == "JOBBANK") {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@@ -65,7 +65,6 @@ class cParty : public iLiving {
|
|||||||
public:
|
public:
|
||||||
class cConvers { // conversation; formerly talk_save_type
|
class cConvers { // conversation; formerly talk_save_type
|
||||||
public:
|
public:
|
||||||
bool filled = false;
|
|
||||||
std::string who_said, in_town, the_str1, the_str2, in_scen;
|
std::string who_said, in_town, the_str1, the_str2, in_scen;
|
||||||
|
|
||||||
void import_legacy(legacy::talk_save_type old, const cScenario& scenario);
|
void import_legacy(legacy::talk_save_type old, const cScenario& scenario);
|
||||||
|
Reference in New Issue
Block a user