add maybe_linger to playsingle/mp_controller
This commit is contained in:
parent
73de2e684a
commit
dce39b93e1
5 changed files with 31 additions and 16 deletions
|
@ -313,10 +313,10 @@ static LEVEL_RESULT playsingle_scenario(const config& game_config,
|
|||
store_carryover(state_of_game, playcontroller, disp, end_level);
|
||||
}
|
||||
|
||||
if (!disp.video().faked() && res != QUIT && end_level.transient.linger_mode)
|
||||
if (!disp.video().faked() && res != QUIT)
|
||||
{
|
||||
try {
|
||||
playcontroller.linger();
|
||||
playcontroller.maybe_linger();
|
||||
} catch(end_level_exception& e) {
|
||||
if (e.result == QUIT) {
|
||||
return QUIT;
|
||||
|
@ -374,16 +374,7 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
|
|||
|
||||
if (!disp.video().faked() && res != QUIT) {
|
||||
try {
|
||||
if (!end_level.transient.linger_mode) {
|
||||
if(!playcontroller.is_host()) {
|
||||
// If we continue without lingering we need to
|
||||
// make sure the host uploads the next scenario
|
||||
// before we attempt to download it.
|
||||
playcontroller.wait_for_upload();
|
||||
}
|
||||
} else {
|
||||
playcontroller.linger();
|
||||
}
|
||||
playcontroller.maybe_linger();
|
||||
} catch(end_level_exception& e) {
|
||||
if (e.result == QUIT) {
|
||||
return QUIT;
|
||||
|
|
|
@ -609,3 +609,17 @@ void playmp_controller::do_idle_notification()
|
|||
_("This side is in an idle state. To proceed with the game, it must be assigned to another controller. You may use :droid, :control or :give_control for example."),
|
||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
||||
void playmp_controller::maybe_linger()
|
||||
{
|
||||
if (!get_end_level_data_const().transient.linger_mode) {
|
||||
if(!is_host()) {
|
||||
// If we continue without lingering we need to
|
||||
// make sure the host uploads the next scenario
|
||||
// before we attempt to download it.
|
||||
wait_for_upload();
|
||||
}
|
||||
} else {
|
||||
linger();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,7 @@ public:
|
|||
void reset_countdown();
|
||||
void think_about_countdown(int ticks);
|
||||
void process(events::pump_info &info);
|
||||
void linger();
|
||||
/** Wait for the host to upload the next scenario. */
|
||||
void wait_for_upload();
|
||||
void maybe_linger();
|
||||
void process_oos(const std::string& err_msg) const;
|
||||
|
||||
protected:
|
||||
|
@ -58,6 +56,10 @@ protected:
|
|||
virtual void play_network_turn();
|
||||
virtual void do_idle_notification();
|
||||
virtual void play_idle_loop();
|
||||
|
||||
void linger();
|
||||
/** Wait for the host to upload the next scenario. */
|
||||
void wait_for_upload();
|
||||
|
||||
int beep_warning_time_;
|
||||
mutable bool network_processing_stopped_;
|
||||
|
|
|
@ -1087,3 +1087,10 @@ bool playsingle_controller::is_host() const
|
|||
{
|
||||
return turn_data_.is_host();
|
||||
}
|
||||
|
||||
void playsingle_controller::maybe_linger()
|
||||
{
|
||||
if (get_end_level_data_const().transient.linger_mode) {
|
||||
linger();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ public:
|
|||
virtual void whiteboard_bump_up_action();
|
||||
virtual void whiteboard_bump_down_action();
|
||||
virtual void whiteboard_suppose_dead();
|
||||
void linger();
|
||||
|
||||
virtual void force_end_level(LEVEL_RESULT res)
|
||||
{ level_result_ = res; }
|
||||
|
@ -72,6 +71,7 @@ public:
|
|||
int turns_left, int finishing_bonus);
|
||||
virtual void on_not_observer() {}
|
||||
bool is_host() const ;
|
||||
virtual void maybe_linger();
|
||||
|
||||
protected:
|
||||
virtual void play_turn(bool save);
|
||||
|
@ -106,6 +106,7 @@ protected:
|
|||
bool turn_over_;
|
||||
bool skip_next_turn_;
|
||||
LEVEL_RESULT level_result_;
|
||||
void linger();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue