rename context_mutated -> undo_disabled

This commit is contained in:
gfgtdf 2017-07-23 23:59:27 +02:00
parent 8e3dd056c8
commit 974f09178c
3 changed files with 14 additions and 14 deletions

View file

@ -62,11 +62,11 @@ namespace context
/// State when processing a particular flight of events or commands.
struct state
{
bool mutated;
bool undo_disabled;
bool skip_messages;
explicit state(bool s, bool m = true)
: mutated(m)
: undo_disabled(m)
, skip_messages(s)
{
}
@ -314,7 +314,7 @@ bool wml_event_pump::process_event(handler_ptr& handler_p, const queued_event& e
resources::screen->maybe_rebuild();
}
return context_mutated();
return undo_disabled();
}
/**
@ -430,21 +430,21 @@ context::scoped::scoped(std::stack<context::state>& contexts, bool m)
context::scoped::~scoped()
{
assert(contexts_.size() > 1);
bool mutated = contexts_.top().mutated;
bool undo_disabled = contexts_.top().undo_disabled;
contexts_.pop();
contexts_.top().mutated |= mutated;
contexts_.top().undo_disabled |= undo_disabled;
}
bool wml_event_pump::context_mutated()
bool wml_event_pump::undo_disabled()
{
assert(impl_->contexts_.size() > 0);
return impl_->contexts_.top().mutated;
return impl_->contexts_.top().undo_disabled;
}
void wml_event_pump::context_mutated(bool b)
void wml_event_pump::set_undo_disabled(bool b)
{
assert(impl_->contexts_.size() > 0);
impl_->contexts_.top().mutated = b;
impl_->contexts_.top().undo_disabled = b;
}
bool wml_event_pump::context_skip_messages()
@ -605,7 +605,7 @@ bool wml_event_pump::operator()()
resources::whiteboard->on_gamestate_change();
}
return context_mutated();
return undo_disabled();
}
void wml_event_pump::flush_messages()

View file

@ -84,10 +84,10 @@ public:
* Context: The general environment within which events are processed.
* Returns whether or not we believe WML might have changed something.
*/
bool context_mutated();
bool undo_disabled();
/** Sets whether or not we believe WML might have changed something. */
void context_mutated(bool mutated);
void set_undo_disabled(bool mutated);
/** Returns whether or not we are skipping messages. */
bool context_skip_messages();

View file

@ -3528,10 +3528,10 @@ int game_lua_kernel::intf_allow_end_turn(lua_State * L)
int game_lua_kernel::intf_allow_undo(lua_State * L)
{
if(lua_isboolean(L, 1)) {
play_controller_.pump().context_mutated(!luaW_toboolean(L, 1));
play_controller_.pump().set_undo_disabled(!luaW_toboolean(L, 1));
}
else {
play_controller_.pump().context_mutated(false);
play_controller_.pump().set_undo_disabled(false);
}
return 0;
}