Replace std::string Game::telesummary and Game::quicksummary by Summary

Game::telesummary and Game::quicksummary stored the summary string for
the save files - which is the <summary> tag that says something like
"Space Station, 10:30:59". The game only ever displays the quicksave
variant of these two, for "Last Save:" on the map menu's SAVE tab.
So the telesave has a <summary> too, but it's never displayed anywhere.
(In fact, the area is often set to "nowhere"...)

However, the summary strings have another function: detect that both
the telesave and quicksave exist. If a summary string for a save is
empty, then that save is considered not to exist.

I'm refactoring the summary string system, by making the new variables
Game::last_telesave and Game::last_quicksave of type struct
Game::Summary. This struct should have all data necessary to display
the summary string at runtime, and thus translate it at runtime (so
we don't store a summary in a certain language and then display it in
the wrong font later - the summary can always be in the current
language). It also has an `exists` member, to replace the need to
check for empty strings.

The <summary> tag is now completely unused, but is still written to
for older versions of the game to read.

(This commit does not add the new string to the language files, since
Terry now added it separately in his own branch)
This commit is contained in:
Dav999
2023-09-12 14:36:58 +02:00
committed by Misa Elizabeth Kai
parent 64bad7d67f
commit 0ea41e7913
4 changed files with 93 additions and 98 deletions

View File

@@ -294,7 +294,7 @@ public:
struct Summary
{
const char* summary;
bool exists;
int seconds;
int minutes;
int hours;
@@ -304,8 +304,11 @@ public:
bool crewstats[numcrew];
};
struct Summary last_telesave, last_quicksave;
bool save_exists(void);
void readmaingamesave(const char* savename, tinyxml2::XMLDocument& doc);
std::string writemaingamesave(tinyxml2::XMLDocument& doc);
struct Summary writemaingamesave(tinyxml2::XMLDocument& doc);
void initteleportermode(void);
@@ -504,9 +507,6 @@ public:
std::string activity_lastprompt;
bool activity_gettext;
std::string telesummary, quicksummary;
bool save_exists(void);
bool backgroundtext;
int activeactivity, act_fade;