Skip to content

Commit

Permalink
Merge branch 'master' into sdl2
Browse files Browse the repository at this point in the history
  • Loading branch information
aginor committed Sep 21, 2015
2 parents 9ae3b29 + 76b357d commit 3e85559
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/synced_user_choice.cpp
Expand Up @@ -255,8 +255,13 @@ user_choice_manager::user_choice_manager(const std::string &name, const mp_sync:

void user_choice_manager::search_in_replay()
{
while(!resources::recorder->at_end() && !finished() && !oos_)
while(!finished() && !oos_)
{
do_replay_handle();
if(resources::recorder->at_end()) {
return;
}

DBG_REPLAY << "MP synchronization: extracting choice from replay with has_local_side=" << has_local_choice() << "\n";

const config *action = resources::recorder->get_next_action();
Expand Down Expand Up @@ -287,7 +292,6 @@ void user_choice_manager::search_in_replay()
}
res_[from_side] = action->child(tagname_);
changed_event_.notify_observers();
do_replay_handle();
}
}
void user_choice_manager::pull()
Expand Down
6 changes: 5 additions & 1 deletion src/synced_user_choice.hpp
Expand Up @@ -89,7 +89,7 @@ class user_choice_manager : events::pump_monitor
const mp_sync::user_choice& uch_;
const std::string& tagname_;
const int current_side_;
// private constructor
// private constructor, this object is only constructed by user_choice_manager::get_user_choice_internal
user_choice_manager(const std::string &name, const mp_sync::user_choice &uch, std::set<int> sides);
~user_choice_manager() {}
void search_in_replay();
Expand All @@ -99,13 +99,17 @@ class user_choice_manager : events::pump_monitor
{ return required_.size() == res_.size(); }
bool has_local_choice()
{ return local_choice_ != 0; }
/// Note: currently finished() does not imply !waiting() so you may need to check both.
bool waiting()
{ return local_choice_ == 0 && !oos_; }
void update_local_choice();
void ask_local_choice();
void fix_oos();
const std::string& wait_message() { return wait_message_; }
/// @param name: the tagname for this user choice in the replay
/// @param sides: an array of team numbers (beginning with 1). the specified sides may not have an empty controller.
static std::map<int, config> get_user_choice_internal(const std::string &name, const mp_sync::user_choice &uch, const std::set<int>& sides);
/// Inherited from events::pump_monitor
void process(events::pump_info&);
events::generic_event changed_event_;
};
Expand Down

0 comments on commit 3e85559

Please sign in to comment.