Campaign Controller: minor code dup cleanup

This commit is contained in:
Charles Dang 2021-01-05 06:14:21 +11:00
parent f1e0fd8b70
commit a1dc62ea8f

View file

@ -179,15 +179,18 @@ void campaign_controller::show_carryover_message(
LEVEL_RESULT campaign_controller::playsingle_scenario(end_level_data &end_level)
{
playsingle_controller playcontroller(
is_replay_ ? state_.get_replay_starting_point() : state_.get_starting_point(), state_, false);
const config& starting_point = is_replay_
? state_.get_replay_starting_point()
: state_.get_starting_point();
playsingle_controller playcontroller(starting_point, state_, false);
LOG_NG << "created objects... " << (SDL_GetTicks() - playcontroller.get_ticks()) << "\n";
if(is_replay_) {
playcontroller.enable_replay(is_unit_test_);
}
LEVEL_RESULT res = playcontroller.play_scenario(is_replay_ ? state_.get_replay_starting_point() : state_.get_starting_point());
LEVEL_RESULT res = playcontroller.play_scenario(starting_point);
if(res == LEVEL_RESULT::QUIT) {
return LEVEL_RESULT::QUIT;
}