Author: martinxyz
Date: Sat Mar  1 16:45:18 2008
New Revision: 24177

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24177&view=rev
Log:
Clear the unit visiblilty cache after moves.
Fixes a glitch sometimes when ambushed, the uncovered would
not show up. (I got a savegame where it always happens.)

Modified:
    trunk/src/actions.cpp
    trunk/src/menu_events.cpp
    trunk/src/replay.cpp
    trunk/src/unit.hpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=24177&r1=24176&r2=24177&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Sat Mar  1 16:45:18 2008
@@ -2164,6 +2164,7 @@
        p->first = steps.back();
        units.add(p);
        ui = units.find(p->first);
+       unit::clear_status_caches();
 
        if(move_recorder != NULL) {
                move_recorder->add_movement(steps.front(),steps.back());

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=24177&r1=24176&r2=24177&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Sat Mar  1 16:45:18 2008
@@ -1324,6 +1324,7 @@
                        up->second.set_movement(starting_moves);
                        up->first = route.back();
                        units_.add(up);
+                       unit::clear_status_caches();
                        up->second.set_standing(up->first);
                        gui_->invalidate(route.back());
                        gui_->draw();
@@ -1440,6 +1441,7 @@
                        up->second.set_movement(starting_moves);
                        up->first = route.back();
                        units_.add(up);
+                       unit::clear_status_caches();
                        up->second.set_standing(up->first);
 
                        if(map_.is_village(route.back())) {

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=24177&r1=24176&r2=24177&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Sat Mar  1 16:45:18 2008
@@ -1084,6 +1084,7 @@
                        std::pair<gamemap::location,unit> *up = 
units.extract(u->first);
                        up->first = dst;
                        units.add(up);
+                       unit::clear_status_caches();
                        if (up->first == up->second.get_goto())
                        {
                                //if unit has arrived to destination, goto 
variable is cleaned

Modified: trunk/src/unit.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=24177&r1=24176&r2=24177&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Sat Mar  1 16:45:18 2008
@@ -50,9 +50,7 @@
 class unit
 {
 public:
-       //! @todo Unclear comment:
-       // clear the status caches for esch unit, this is should be called it
-       // the status of a unit changes
+       //! Clear the unit status cache for all units. Currently only the 
hidden status of units is cached this way.
        static void clear_status_caches();
 
        friend struct unit_movement_resetter;


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to