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


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

Header


Content

Posted by gabrielmorin on July 14, 2010 - 05:07:
Author: gabba
Date: Wed Jul 14 05:07:09 2010
New Revision: 44155

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44155&view=rev
Log:
Whiteboard: fix impossibility to define attack w/o move before it.

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

Modified: trunk/src/mouse_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=44155&r1=44154&r2=44155&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Wed Jul 14 05:07:09 2010
@@ -463,9 +463,9 @@
        //see if we're trying to do a attack or move-and-attack
        if(!browse && !commands_disabled && attack_from.valid()) {
                if (resources::whiteboard->is_active()) {
-                       if (resources::whiteboard->has_temp_move())
+                       if (resources::whiteboard->has_selected_unit())
                        {
-                               
resources::whiteboard->save_temp_attack(clicked_u->get_location());
+                               
resources::whiteboard->save_temp_attack(attack_from, 
clicked_u->get_location());
                        }
                        return false;
                } else {

Modified: trunk/src/whiteboard/manager.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.cpp?rev=44155&r1=44154&r2=44155&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.cpp (original)
+++ trunk/src/whiteboard/manager.cpp Wed Jul 14 05:07:09 2010
@@ -266,7 +266,7 @@
        }
 }
 
-void manager::save_temp_attack(const map_location& target_hex)
+void manager::save_temp_attack(const map_location& attack_from, const 
map_location& target_hex)
 {
        if (active_ && !modifying_actions_)
        {
@@ -296,10 +296,7 @@
                else
                {
                        move_arrow.reset(new arrow);
-
-                       source_hex = selected_unit_->get_location();
-                       dest_hex = selected_unit_->get_location();
-
+                       dest_hex = source_hex = attack_from;
                }
 
                erase_temp_move();
@@ -311,6 +308,8 @@
 
                current_actions()->queue_attack(*subject_unit, target_hex, 
source_hex, dest_hex, move_arrow, fake_unit);
                modifying_actions_ = false;
+
+               resources::screen->invalidate(target_hex);
        }
 }
 

Modified: trunk/src/whiteboard/manager.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.hpp?rev=44155&r1=44154&r2=44155&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.hpp (original)
+++ trunk/src/whiteboard/manager.hpp Wed Jul 14 05:07:09 2010
@@ -77,6 +77,8 @@
        void create_temp_move(const pathfind::marked_route &route);
        /** Informs whether an arrow is being displayed for move creation 
purposes */
        bool has_temp_move() const { return route_; }
+       /** Informs whether the whiteboard tracks a selected unit */
+       bool has_selected_unit() const { return selected_unit_ != NULL; }
 
        void erase_temp_move();
 
@@ -87,7 +89,7 @@
      */
        void save_temp_move();
 
-       void save_temp_attack(const map_location& target_hex);
+       void save_temp_attack(const map_location& attack_from, const 
map_location& target_hex);
 
        /** Executes first action in the queue for current side */
        void contextual_execute();




Related Messages


Powered by MHonArc, Updated Wed Jul 14 05:20:10 2010