Author: tschmitz
Date: Sun Jul 24 23:40:38 2011
New Revision: 50396
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50396&view=rev
Log:
Changed how the whiteboard clear_undo() works.
Modified:
trunk/src/actions.cpp
trunk/src/whiteboard/manager.cpp
trunk/src/whiteboard/manager.hpp
trunk/src/whiteboard/side_actions.cpp
Modified: trunk/src/actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=50396&r1=50395&r2=50396&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Sun Jul 24 23:40:38 2011
@@ -2651,7 +2651,8 @@
}
if(undo_stack != NULL) {
- if(event_mutated || should_clear_stack || maybe_ui ==
units.end()) {
+ if(event_mutated || should_clear_stack || maybe_ui ==
units.end()
+ ||
resources::whiteboard->active_and_should_clear_undo()) {
apply_shroud_changes(*undo_stack, team_num + 1);
undo_stack->clear();
} else {
@@ -2661,7 +2662,6 @@
starting_waypoints,
starting_moves,
action_time_bonus,
orig_village_owner, orig_dir));
}
- resources::whiteboard->possibly_clear_undo();
}
bool redraw = false;
Modified: trunk/src/whiteboard/manager.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.cpp?rev=50396&r1=50395&r2=50396&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.cpp (original)
+++ trunk/src/whiteboard/manager.cpp Sun Jul 24 23:40:38 2011
@@ -132,7 +132,8 @@
if (active_)
{
- possibly_clear_undo();
+ if(should_clear_undo())
+ clear_undo();
validate_viewer_actions();
LOG_WB << "Whiteboard activated! " << *viewer_actions()
<< "\n";
create_temp_move();
@@ -815,13 +816,11 @@
}
}
-void manager::possibly_clear_undo()
-{
- if(is_active())
- {
- resources::undo_stack->clear();
- resources::redo_stack->clear();
- }
+void manager::clear_undo()
+{
+ apply_shroud_changes(*resources::undo_stack, viewer_side());
+ 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=50396&r1=50395&r2=50396&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.hpp (original)
+++ trunk/src/whiteboard/manager.hpp Sun Jul 24 23:40:38 2011
@@ -150,12 +150,12 @@
/// Is referenced by the top bar gold display
int get_spent_gold_for(int side);
- /**
- * 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();
+ /// Determines whether or not the undo_stack should be cleared.
+ ///@todo Only when there are networked allies and we have set a
preferences option
+ bool should_clear_undo() const {return true;}
+ bool active_and_should_clear_undo() const {return manager::active_ &&
should_clear_undo();}
+ /// Updates shroud and clears the undo_stack and redo_stack.
+ void 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=50396&r1=50395&r2=50396&view=diff
==============================================================================
--- trunk/src/whiteboard/side_actions.cpp (original)
+++ trunk/src/whiteboard/side_actions.cpp Sun Jul 24 23:40:38 2011
@@ -176,7 +176,8 @@
throw;
}
- resources::whiteboard->possibly_clear_undo();
+ if(resources::whiteboard->should_clear_undo())
+ resources::whiteboard->clear_undo();
if(exec_result!=action::FAIL)
{
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits