Author: tschmitz
Date: Tue Jul 12 09:44:44 2011
New Revision: 50277

URL: http://svn.gna.org/viewcvs/wesnoth?rev=50277&view=rev
Log:
Changed wb::manager fcn clear_undo() into possibly_clear_undo().

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

Modified: trunk/src/whiteboard/manager.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.cpp?rev=50277&r1=50276&r2=50277&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.cpp (original)
+++ trunk/src/whiteboard/manager.cpp Tue Jul 12 09:44:44 2011
@@ -132,7 +132,7 @@
 
                if (active_)
                {
-                       clear_undo(); //< Clear undo stack when activating 
whiteboard mode
+                       possibly_clear_undo();
                        validate_viewer_actions();
                        LOG_WB << "Whiteboard activated! " << *viewer_actions() 
<< "\n";
                        create_temp_move();
@@ -767,10 +767,13 @@
        }
 }
 
-void manager::clear_undo()
-{
-       resources::undo_stack->clear();
-       resources::redo_stack->clear();
+void manager::possibly_clear_undo()
+{
+       if(is_active())
+       {
+               resources::undo_stack->clear();
+               resources::redo_stack->clear();
+       }
 }
 
 scoped_planned_unit_map::scoped_planned_unit_map():

Modified: trunk/src/whiteboard/manager.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.hpp?rev=50277&r1=50276&r2=50277&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.hpp (original)
+++ trunk/src/whiteboard/manager.hpp Tue Jul 12 09:44:44 2011
@@ -154,8 +154,12 @@
        /// Is referenced by the top bar gold display
        int get_spent_gold_for(int side);
 
-       /// Simply clears the undo_stack and redo_stack
-       void clear_undo();
+       /**
+        * Clears the undo_stack and redo_stack if the whiteboard is on.
+        * @todo Add other conditions where it won't get cleared, such as 
preferences option
+        * and when player has no network allies.
+        */
+       void possibly_clear_undo();
 
 private:
        void validate_actions_if_needed();

Modified: trunk/src/whiteboard/side_actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/side_actions.cpp?rev=50277&r1=50276&r2=50277&view=diff
==============================================================================
--- trunk/src/whiteboard/side_actions.cpp (original)
+++ trunk/src/whiteboard/side_actions.cpp Tue Jul 12 09:44:44 2011
@@ -202,7 +202,7 @@
                throw;
        }
 
-       resources::whiteboard->clear_undo(); //< Disable undo for actions 
executed via the whiteboard
+       resources::whiteboard->possibly_clear_undo();
 
        if (finished)
        {


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

Reply via email to