当前位置: 首页>>代码示例>>C++>>正文


C++ game_state::rng方法代码示例

本文整理汇总了C++中game_state::rng方法的典型用法代码示例。如果您正苦于以下问题:C++ game_state::rng方法的具体用法?C++ game_state::rng怎么用?C++ game_state::rng使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game_state的用法示例。


在下文中一共展示了game_state::rng方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: play_game


//.........这里部分代码省略.........
			}
		}

		recorder.clear();
		gamestate.replay_data.clear();
		gamestate.start_scenario_ss.str("");
		gamestate.clear_start_hero_data();

		// On DEFEAT, QUIT, or OBSERVER_END, we're done now
		if (res != VICTORY) {
			if (res != OBSERVER_END || gamestate.classification().next_scenario.empty()) {
				gamestate.snapshot = config();
				return res;
			}

			const int dlg_res = gui2::show_message(disp.video(), _("Game Over"),
				_("This scenario has ended. Do you want to continue the campaign?"),
				gui2::tmessage::yes_no_buttons);

			if (dlg_res == gui2::twindow::CANCEL) {
				gamestate.snapshot = config();
				return res;
			}
		}

		// Continue without saving is like a victory,
		// but the save game dialog isn't displayed
		if (!end_level.prescenario_save) {
			save_game_after_scenario = false;
		}

		// Switch to the next scenario.
		gamestate.classification().scenario = gamestate.classification().next_scenario;
		gamestate.rng().rotate_random();
		// gamestate.rng().seed_random(rand(), 0);

		scenario = NULL;
		if (io_type == IO_NONE) {
			scenario = &load_campagin_scenario(gamestate.classification().campaign, gamestate.classification().scenario, type);
			if (scenario->empty()) {
				scenario = NULL;
			} else{
				starting_pos = *scenario;
				starting_pos["fog"] = fog;
				starting_pos["shroud"] = shroud;
				scenario = &starting_pos;
			}
		}

		if (scenario != NULL) {
			// to single-player campaign, there are multi-secenario, 
			// set this result to next start hero data
			heros.reset_to_unstage();
			heros_start = heros;

			loadscreen::global_loadscreen_manager* loadscreen_manager = loadscreen::global_loadscreen_manager::get();
			if (loadscreen_manager) {
				loadscreen_manager->reset();
			}
			// Update the label
			// std::string oldlabel = gamestate.classification().label;
			t_string scenario_name = (*scenario)["name"];
			if (gamestate.classification().abbrev.empty()) {
				gamestate.classification().label = scenario_name;
				gamestate.classification().original_label = scenario_name.base_str();
			} else {
开发者ID:coolsee,项目名称:War-Of-Kingdom,代码行数:67,代码来源:playcampaign.cpp


注:本文中的game_state::rng方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。