use events::command_disabler in synced context

During the synced context we are in a state 'during an execution of an
event/action' that the savefile format cannot cover. So we use
command_disabler to prevent saving.
This commit is contained in:
gfgtdf 2014-04-07 14:58:41 +02:00
parent 5ffd7aebfd
commit a8dc92f5d6
2 changed files with 5 additions and 3 deletions

View File

@ -287,19 +287,19 @@ config synced_context::ask_server(const std::string &name, const mp_sync::user_c
}
set_scontext_synced::set_scontext_synced(const std::string& commandname)
: new_rng_(synced_context::get_rng_for(commandname)), new_checkup_(recorder.get_last_real_command().child_or_add("checkup"))
: new_rng_(synced_context::get_rng_for(commandname)), new_checkup_(recorder.get_last_real_command().child_or_add("checkup")), disabler_()
{
init();
}
set_scontext_synced::set_scontext_synced()
: new_rng_(synced_context::get_rng_for("")), new_checkup_(recorder.get_last_real_command().child_or_add("checkup"))
: new_rng_(synced_context::get_rng_for("")), new_checkup_(recorder.get_last_real_command().child_or_add("checkup")), disabler_()
{
init();
}
set_scontext_synced::set_scontext_synced(int number)
: new_rng_(synced_context::get_rng_for("")), new_checkup_(recorder.get_last_real_command().child_or_add("checkup" + boost::lexical_cast<std::string>(number)))
: new_rng_(synced_context::get_rng_for("")), new_checkup_(recorder.get_last_real_command().child_or_add("checkup" + boost::lexical_cast<std::string>(number))), disabler_()
{
init();
}

View File

@ -21,6 +21,7 @@
#include "random_new.hpp"
#include "random_new_synced.hpp"
#include "generic_event.hpp"
#include "mouse_handler_base.hpp"
#include <boost/shared_ptr.hpp>
class config;
@ -150,6 +151,7 @@ private:
boost::shared_ptr<random_new::rng> new_rng_;
checkup* old_checkup_;
synced_checkup new_checkup_;
events::command_disabler disabler_;
};
/*