implemented continue_no_save
This commit is contained in:
parent
61dc2c9027
commit
059d2e5fb3
6 changed files with 20 additions and 10 deletions
|
@ -131,7 +131,7 @@ Defeat:
|
|||
controller=human
|
||||
hitpoints=80
|
||||
gold=20
|
||||
team=good
|
||||
team_name=good
|
||||
[/side]
|
||||
|
||||
[side]
|
||||
|
@ -147,7 +147,7 @@ Defeat:
|
|||
recruit=Cockatrice,Vampire Bat
|
||||
gold=100
|
||||
{INCOME 10 20 30}
|
||||
team=bad
|
||||
team_name=bad
|
||||
[/side]
|
||||
|
||||
[side]
|
||||
|
@ -163,7 +163,7 @@ Defeat:
|
|||
recruit=Cockatrice,Gryphon
|
||||
gold=100
|
||||
{INCOME 10 20 30}
|
||||
team=bad
|
||||
team_name=bad
|
||||
[/side]
|
||||
|
||||
#define TURNED_TO_STONE
|
||||
|
|
|
@ -583,7 +583,7 @@ int show_file_chooser_dialog(display &disp, std::string &filename,
|
|||
}
|
||||
|
||||
namespace {
|
||||
static const SDL_Rect unit_preview_size = {-150,-350,150,350};
|
||||
static const SDL_Rect unit_preview_size = {-150,-370,150,370};
|
||||
static const int unit_preview_border = 10;
|
||||
}
|
||||
|
||||
|
|
12
src/game.cpp
12
src/game.cpp
|
@ -99,10 +99,12 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
const config::child_list& story = scenario->get_children("story");
|
||||
const std::string current_scenario = state.scenario;
|
||||
|
||||
bool save_game_after_scenario = true;
|
||||
|
||||
try {
|
||||
state.label = translate_string_default((*scenario)["id"],(*scenario)["name"]);
|
||||
|
||||
const LEVEL_RESULT res = play_level(units_data,game_config,scenario,video,state,story);
|
||||
LEVEL_RESULT res = play_level(units_data,game_config,scenario,video,state,story);
|
||||
|
||||
state.snapshot = config();
|
||||
|
||||
|
@ -140,6 +142,12 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
recorder.clear();
|
||||
state.replay_data.clear();
|
||||
|
||||
//continue without saving is like a victory, but the save game dialog isn't displayed
|
||||
if(res == LEVEL_CONTINUE_NO_SAVE) {
|
||||
res = VICTORY;
|
||||
save_game_after_scenario = false;
|
||||
}
|
||||
|
||||
if(res != VICTORY) {
|
||||
return res;
|
||||
}
|
||||
|
@ -165,7 +173,7 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
scenario = game_config.find_child(type,"id",state.scenario);
|
||||
|
||||
//if this isn't the last scenario, then save the game
|
||||
if(scenario != NULL) {
|
||||
if(scenario != NULL && save_game_after_scenario) {
|
||||
state.label = translate_string_default((*scenario)["id"],(*scenario)["name"]);
|
||||
state.starting_pos = config();
|
||||
|
||||
|
|
|
@ -1114,6 +1114,8 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
throw end_level_exception(VICTORY,bonus);
|
||||
} else if(result == "continue") {
|
||||
throw end_level_exception(LEVEL_CONTINUE);
|
||||
} else if(result == "continue_no_save") {
|
||||
throw end_level_exception(LEVEL_CONTINUE_NO_SAVE);
|
||||
} else {
|
||||
std::cerr << "throwing event defeat...\n";
|
||||
throw end_level_exception(DEFEAT);
|
||||
|
|
|
@ -639,7 +639,7 @@ redo_turn:
|
|||
string_table["defeat_message"],
|
||||
gui::OK_ONLY);
|
||||
return DEFEAT;
|
||||
} else if(end_level.result == VICTORY || end_level.result == LEVEL_CONTINUE) {
|
||||
} else if(end_level.result == VICTORY || end_level.result == LEVEL_CONTINUE || end_level.result == LEVEL_CONTINUE_NO_SAVE) {
|
||||
try {
|
||||
game_events::fire("victory");
|
||||
} catch(end_level_exception&) {
|
||||
|
@ -656,9 +656,9 @@ redo_turn:
|
|||
|
||||
//'continue' is like a victory, except it doesn't announce victory,
|
||||
//and the player returns 100% of gold.
|
||||
if(end_level.result == LEVEL_CONTINUE) {
|
||||
if(end_level.result == LEVEL_CONTINUE || end_level.result == LEVEL_CONTINUE_NO_SAVE) {
|
||||
state_of_game.gold = teams[0].gold();
|
||||
return VICTORY;
|
||||
return end_level.result == LEVEL_CONTINUE_NO_SAVE ? LEVEL_CONTINUE_NO_SAVE : VICTORY;
|
||||
}
|
||||
|
||||
const int remaining_gold = teams[0].gold();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
enum LEVEL_RESULT { VICTORY, DEFEAT, QUIT, LEVEL_CONTINUE };
|
||||
enum LEVEL_RESULT { VICTORY, DEFEAT, QUIT, LEVEL_CONTINUE, LEVEL_CONTINUE_NO_SAVE };
|
||||
|
||||
struct end_level_exception {
|
||||
end_level_exception(LEVEL_RESULT res, bool bonus=true)
|
||||
|
|
Loading…
Add table
Reference in a new issue