Fix a bunch of typos: syced -> synced
This commit is the result of running this command in src/ directory: git grep -lz 'syced' | xargs -0 perl -i'' -pE "s/syced/synced/g" Thank you stackoverflow :) http://stackoverflow.com/questions/1583219/awk-sed-how-to-do-a-recursive-find-replace-of-a-string (I used the "git safe" version)
This commit is contained in:
parent
c52e5ed410
commit
ca5c64b6d1
7 changed files with 31 additions and 31 deletions
|
@ -1255,7 +1255,7 @@ size_t move_unit_and_record(const std::vector<map_location> &steps,
|
|||
unit_mover mover(steps, move_spectator, continued_move, skip_ally_sighted, NULL);
|
||||
if ( !mover.check_expected_movement() )
|
||||
return 0;
|
||||
if(synced_context::get_syced_state() != synced_context::SYNCED)
|
||||
if(synced_context::get_synced_state() != synced_context::SYNCED)
|
||||
{
|
||||
/*
|
||||
enter the synced mode and do the actual movement.
|
||||
|
|
|
@ -277,7 +277,7 @@ void attack_result::do_execute()
|
|||
const unit_map::const_iterator a_ = resources::units->find(attacker_loc_);
|
||||
const unit_map::const_iterator d_ = resources::units->find(defender_loc_);
|
||||
//to get rid of an unused member varuiable warning, FIXME: find a way to 'ask' the ai wich advancement should be chosen from synced_commands.cpp .
|
||||
if(synced_context::get_syced_state() != synced_context::SYNCED) //RAII block for set_scontext_synced
|
||||
if(synced_context::get_synced_state() != synced_context::SYNCED) //RAII block for set_scontext_synced
|
||||
{
|
||||
//we don't use synced_context::run_in_synced_context because that wouldn't allow us to pass advancements_
|
||||
recorder.add_synced_command("attack", replay_helper::get_attack(attacker_loc_, defender_loc_, attacker_weapon, defender_weapon, a_->type_id(),
|
||||
|
|
|
@ -3148,7 +3148,7 @@ void console_handler::do_unit() {
|
|||
return;
|
||||
}
|
||||
if (name == "advances" ){
|
||||
if(synced_context::get_syced_state() == synced_context::SYNCED)
|
||||
if(synced_context::get_synced_state() == synced_context::SYNCED)
|
||||
{
|
||||
command_failed("unit advances=n doesn't work while another action is executed.");
|
||||
return;
|
||||
|
|
|
@ -734,7 +734,7 @@ REPLAY_RETURN do_replay_handle(int side_num)
|
|||
|
||||
for(;;) {
|
||||
const config *cfg = get_replay_source().get_next_action();
|
||||
const bool is_synced = (synced_context::get_syced_state() == synced_context::SYNCED);
|
||||
const bool is_synced = (synced_context::get_synced_state() == synced_context::SYNCED);
|
||||
|
||||
DBG_REPLAY << "in do replay with is_synced=" << is_synced << "\n";
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ std::map<int,config> mp_sync::get_user_choice_multiple_sides(const std::string &
|
|||
std::set<int> sides)
|
||||
{
|
||||
//pass sides by copy because we need a copy.
|
||||
const bool is_synced = synced_context::get_syced_state() == synced_context::SYNCED;
|
||||
const bool is_synced = synced_context::get_synced_state() == synced_context::SYNCED;
|
||||
const int max_side = static_cast<int>(resources::teams->size());
|
||||
//we currently don't check for too early because luas sync choice doesn't necessarily show screen dialogs.
|
||||
//It (currently) in the responsibility of the user of sync choice to not use dialogs during prestart events..
|
||||
|
@ -1133,7 +1133,7 @@ config mp_sync::get_user_choice(const std::string &name, const mp_sync::user_cho
|
|||
int side)
|
||||
{
|
||||
const bool is_too_early = resources::gamedata->phase() != game_data::START && resources::gamedata->phase() != game_data::PLAY;
|
||||
const bool is_synced = synced_context::get_syced_state() == synced_context::SYNCED;
|
||||
const bool is_synced = synced_context::get_synced_state() == synced_context::SYNCED;
|
||||
const bool is_mp_game = network::nconnections() != 0;//Only used in debugging output below
|
||||
const int max_side = static_cast<int>(resources::teams->size());
|
||||
const int current_side = resources::controller->current_side();
|
||||
|
|
|
@ -1435,7 +1435,7 @@ static int intf_set_village_owner(lua_State *L)
|
|||
*/
|
||||
static int intf_is_synced(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, synced_context::get_syced_state() == synced_context::SYNCED);
|
||||
lua_pushboolean(L, synced_context::get_synced_state() == synced_context::SYNCED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ static lg::log_domain log_replay("replay");
|
|||
#define ERR_REPLAY LOG_STREAM(err, log_replay)
|
||||
|
||||
|
||||
synced_context::syced_state synced_context::state_ = synced_context::UNSYNCED;
|
||||
synced_context::synced_state synced_context::state_ = synced_context::UNSYNCED;
|
||||
bool synced_context::is_simultaneously_ = false;
|
||||
|
||||
bool synced_context::run_in_synced_context(const std::string& commandname, const config& data, bool use_undo, bool show, bool store_in_replay, synced_command::error_handler_function error_handler)
|
||||
|
@ -72,7 +72,7 @@ bool synced_context::run_in_synced_context(const std::string& commandname, const
|
|||
|
||||
bool synced_context::run_in_synced_context_if_not_already(const std::string& commandname,const config& data, bool use_undo, bool show, synced_command::error_handler_function error_handler)
|
||||
{
|
||||
switch(synced_context::get_syced_state())
|
||||
switch(synced_context::get_synced_state())
|
||||
{
|
||||
case(synced_context::UNSYNCED):
|
||||
return run_in_synced_context(commandname, data, use_undo, show, true, error_handler);
|
||||
|
@ -94,7 +94,7 @@ bool synced_context::run_in_synced_context_if_not_already(const std::string& com
|
|||
}
|
||||
}
|
||||
default:
|
||||
assert(false && "found unknown synced_context::syced_state");
|
||||
assert(false && "found unknown synced_context::synced_state");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -115,12 +115,12 @@ void synced_context::ignore_error_function(const std::string& message, bool /*he
|
|||
DBG_REPLAY << "Ignored during synced execution: " << message;
|
||||
}
|
||||
|
||||
synced_context::syced_state synced_context::get_syced_state()
|
||||
synced_context::synced_state synced_context::get_synced_state()
|
||||
{
|
||||
return state_;
|
||||
}
|
||||
|
||||
void synced_context::set_syced_state(syced_state newstate)
|
||||
void synced_context::set_synced_state(synced_state newstate)
|
||||
{
|
||||
state_ = newstate;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void synced_context::reset_is_simultaneously()
|
|||
bool synced_context::can_undo()
|
||||
{
|
||||
//this method should only works in a synced context.
|
||||
assert(get_syced_state() == SYNCED);
|
||||
assert(get_synced_state() == SYNCED);
|
||||
//if we called the rng or if we sended data of this action over the network already, undoing is impossible.
|
||||
return (!is_simultaneously_) && (random_new::generator->get_random_calls() == 0);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ boost::shared_ptr<random_new::rng> synced_context::get_rng_for_action()
|
|||
|
||||
config synced_context::ask_server(const std::string &name, const mp_sync::user_choice &uch)
|
||||
{
|
||||
assert(get_syced_state() == synced_context::SYNCED);
|
||||
assert(get_synced_state() == synced_context::SYNCED);
|
||||
|
||||
int current_side = resources::controller->current_side();
|
||||
int side = current_side;
|
||||
|
@ -365,9 +365,9 @@ void set_scontext_synced::init()
|
|||
{
|
||||
|
||||
LOG_REPLAY << "set_scontext_synced::set_scontext_synced\n";
|
||||
assert(synced_context::get_syced_state() == synced_context::UNSYNCED);
|
||||
assert(synced_context::get_synced_state() == synced_context::UNSYNCED);
|
||||
|
||||
synced_context::set_syced_state(synced_context::SYNCED);
|
||||
synced_context::set_synced_state(synced_context::SYNCED);
|
||||
synced_context::reset_is_simultaneously();
|
||||
|
||||
old_checkup_ = checkup_instance;
|
||||
|
@ -378,7 +378,7 @@ void set_scontext_synced::init()
|
|||
set_scontext_synced::~set_scontext_synced()
|
||||
{
|
||||
LOG_REPLAY << "set_scontext_synced:: destructor\n";
|
||||
assert(synced_context::get_syced_state() == synced_context::SYNCED);
|
||||
assert(synced_context::get_synced_state() == synced_context::SYNCED);
|
||||
assert(checkup_instance == &new_checkup_);
|
||||
config co;
|
||||
if(!checkup_instance->local_checkup(config_of("random_calls", new_rng_->get_random_calls()), co))
|
||||
|
@ -389,7 +389,7 @@ set_scontext_synced::~set_scontext_synced()
|
|||
}
|
||||
|
||||
random_new::generator = old_rng_;
|
||||
synced_context::set_syced_state(synced_context::UNSYNCED);
|
||||
synced_context::set_synced_state(synced_context::UNSYNCED);
|
||||
|
||||
checkup_instance = old_checkup_;
|
||||
}
|
||||
|
@ -403,8 +403,8 @@ int set_scontext_synced::get_random_calls()
|
|||
set_scontext_local_choice::set_scontext_local_choice()
|
||||
{
|
||||
|
||||
assert(synced_context::get_syced_state() == synced_context::SYNCED);
|
||||
synced_context::set_syced_state(synced_context::LOCAL_CHOICE);
|
||||
assert(synced_context::get_synced_state() == synced_context::SYNCED);
|
||||
synced_context::set_synced_state(synced_context::LOCAL_CHOICE);
|
||||
|
||||
|
||||
old_rng_ = random_new::generator;
|
||||
|
@ -414,20 +414,20 @@ set_scontext_local_choice::set_scontext_local_choice()
|
|||
}
|
||||
set_scontext_local_choice::~set_scontext_local_choice()
|
||||
{
|
||||
assert(synced_context::get_syced_state() == synced_context::LOCAL_CHOICE);
|
||||
synced_context::set_syced_state(synced_context::SYNCED);
|
||||
assert(synced_context::get_synced_state() == synced_context::LOCAL_CHOICE);
|
||||
synced_context::set_synced_state(synced_context::SYNCED);
|
||||
delete random_new::generator;
|
||||
random_new::generator = old_rng_;
|
||||
}
|
||||
|
||||
set_scontext_leave_for_draw::set_scontext_leave_for_draw()
|
||||
: previous_state_(synced_context::get_syced_state())
|
||||
: previous_state_(synced_context::get_synced_state())
|
||||
{
|
||||
if(previous_state_ != synced_context::SYNCED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
synced_context::set_syced_state(synced_context::LOCAL_CHOICE);
|
||||
synced_context::set_synced_state(synced_context::LOCAL_CHOICE);
|
||||
|
||||
|
||||
old_rng_ = random_new::generator;
|
||||
|
@ -441,8 +441,8 @@ set_scontext_leave_for_draw::~set_scontext_leave_for_draw()
|
|||
{
|
||||
return;
|
||||
}
|
||||
assert(synced_context::get_syced_state() == synced_context::LOCAL_CHOICE);
|
||||
synced_context::set_syced_state(synced_context::SYNCED);
|
||||
assert(synced_context::get_synced_state() == synced_context::LOCAL_CHOICE);
|
||||
synced_context::set_synced_state(synced_context::SYNCED);
|
||||
delete random_new::generator;
|
||||
random_new::generator = old_rng_;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class config;
|
|||
class synced_context
|
||||
{
|
||||
public:
|
||||
enum syced_state {UNSYNCED, SYNCED, LOCAL_CHOICE};
|
||||
enum synced_state {UNSYNCED, SYNCED, LOCAL_CHOICE};
|
||||
/**
|
||||
|
||||
Sets the context to 'synced', initialises random context, and calls the given function.
|
||||
|
@ -64,11 +64,11 @@ public:
|
|||
/*
|
||||
Returns whether we are currently executing a synced action like recruit, start, recall, disband, movement, attack, init_side, end_turn, fire_event, lua_ai, auto_shroud or similar.
|
||||
*/
|
||||
static syced_state get_syced_state();
|
||||
static synced_state get_synced_state();
|
||||
/*
|
||||
should only be called form set_scontext_synced, set_scontext_local_choice
|
||||
*/
|
||||
static void set_syced_state(syced_state newstate);
|
||||
static void set_synced_state(synced_state newstate);
|
||||
/*
|
||||
Generates a new seed for a synced event, by asking the 'server'
|
||||
*/
|
||||
|
@ -113,7 +113,7 @@ private:
|
|||
/*
|
||||
weather we are in a synced move, in a user_choice, or none of them
|
||||
*/
|
||||
static syced_state state_;
|
||||
static synced_state state_;
|
||||
/*
|
||||
As soon as get_user_choice is used with side != current_side (for example in generate_random_seed) other sides execute the command simultaneously and is_simultaneously is set to true.
|
||||
It's impossible to undo data that has been sended over the network.
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
~set_scontext_leave_for_draw();
|
||||
private:
|
||||
random_new::rng* old_rng_;
|
||||
synced_context::syced_state previous_state_;
|
||||
synced_context::synced_state previous_state_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue