Backing out my EOS-linger changes.
They're either wrong in themselves or (more likely) interacting badly with some recent MP-lobby changes. I don't want to leave the game in a broken state just as I go on vacation.
This commit is contained in:
parent
69be2fab3b
commit
9710708b28
5 changed files with 37 additions and 41 deletions
|
@ -34,7 +34,6 @@
|
|||
#include "wassert.hpp"
|
||||
|
||||
#define LOG_G LOG_STREAM(info, general)
|
||||
#define LOG_NG LOG_STREAM(info, engine)
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -279,23 +278,13 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
|
|||
|
||||
gamestate.completion = "running";
|
||||
|
||||
const int ticks = SDL_GetTicks();
|
||||
const int num_turns = atoi((*scenario)["turns"].c_str());
|
||||
// FIXME: make this an auto_ptr
|
||||
playsingle_controller *pcontroller;
|
||||
|
||||
LOG_NG << "creating objects... " << (SDL_GetTicks() - ticks) << "\n";
|
||||
switch (io_type){
|
||||
case IO_NONE:
|
||||
pcontroller = new playsingle_controller(*scenario,units_data,gamestate,ticks,num_turns,game_config,video,skip_replay);
|
||||
LOG_NG << "created objects... " << (SDL_GetTicks() - pcontroller->get_ticks()) << "\n";
|
||||
res = pcontroller->play_scenario(story, log, skip_replay);
|
||||
res = playsingle_scenario(units_data,game_config,scenario,video,gamestate,story,log, skip_replay);
|
||||
break;
|
||||
case IO_SERVER:
|
||||
case IO_CLIENT:
|
||||
pcontroller = new playmp_controller(*scenario,units_data,gamestate,ticks,num_turns,game_config,video,skip_replay);
|
||||
LOG_NG << "created objects... " << (SDL_GetTicks() - pcontroller->get_ticks()) << "\n";
|
||||
res = dynamic_cast<playmp_controller *>(pcontroller)->play_scenario(story, log, skip_replay);
|
||||
res = playmp_scenario(units_data,game_config,scenario,video,gamestate,story,log, skip_replay);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -315,12 +304,6 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
|
|||
_("You have been defeated!")
|
||||
).show();
|
||||
}
|
||||
|
||||
// FIXME: Support this for MP as well.
|
||||
if (io_type == IO_NONE && (res == VICTORY || res == DEFEAT)) {
|
||||
pcontroller->linger(log);
|
||||
}
|
||||
|
||||
// Temporary fix:
|
||||
// Only apply preferences for replays and autosave
|
||||
// deletes on victory. We need to rethink what this
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
|
||||
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,4 +60,9 @@ 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,6 +24,19 @@
|
|||
|
||||
#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,9 +88,7 @@ void playsingle_controller::update_shroud_now(){
|
|||
}
|
||||
|
||||
void playsingle_controller::end_turn(){
|
||||
if (linger_)
|
||||
end_turn_ = true;
|
||||
else if (!browse_){
|
||||
if (!browse_){
|
||||
end_turn_ = menu_handler_.end_turn(player_number_);
|
||||
}
|
||||
}
|
||||
|
@ -116,22 +127,6 @@ void playsingle_controller::user_command(){
|
|||
menu_handler_.user_command();
|
||||
}
|
||||
|
||||
void playsingle_controller::linger(upload_log& log)
|
||||
{
|
||||
LOG_NG << "beginning post-turn linger";
|
||||
browse_ = true;
|
||||
linger_ = true;
|
||||
try {
|
||||
play_human_turn();
|
||||
} catch(game::load_game_exception&) {
|
||||
// Loading a new game is effectively a quit.
|
||||
log.quit(status_.turn());
|
||||
throw;
|
||||
} catch(end_level_exception& end_level) {
|
||||
}
|
||||
LOG_NG << "ending post-turn linger";
|
||||
}
|
||||
|
||||
LEVEL_RESULT playsingle_controller::play_scenario(const std::vector<config*>& story, upload_log& log,
|
||||
bool skip_replay)
|
||||
{
|
||||
|
@ -473,7 +468,6 @@ void playsingle_controller::before_human_turn(bool save)
|
|||
{
|
||||
log_scope("player turn");
|
||||
browse_ = false;
|
||||
linger_ = false;
|
||||
|
||||
gui_->set_team(player_number_ - 1);
|
||||
gui_->recalculate_minimap();
|
||||
|
@ -591,7 +585,7 @@ bool playsingle_controller::can_execute_command(hotkey::HOTKEY_COMMAND command,
|
|||
case hotkey::HOTKEY_REPEAT_RECRUIT:
|
||||
case hotkey::HOTKEY_RECALL:
|
||||
case hotkey::HOTKEY_ENDTURN:
|
||||
return (!browse_ || linger_) && !events::commands_disabled;
|
||||
return !browse_ && !events::commands_disabled;
|
||||
|
||||
case hotkey::HOTKEY_DELAY_SHROUD:
|
||||
return !browse_ && (current_team().uses_fog() || current_team().uses_shroud());
|
||||
|
|
|
@ -52,7 +52,6 @@ public:
|
|||
virtual void unit_hold_position();
|
||||
virtual void end_unit_turn();
|
||||
virtual void user_command();
|
||||
void linger(upload_log& log);
|
||||
|
||||
protected:
|
||||
virtual void play_turn(bool no_save);
|
||||
|
@ -75,4 +74,9 @@ protected:
|
|||
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…
Add table
Reference in a new issue