Whiteboard: found a better place to detect...

...the beginning of a player turn, that ensures the viewing side is
correctly set.
This commit is contained in:
Gabriel Morin 2010-08-16 15:43:46 +00:00
parent 4d0d895ed3
commit b94bba36bc
5 changed files with 7 additions and 9 deletions

View file

@ -511,8 +511,6 @@ void play_controller::init_side(const unsigned int team_index, bool is_replay){
gamestate_.get_variable("side_number") = player_number_;
gamestate_.last_selected = map_location::null_location;
resources::whiteboard->on_init_side(is_replay);
/**
* We do this only for local side when we are not replaying.
* For all other sides it is recorded in replay and replay handler has to handle calling do_init_side()

View file

@ -693,6 +693,8 @@ void playsingle_controller::before_human_turn(bool save)
if(preferences::turn_bell()) {
sound::play_bell(game_config::sounds::turn_bell);
}
resources::whiteboard->before_human_turn();
}
void playsingle_controller::show_turn_dialog(){

View file

@ -350,8 +350,7 @@ void highlight_visitor::find_main_highlight()
// action destination hexes usually take priority over that
mode_ = FIND_MAIN_HIGHLIGHT;
assert(main_highlight_.expired());
LOG_WB << "highlight_visitor::find_main_highlight(): searching in side_actions of size "
<< side_actions_->actions().size() << "\n";
assert(side_actions_->team_index() == resources::screen->viewing_team());
side_actions::reverse_iterator rend = side_actions_->rend();
side_actions::reverse_iterator action = side_actions_->rbegin();
for (; action != rend; ++action )

View file

@ -212,15 +212,14 @@ bool manager::allow_leader_to_move(unit const& leader) const
return true;
}
void manager::on_init_side(bool is_replay)
void manager::before_human_turn()
{
if (is_replay)
return;
LOG_WB << "before_human_turn(): Current side is " << resources::controller->current_side()
<< " and viewing side is" << resources::screen->viewing_side() << "\n";
validate_viewer_actions();
highlighter_.reset(new highlight_visitor(*resources::units, viewer_actions()));
wait_for_side_init_ = false;
LOG_WB << "on_init_side()\n";
if (self_activate_once_ && preferences::enable_whiteboard_mode_on_start())
{

View file

@ -60,7 +60,7 @@ public:
bool can_reorder_action() const;
bool allow_leader_to_move(unit const& leader) const;
void on_init_side(bool is_replay);
void before_human_turn();
void on_finish_side_turn();
void on_mouseover_change(const map_location& hex);
void on_select_hex(){}