show the oos savegame dialog when receiving a debug command in mp
with a different text of course. fixes #2683
This commit is contained in:
parent
da2081de77
commit
7621af926b
2 changed files with 22 additions and 6 deletions
|
@ -365,7 +365,6 @@ public:
|
|||
|
||||
void show_objectives() const;
|
||||
|
||||
protected:
|
||||
struct scoped_savegame_snapshot
|
||||
{
|
||||
scoped_savegame_snapshot(const play_controller& controller);
|
||||
|
@ -374,6 +373,9 @@ protected:
|
|||
const play_controller& controller_;
|
||||
};
|
||||
|
||||
saved_game& get_saved_game() { return saved_game_; }
|
||||
|
||||
protected:
|
||||
friend struct scoped_savegame_snapshot;
|
||||
|
||||
void play_slice_catch();
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "units/helper.hpp"
|
||||
#include "recall_list_manager.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "savegame.hpp"
|
||||
#include "scripting/game_lua_kernel.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "units/types.hpp"
|
||||
|
@ -389,11 +390,24 @@ namespace
|
|||
{
|
||||
void debug_notification(const char* message)
|
||||
{
|
||||
utils::string_map symbols;
|
||||
symbols["player"] = resources::controller->current_team().current_player();
|
||||
display::announce_options announce_options;
|
||||
announce_options.lifetime = 250;
|
||||
display::get_singleton()->announce(VGETTEXT(message, symbols), font::NORMAL_COLOR, announce_options);
|
||||
auto& controller = *resources::controller;
|
||||
auto& current_team = controller.current_team();
|
||||
static bool ignore = false;
|
||||
bool show_long_message = controller.is_replay() || !current_team.is_local();
|
||||
|
||||
if(show_long_message && !ignore) {
|
||||
play_controller::scoped_savegame_snapshot snapshot(controller);
|
||||
std::stringstream sbuilder;
|
||||
// TODO: improve message and mark translatable.
|
||||
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.save_game_interactive(sbuilder.str(), savegame::savegame::YES_NO); // can throw quit_game_exception
|
||||
}
|
||||
else {
|
||||
display::announce_options announce_options;
|
||||
display::get_singleton()->announce(VGETTEXT(message, {{"player", current_team.current_player()}}), font::NORMAL_COLOR, announce_options);
|
||||
}
|
||||
}
|
||||
}
|
||||
SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_handler*/)
|
||||
|
|
Loading…
Add table
Reference in a new issue