本文整理汇总了C++中game_state::get_variables方法的典型用法代码示例。如果您正苦于以下问题:C++ game_state::get_variables方法的具体用法?C++ game_state::get_variables怎么用?C++ game_state::get_variables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game_state
的用法示例。
在下文中一共展示了game_state::get_variables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: play_game
//.........这里部分代码省略.........
config temp(scenario2);
gamestate.starting_pos = temp;
scenario = &scenario2;
}
std::string map_data = (*scenario)["map_data"];
if(map_data.empty() && (*scenario)["map"] != "") {
map_data = read_map((*scenario)["map"]);
}
// If the map should be randomly generated
if(map_data.empty() && (*scenario)["map_generation"] != "") {
const cursor::setter cursor_setter(cursor::WAIT);
map_data = random_generate_map((*scenario)["map_generation"],scenario->child("generator"));
// Since we've had to generate the map,
// make sure that when we save the game,
// it will not ask for the map to be generated again on reload
static config new_level;
new_level = *scenario;
new_level["map_data"] = map_data;
scenario = &new_level;
//merge carryover information into the scenario
config temp(new_level);
gamestate.starting_pos = temp;
}
sound::empty_playlist();
//add the variables to the starting_pos unless they are already there
const config &wmlvars = gamestate.starting_pos.child("variables");
if (!wmlvars || wmlvars.empty()){
gamestate.starting_pos.clear_children("variables");
gamestate.starting_pos.add_child("variables", gamestate.get_variables());
}
switch (io_type){
case IO_NONE:
res = playsingle_scenario(game_config, scenario, disp, gamestate, heros, heros_start, cards, story, skip_replay, end_level);
break;
case IO_SERVER:
case IO_CLIENT:
res = playmp_scenario(game_config, scenario, disp, gamestate, heros, heros_start, cards, story, skip_replay, io_type, end_level);
break;
}
} catch(game::load_game_failed& e) {
gui2::show_error_message(disp.video(), _("The game could not be loaded: ") + e.message);
return QUIT;
} catch(game::game_error& e) {
gui2::show_error_message(disp.video(), _("Error while playing the game: ") + e.message);
return QUIT;
} catch(incorrect_map_format_error& e) {
gui2::show_error_message(disp.video(), std::string(_("The game map could not be loaded: ")) + e.message);
return QUIT;
} catch(config::error& e) {
std::cerr << "caught config::error...\n";
gui2::show_error_message(disp.video(), _("Error while reading the WML: ") + e.message);
return QUIT;
} catch(twml_exception& e) {
e.show(disp);
return QUIT;
}
// Save-management options fire on game end.
// This means: (a) we have a victory, or