Merge pull request #276 from gfgtdf/fix16075

Fix16075
This commit is contained in:
gfgtdf 2014-08-23 19:19:40 +02:00
commit d5e7427313
2 changed files with 5 additions and 3 deletions

View file

@ -430,7 +430,7 @@ LEVEL_RESULT play_game(game_display& disp, saved_game& gamestate,
} }
} }
if (!gamestate.get_scenario_id().empty() && gamestate.get_scenario_id() != "null") { if (!gamestate.get_scenario_id().empty()) {
std::string message = _("Unknown scenario: '$scenario|'"); std::string message = _("Unknown scenario: '$scenario|'");
utils::string_map symbols; utils::string_map symbols;
symbols["scenario"] = gamestate.get_scenario_id(); symbols["scenario"] = gamestate.get_scenario_id();

View file

@ -475,20 +475,22 @@ config saved_game::to_config() const
std::string saved_game::get_scenario_id() std::string saved_game::get_scenario_id()
{ {
std::string scenario_id;
if(this->starting_pos_type_ == STARTINGPOS_SNAPSHOT if(this->starting_pos_type_ == STARTINGPOS_SNAPSHOT
|| this->starting_pos_type_ == STARTINGPOS_SCENARIO) || this->starting_pos_type_ == STARTINGPOS_SCENARIO)
{ {
return starting_pos_["id"]; scenario_id = starting_pos_["id"].str();
} }
else if(!has_carryover_expanded_) else if(!has_carryover_expanded_)
{ {
return carryover_["next_scenario"]; scenario_id = carryover_["next_scenario"].str();
} }
else else
{ {
assert(!"cannot figure out scenario_id"); assert(!"cannot figure out scenario_id");
throw "assertion ingnored"; throw "assertion ingnored";
} }
return scenario_id == "null" ? "" : scenario_id;
} }
bool saved_game::not_corrupt() const bool saved_game::not_corrupt() const