mail[Wesnoth-commits] r44423 - in /trunk/src/whiteboard: highlight_visitor.cpp highlight_visitor.hpp manager.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by gabrielmorin on July 20, 2010 - 09:52:
Author: gabba
Date: Tue Jul 20 09:52:26 2010
New Revision: 44423

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44423&view=rev
Log:
Whiteboard: modifications to unit selection.

Modified:
    trunk/src/whiteboard/highlight_visitor.cpp
    trunk/src/whiteboard/highlight_visitor.hpp
    trunk/src/whiteboard/manager.cpp

Modified: trunk/src/whiteboard/highlight_visitor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/highlight_visitor.cpp?rev=44423&r1=44422&r2=44423&view=diff
==============================================================================
--- trunk/src/whiteboard/highlight_visitor.cpp (original)
+++ trunk/src/whiteboard/highlight_visitor.cpp Tue Jul 20 09:52:26 2010
@@ -60,10 +60,14 @@
        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()
-                       && resources::whiteboard->unit_has_actions(*it))
-       {
-               owner_unit_ = &(*it);
+       if (it != unit_map_.end())
+       {
+               selection_candidate_ = &(*it);
+
+               if(resources::whiteboard->unit_has_actions(*it))
+               {
+                       owner_unit_ = &(*it);
+               }
 
                //commented code below is to also select the first action of 
this unit as
                //the main highlight; it doesn't fit too well in the UI
@@ -165,13 +169,10 @@
 
 unit* highlight_visitor::get_selection_target()
 {
-//     unit* unit = NULL;
-//     if(action_ptr action = main_highlight_.lock())
-//     {
-//             unit = action->get_unit();
-//     }
-//     return unit;
-       return owner_unit_;
+       if (owner_unit_)
+               return owner_unit_;
+       else
+               return selection_candidate_;
 }
 
 void highlight_visitor::visit_move(move_ptr move)

Modified: trunk/src/whiteboard/highlight_visitor.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/highlight_visitor.hpp?rev=44423&r1=44422&r2=44423&view=diff
==============================================================================
--- trunk/src/whiteboard/highlight_visitor.hpp (original)
+++ trunk/src/whiteboard/highlight_visitor.hpp Tue Jul 20 09:52:26 2010
@@ -77,6 +77,7 @@
 
        map_location mouseover_hex_;
        unit* owner_unit_;
+       unit* selection_candidate_;
 
        weak_action_ptr main_highlight_;
        std::deque<weak_action_ptr> secondary_highlights_;

Modified: trunk/src/whiteboard/manager.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.cpp?rev=44423&r1=44422&r2=44423&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.cpp (original)
+++ trunk/src/whiteboard/manager.cpp Tue Jul 20 09:52:26 2010
@@ -176,7 +176,7 @@
        }
        else if (executing_actions_)
        {
-               LOG_WB << "Attempt to set planned_unit_map during action 
execution.";
+               LOG_WB << "Attempt to set planned_unit_map during action 
execution.\n";
        }
 }
 
@@ -197,7 +197,7 @@
        }
        else //executing_actions_
        {
-               LOG_WB << "Attempt to set planned_unit_map during action 
execution.";
+               LOG_WB << "Attempt to set planned_unit_map during action 
execution.\n";
        }
 
 }
@@ -233,12 +233,7 @@
 void manager::on_deselect_hex()
 {
        erase_temp_move();
-       if (selected_unit_)
-       {
-               LOG_WB << "Deselecting unit" << selected_unit_->name() << " 
[" << selected_unit_->id() << "]\n";
-       }
        selected_unit_ = NULL;
-
 }
 
 void manager::create_temp_move()




Related Messages


Powered by MHonArc, Updated Tue Jul 20 10:00:13 2010