mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 04:35:45 +00:00
fix networked idle loop
somehow this was not implemented...
This commit is contained in:
parent
22c565282a
commit
3f4879ace4
@ -262,6 +262,45 @@ void playmp_controller::play_human_turn(){
|
||||
}
|
||||
}
|
||||
|
||||
void playmp_controller::play_idle_loop()
|
||||
{
|
||||
LOG_NG << "playmp::play_human_turn...\n";
|
||||
|
||||
remove_blindfold();
|
||||
|
||||
command_disabled_resetter reset_commands;
|
||||
|
||||
while (!end_turn_)
|
||||
{
|
||||
try {
|
||||
config cfg;
|
||||
const network::connection res = network::receive_data(cfg);
|
||||
std::deque<config> backlog;
|
||||
|
||||
if(res != network::null_connection) {
|
||||
if (turn_data_->process_network_data(cfg, res, backlog, skip_replay_) == turn_info::PROCESS_RESTART_TURN)
|
||||
{
|
||||
throw end_turn_exception(gui_->playing_side());
|
||||
}
|
||||
}
|
||||
|
||||
play_slice();
|
||||
check_end_level();
|
||||
} catch(const end_level_exception&) {
|
||||
turn_data_->send_data();
|
||||
throw;
|
||||
}
|
||||
|
||||
if (!linger_) {
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
gui_->draw();
|
||||
|
||||
turn_data_->send_data();
|
||||
}
|
||||
}
|
||||
|
||||
void playmp_controller::set_end_scenario_button()
|
||||
{
|
||||
// Modify the end-turn button
|
||||
|
@ -59,6 +59,7 @@ protected:
|
||||
virtual void finish_side_turn();
|
||||
virtual void play_network_turn();
|
||||
virtual void do_idle_notification();
|
||||
virtual void play_idle_loop();
|
||||
void init_turn_data();
|
||||
|
||||
turn_info* turn_data_;
|
||||
|
@ -83,7 +83,7 @@ protected:
|
||||
void end_turn_enable(bool enable);
|
||||
virtual hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const;
|
||||
void play_ai_turn();
|
||||
void play_idle_loop();
|
||||
virtual void play_idle_loop();
|
||||
virtual void do_idle_notification();
|
||||
virtual void play_network_turn();
|
||||
virtual void init_gui();
|
||||
|
Loading…
x
Reference in New Issue
Block a user