Set a custom dialog caption for the synced debug command prompt
This replaces the caption with something more apropos than the generic "Save Game" caption. It necessitates a minor API change though.
This commit is contained in:
parent
6a91de417a
commit
c3a6300bce
3 changed files with 8 additions and 3 deletions
|
@ -326,8 +326,8 @@ void loadgame::copy_era(config &cfg)
|
|||
|
||||
savegame::savegame(saved_game& gamestate, const compression::format compress_saves, const std::string& title)
|
||||
: filename_()
|
||||
, gamestate_(gamestate)
|
||||
, title_(title)
|
||||
, gamestate_(gamestate)
|
||||
, error_message_(_("The game could not be saved: "))
|
||||
, show_confirmation_(false)
|
||||
, compress_saves_(compress_saves)
|
||||
|
|
|
@ -204,6 +204,9 @@ protected:
|
|||
/** Filename of the savegame file on disk */
|
||||
std::string filename_;
|
||||
|
||||
/** Title of the savegame dialog */
|
||||
std::string title_;
|
||||
|
||||
private:
|
||||
/** Checks if a certain character is allowed in a savefile name. */
|
||||
static bool is_illegal_file_char(char c);
|
||||
|
@ -227,8 +230,6 @@ private:
|
|||
//before_save (write replay data) changes this so it cannot be const
|
||||
saved_game& gamestate_;
|
||||
|
||||
const std::string title_; /** Title of the savegame dialog */
|
||||
|
||||
std::string error_message_; /** Error message to be displayed if the savefile could not be generated. */
|
||||
|
||||
bool show_confirmation_; /** Determines if a confirmation of successful saving the game is shown. */
|
||||
|
@ -281,6 +282,9 @@ class oos_savegame : public ingame_savegame
|
|||
public:
|
||||
oos_savegame(saved_game& gamestate, bool& ignore);
|
||||
|
||||
/** Customize the dialog's caption. */
|
||||
void set_title(const std::string& val) { title_ = val; }
|
||||
|
||||
private:
|
||||
/** Display the save game dialog. */
|
||||
virtual int show_save_dialog(const std::string& message, DIALOG_TYPE dialog_type) override;
|
||||
|
|
|
@ -402,6 +402,7 @@ namespace
|
|||
sbuilder << "The game detected the use of a debug command, maybe another player is cheating";
|
||||
sbuilder << "\n\n" << "details:" << "\n\n" << VGETTEXT(message, {{"player", current_team.current_player()}});
|
||||
savegame::oos_savegame save(controller.get_saved_game(), ignore);
|
||||
save.set_title("Debug Command Used");
|
||||
save.save_game_interactive(sbuilder.str(), savegame::savegame::YES_NO); // can throw quit_game_exception
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Reference in a new issue