ask to save replay at end of scenario
This commit is contained in:
parent
2806fffc02
commit
816599ab9f
3 changed files with 16 additions and 0 deletions
|
@ -80,6 +80,7 @@ lawful=Lawful
|
|||
neutral=Neutral
|
||||
chaotic=Chaotic
|
||||
|
||||
save_replay_message="Do you want to save a replay of this scenario?"
|
||||
save_game_message="Do you want to save your game?"
|
||||
save_game_label="Name:"
|
||||
save_confirm_message="The game has been saved"
|
||||
|
|
|
@ -1974,6 +1974,9 @@ void display::move_unit_between(const gamemap::location& a,
|
|||
double xloc = xsrc + xstep*i;
|
||||
double yloc = ysrc + ystep*i;
|
||||
|
||||
//we try to scroll the map if the unit is at the edge.
|
||||
//keep track of the old position, and if the map moves at all,
|
||||
//then recenter it on the unit
|
||||
double oldxpos = xpos_;
|
||||
double oldypos = ypos_;
|
||||
if(xloc < side_threshhold) {
|
||||
|
|
12
src/game.cpp
12
src/game.cpp
|
@ -71,6 +71,18 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
video,state,story);
|
||||
}
|
||||
|
||||
//ask to save a replay of the game
|
||||
if(res == VICTORY || res == DEFEAT) {
|
||||
std::string label = state.label + " replay";
|
||||
const int should_save = gui::show_dialog(disp,NULL,"",
|
||||
string_table["save_replay_message"],
|
||||
gui::YES_NO,NULL,NULL,
|
||||
string_table["save_game_label"],&label);
|
||||
if(should_save == 0) {
|
||||
recorder.save_game(units_data,label);
|
||||
}
|
||||
}
|
||||
|
||||
recorder.clear();
|
||||
state.replay_data.clear();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue