mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-30 13:27:40 +00:00
Fixed compilation warning.
This commit is contained in:
parent
9a62974479
commit
46ab9253dd
@ -53,7 +53,7 @@ static void get_global_variable(persist_context &ctx, const vconfig &pcfg)
|
||||
std::string local = pcfg["to_local"];
|
||||
t_string side_string = pcfg["side"];
|
||||
int side = lexical_cast_default<int>(pcfg["side"],resources::controller->current_side());
|
||||
if ((side <= 0) || (side > resources::teams->size()))
|
||||
if (unsigned(side - 1) >= resources::teams->size())
|
||||
side = resources::controller->current_side();
|
||||
persist_choice choice(ctx,global,side);
|
||||
config cfg = mp_sync::get_user_choice("global_variable",choice,side).child("variables");
|
||||
@ -74,7 +74,7 @@ static void get_global_variable(persist_context &ctx, const vconfig &pcfg)
|
||||
static void clear_global_variable(persist_context &ctx, const vconfig &pcfg)
|
||||
{
|
||||
int side = lexical_cast_default<int>(pcfg["side"],resources::controller->current_side());
|
||||
if ((side <= 0) || (side > resources::teams->size()))
|
||||
if (unsigned(side - 1) >= resources::teams->size())
|
||||
side = resources::controller->current_side();
|
||||
if ((*resources::teams)[side - 1].is_local()) {
|
||||
std::string global = pcfg["global"];
|
||||
@ -85,7 +85,7 @@ static void clear_global_variable(persist_context &ctx, const vconfig &pcfg)
|
||||
static void set_global_variable(persist_context &ctx, const vconfig &pcfg)
|
||||
{
|
||||
int side = lexical_cast_default<int>(pcfg["side"],resources::controller->current_side());
|
||||
if ((side <= 0) || (side > resources::teams->size()))
|
||||
if (unsigned(side - 1) >= resources::teams->size())
|
||||
side = resources::controller->current_side();
|
||||
if ((*resources::teams)[side - 1].is_local()) {
|
||||
if (pcfg["from_local"].empty()) {
|
||||
@ -129,7 +129,7 @@ void verify_and_get_global_variable(const vconfig &pcfg)
|
||||
}
|
||||
else {
|
||||
int side = lexical_cast_default<int>(pcfg["side"],resources::controller->current_side());
|
||||
if ((side <= 0) || (side > resources::teams->size()))
|
||||
if (unsigned(side - 1) >= resources::teams->size())
|
||||
side = resources::controller->current_side();
|
||||
if ((side != resources::controller->current_side())
|
||||
&& !((*resources::teams)[side - 1].is_local())) {
|
||||
|
@ -1142,7 +1142,7 @@ bool do_replay_handle(int side_num, const std::string &do_untill)
|
||||
get_replay_source().add_expected_advancement(loc);
|
||||
DBG_REPLAY << "got an explicit advance\n";
|
||||
|
||||
} else if (const config &child = cfg->child("global_variable")) {
|
||||
} else if (cfg->child("global_variable")) {
|
||||
} else {
|
||||
if(! cfg->child("checksum")) {
|
||||
replay::process_error("unrecognized action:\n" + cfg->debug());
|
||||
@ -1210,7 +1210,7 @@ config mp_sync::get_user_choice(const std::string &name, const user_choice &uch,
|
||||
one host and shared amongst all of them. */
|
||||
|
||||
/* process the side parameter and ensure it is within boundaries */
|
||||
if ((side <= 0) || (side > resources::teams->size()))
|
||||
if (unsigned(side - 1) >= resources::teams->size())
|
||||
side = resources::controller->current_side();
|
||||
|
||||
int active_side = side;
|
||||
|
Loading…
x
Reference in New Issue
Block a user