Author: tschmitz
Date: Fri Jul 15 23:44:56 2011
New Revision: 50335
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50335&view=rev
Log:
Made allies' actions highlightable again.
Modified:
trunk/src/whiteboard/highlight_visitor.cpp
Modified: trunk/src/whiteboard/highlight_visitor.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/highlight_visitor.cpp?rev=50335&r1=50334&r2=50335&view=diff
==============================================================================
--- trunk/src/whiteboard/highlight_visitor.cpp (original)
+++ trunk/src/whiteboard/highlight_visitor.cpp Fri Jul 15 23:44:56 2011
@@ -67,12 +67,11 @@
mouseover_hex_ = hex;
//if we're right over a unit, just highlight all of this unit's actions
unit_map::const_iterator it = unit_map_.find(hex);
- if (it != unit_map_.end()
- && it->side() == resources::screen->viewing_side())
+ if (it != unit_map_.end())
{
selection_candidate_ = &(*it);
- if(side_actions_->unit_has_actions(&*it))
+
if(resources::teams->at(it->side()-1).get_side_actions()->unit_has_actions(&*it))
{
owner_unit_ = &(*it);
}
@@ -377,15 +376,24 @@
//@todo re-enable the following assert once I find out what happends to
// viewing side assignments after victory
//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 )
- {
- (*action)->accept(*this);
- if (action_ptr main = main_highlight_.lock())
- {
- owner_unit_ = main->get_unit();
- break;
+
+ //Iterate backwards over all actions from all teams until the main
highlight is found
+ size_t current_team = resources::controller->current_side() - 1;
+ size_t num_teams = resources::teams->size();
+ for(size_t iteration = 0; iteration < num_teams; ++iteration)
+ {
+ size_t team_index = (current_team+num_teams-1-iteration) %
num_teams;
+ side_actions& sa =
*resources::teams->at(team_index).get_side_actions();
+ side_actions::reverse_iterator rend = sa.rend();
+ side_actions::reverse_iterator action = sa.rbegin();
+ for (; action != rend; ++action )
+ {
+ (*action)->accept(*this);
+ if (action_ptr main = main_highlight_.lock())
+ {
+ owner_unit_ = main->get_unit();
+ return;
+ }
}
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits