mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 19:31:00 +00:00
Sneak up on EOS-linger by a different refactoring.
Instead of trying to use new/delete, pull the entire text of playsingle_scenario and playmp_scenario into playcampaign.cpp in preparation for inlinining them at the point where we'll need the controller objects to be visible. Tested, both SP and MP.
This commit is contained in:
parent
5d753a302d
commit
4f4ebe012c
@ -34,6 +34,7 @@
|
||||
#include "wassert.hpp"
|
||||
|
||||
#define LOG_G LOG_STREAM(info, general)
|
||||
#define LOG_NG LOG_STREAM(info, engine)
|
||||
|
||||
namespace {
|
||||
|
||||
@ -109,6 +110,30 @@ static void clean_autosaves(const std::string &label)
|
||||
}
|
||||
|
||||
|
||||
LEVEL_RESULT playsingle_scenario(const game_data& gameinfo, const config& game_config,
|
||||
const config* level, CVideo& video, game_state& state_of_game,
|
||||
const std::vector<config*>& story, upload_log& log, bool skip_replay)
|
||||
{
|
||||
const int ticks = SDL_GetTicks();
|
||||
const int num_turns = atoi((*level)["turns"].c_str());
|
||||
LOG_NG << "creating objects... " << (SDL_GetTicks() - ticks) << "\n";
|
||||
playsingle_controller playcontroller(*level, gameinfo, state_of_game, ticks, num_turns, game_config, video, skip_replay);
|
||||
LOG_NG << "created objects... " << (SDL_GetTicks() - playcontroller.get_ticks()) << "\n";
|
||||
|
||||
return playcontroller.play_scenario(story, log, skip_replay);
|
||||
}
|
||||
|
||||
|
||||
LEVEL_RESULT playmp_scenario(const game_data& gameinfo, const config& game_config,
|
||||
config const* level, CVideo& video, game_state& state_of_game,
|
||||
const config::child_list& story, upload_log& log, bool skip_replay)
|
||||
{
|
||||
const int ticks = SDL_GetTicks();
|
||||
const int num_turns = atoi((*level)["turns"].c_str());
|
||||
playmp_controller playcontroller(*level, gameinfo, state_of_game, ticks, num_turns, game_config, video, skip_replay);
|
||||
return playcontroller.play_scenario(story, log, skip_replay);
|
||||
}
|
||||
|
||||
LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_config,
|
||||
const game_data& units_data, CVideo& video,
|
||||
upload_log &log,
|
||||
|
@ -23,16 +23,6 @@
|
||||
|
||||
unsigned int playmp_controller::replay_last_turn_ = 0;
|
||||
|
||||
LEVEL_RESULT playmp_scenario(const game_data& gameinfo, const config& game_config,
|
||||
config const* level, CVideo& video, game_state& state_of_game,
|
||||
const config::child_list& story, upload_log& log, bool skip_replay)
|
||||
{
|
||||
const int ticks = SDL_GetTicks();
|
||||
const int num_turns = atoi((*level)["turns"].c_str());
|
||||
playmp_controller playcontroller(*level, gameinfo, state_of_game, ticks, num_turns, game_config, video, skip_replay);
|
||||
return playcontroller.play_scenario(story, log, skip_replay);
|
||||
}
|
||||
|
||||
playmp_controller::playmp_controller(const config& level, const game_data& gameinfo, game_state& state_of_game,
|
||||
const int ticks, const int num_turns, const config& game_config, CVideo& video,
|
||||
bool skip_replay)
|
||||
|
@ -60,9 +60,4 @@ private:
|
||||
static unsigned int replay_last_turn_;
|
||||
};
|
||||
|
||||
|
||||
LEVEL_RESULT playmp_scenario(const game_data& gameinfo, const config& terrain_config,
|
||||
config const* level, CVideo& video, game_state& state_of_game,
|
||||
const config::child_list& story, upload_log& log, bool skip_replay);
|
||||
|
||||
#endif
|
||||
|
@ -24,19 +24,6 @@
|
||||
|
||||
#define LOG_NG LOG_STREAM(info, engine)
|
||||
|
||||
LEVEL_RESULT playsingle_scenario(const game_data& gameinfo, const config& game_config,
|
||||
const config* level, CVideo& video, game_state& state_of_game,
|
||||
const std::vector<config*>& story, upload_log& log, bool skip_replay)
|
||||
{
|
||||
const int ticks = SDL_GetTicks();
|
||||
const int num_turns = atoi((*level)["turns"].c_str());
|
||||
LOG_NG << "creating objects... " << (SDL_GetTicks() - ticks) << "\n";
|
||||
playsingle_controller playcontroller(*level, gameinfo, state_of_game, ticks, num_turns, game_config, video, skip_replay);
|
||||
LOG_NG << "created objects... " << (SDL_GetTicks() - playcontroller.get_ticks()) << "\n";
|
||||
|
||||
return playcontroller.play_scenario(story, log, skip_replay);
|
||||
}
|
||||
|
||||
playsingle_controller::playsingle_controller(const config& level, const game_data& gameinfo, game_state& state_of_game,
|
||||
const int ticks, const int num_turns, const config& game_config, CVideo& video,
|
||||
bool skip_replay)
|
||||
|
@ -75,8 +75,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
LEVEL_RESULT playsingle_scenario(const game_data& gameinfo, const config& terrain_config,
|
||||
const config* level, CVideo& video, game_state& state_of_game,
|
||||
const std::vector<config*>& story, upload_log& loo, bool skip_replay);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user