Use std::to_string() or equivalent wherever possible
This commit removes the utility srt_cast() function and replaces its calls, along with calls to lexical_cast<std::string>() (and its boost variant), with std::to_string(). In a few cases where the input type isn't compatible with to_string, lexical_cast<std::string> is still used. In other cases where lexical_cast was operating on MAKE_ENUM enums, the call has been replaced with ENUM::enum_to_string, which is faster.
This commit is contained in:
parent
531f391ad8
commit
876710af8c
79 changed files with 177 additions and 183 deletions
|
@ -1115,8 +1115,8 @@ namespace { // Private helpers for move_unit()
|
|||
// Create the message to display (depends on whether friends,
|
||||
// enemies, or both were sighted, and on how many of each).
|
||||
utils::string_map symbols;
|
||||
symbols["enemies"] = lexical_cast<std::string>(enemy_count_);
|
||||
symbols["friends"] = lexical_cast<std::string>(friend_count_);
|
||||
symbols["enemies"] = std::to_string(enemy_count_);
|
||||
symbols["friends"] = std::to_string(friend_count_);
|
||||
std::string message;
|
||||
SDL_Color msg_color;
|
||||
if ( friend_count_ != 0 && enemy_count_ != 0 ) {
|
||||
|
|
|
@ -51,7 +51,7 @@ addons_client::addons_client(CVideo& v, const std::string& address)
|
|||
// FIXME: this parsing will break IPv6 numeric addresses! */
|
||||
host_ = address_components[0];
|
||||
port_ = address_components.size() == 2 ?
|
||||
address_components[1] : str_cast(default_campaignd_port);
|
||||
address_components[1] : std::to_string(default_campaignd_port);
|
||||
}
|
||||
|
||||
void addons_client::connect()
|
||||
|
|
|
@ -708,7 +708,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
const std::string& display_sep = sep;
|
||||
const std::string& display_size = size_display_string(addon.size);
|
||||
const std::string& display_type = addon.display_type();
|
||||
const std::string& display_down = str_cast(addon.downloads);
|
||||
const std::string& display_down = std::to_string(addon.downloads);
|
||||
const std::string& display_icon = addon.display_icon();
|
||||
const std::string& display_status = describe_addon_status(tracking[addon.id]);
|
||||
|
||||
|
|
|
@ -403,9 +403,9 @@ class lua_aspect_visitor : public boost::static_visitor<std::string> {
|
|||
static std::string quote_string(const std::string& s);
|
||||
public:
|
||||
std::string operator()(bool b) const {return b ? "true" : "false";}
|
||||
std::string operator()(int i) const {return str_cast(i);}
|
||||
std::string operator()(unsigned long long i) const {return str_cast(i);}
|
||||
std::string operator()(double i) const {return str_cast(i);}
|
||||
std::string operator()(int i) const {return std::to_string(i);}
|
||||
std::string operator()(unsigned long long i) const {return std::to_string(i);}
|
||||
std::string operator()(double i) const {return std::to_string(i);}
|
||||
std::string operator()(const std::string& s) const {return quote_string(s);}
|
||||
std::string operator()(const t_string& s) const {return quote_string(s.str());}
|
||||
std::string operator()(boost::blank) const {return "nil";}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
static void value_to_cfg(const T &value, config &cfg)
|
||||
{
|
||||
cfg["value"] = str_cast(value);
|
||||
cfg["value"] = lexical_cast<std::string>(value);
|
||||
}
|
||||
|
||||
static config value_to_cfg(const T &value)
|
||||
|
|
|
@ -117,7 +117,7 @@ void formula_ai::handle_exception(game_logic::formula_error& e, const std::strin
|
|||
//if line number = 0, don't display info about filename and line number
|
||||
if (e.line != 0) {
|
||||
LOG_AI << e.type << " in " << e.filename << ":" << e.line << std::endl;
|
||||
display_message(e.type + " in " + e.filename + ":" + boost::lexical_cast<std::string>(e.line));
|
||||
display_message(e.type + " in " + e.filename + ":" + std::to_string(e.line));
|
||||
} else {
|
||||
LOG_AI << e.type << std::endl;
|
||||
display_message(e.type);
|
||||
|
|
|
@ -76,7 +76,7 @@ bool stage_unit_formulas::do_play_stage()
|
|||
} catch(game_logic::formula_error& e) {
|
||||
if(e.filename == "formula")
|
||||
e.line = 0;
|
||||
fai_.handle_exception( e, "Unit priority formula error for unit: '" + i->type_id() + "' standing at (" + str_cast(i->get_location().x + 1) + "," + str_cast(i->get_location().y + 1) + ")");
|
||||
fai_.handle_exception( e, "Unit priority formula error for unit: '" + i->type_id() + "' standing at (" + std::to_string(i->get_location().x + 1) + "," + std::to_string(i->get_location().y + 1) + ")");
|
||||
|
||||
priority = 0;
|
||||
} catch(type_error& e) {
|
||||
|
@ -112,7 +112,7 @@ bool stage_unit_formulas::do_play_stage()
|
|||
if(e.filename == "formula") {
|
||||
e.line = 0;
|
||||
}
|
||||
fai_.handle_exception( e, "Unit formula error for unit: '" + i->type_id() + "' standing at (" + str_cast(i->get_location().x + 1) + "," + str_cast(i->get_location().y + 1) + ")");
|
||||
fai_.handle_exception( e, "Unit formula error for unit: '" + i->type_id() + "' standing at (" + std::to_string(i->get_location().x + 1) + "," + std::to_string(i->get_location().y + 1) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ bool stage_unit_formulas::do_play_stage()
|
|||
if (e.filename == "formula") {
|
||||
e.line = 0;
|
||||
}
|
||||
fai_.handle_exception( e, "Unit loop formula error for unit: '" + i->type_id() + "' standing at (" + str_cast(i->get_location().x + 1) + "," + str_cast(i->get_location().y + 1) + ")");
|
||||
fai_.handle_exception( e, "Unit loop formula error for unit: '" + i->type_id() + "' standing at (" + std::to_string(i->get_location().x + 1) + "," + std::to_string(i->get_location().y + 1) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ config holder::to_config() const
|
|||
|
||||
const std::string holder::describe_ai()
|
||||
{
|
||||
std::string sidestr = lexical_cast<std::string>(this->side_);
|
||||
std::string sidestr = std::to_string(this->side_);
|
||||
|
||||
if (this->ai_!=NULL) {
|
||||
return this->ai_->describe_self()+std::string(" for side ")+sidestr+std::string(" : ");
|
||||
|
@ -575,9 +575,9 @@ const std::string manager::internal_evaluate_command( side_number side, const st
|
|||
side_number side = lexical_cast<side_number>(cmd.at(1));
|
||||
std::string file = cmd.at(2);
|
||||
if (add_ai_for_side_from_file(side,file,false)){
|
||||
return std::string("AI MANAGER: added [")+manager::get_active_ai_identifier_for_side(side)+std::string("] AI for side ")+lexical_cast<std::string>(side)+std::string(" from file ")+file;
|
||||
return std::string("AI MANAGER: added [")+manager::get_active_ai_identifier_for_side(side)+std::string("] AI for side ")+std::to_string(side)+std::string(" from file ")+file;
|
||||
} else {
|
||||
return std::string("AI MANAGER: failed attempt to add AI for side ")+lexical_cast<std::string>(side)+std::string(" from file ")+file;
|
||||
return std::string("AI MANAGER: failed attempt to add AI for side ")+std::to_string(side)+std::string(" from file ")+file;
|
||||
}
|
||||
}
|
||||
//!replace_ai side file
|
||||
|
@ -585,9 +585,9 @@ const std::string manager::internal_evaluate_command( side_number side, const st
|
|||
side_number side = lexical_cast<side_number>(cmd.at(1));
|
||||
std::string file = cmd.at(2);
|
||||
if (add_ai_for_side_from_file(side,file,true)){
|
||||
return std::string("AI MANAGER: added [")+manager::get_active_ai_identifier_for_side(side)+std::string("] AI for side ")+lexical_cast<std::string>(side)+std::string(" from file ")+file;
|
||||
return std::string("AI MANAGER: added [")+manager::get_active_ai_identifier_for_side(side)+std::string("] AI for side ")+std::to_string(side)+std::string(" from file ")+file;
|
||||
} else {
|
||||
return std::string("AI MANAGER: failed attempt to add AI for side ")+lexical_cast<std::string>(side)+std::string(" from file ")+file;
|
||||
return std::string("AI MANAGER: failed attempt to add AI for side ")+std::to_string(side)+std::string(" from file ")+file;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ const std::string manager::internal_evaluate_command( side_number side, const st
|
|||
if (cmd.at(0)=="!remove_ai"){
|
||||
side_number side = lexical_cast<side_number>(cmd.at(1));
|
||||
remove_ai_for_side(side);
|
||||
return std::string("AI MANAGER: made an attempt to remove AI for side ")+lexical_cast<std::string>(side);
|
||||
return std::string("AI MANAGER: made an attempt to remove AI for side ")+std::to_string(side);
|
||||
}
|
||||
if (cmd.at(0)=="!"){
|
||||
//this command should not be recorded in history
|
||||
|
|
|
@ -83,7 +83,7 @@ void ai_testing::log_victory(std::set<unsigned int> winners)
|
|||
resources::recorder->add_log_data("ai_log","result","victory");
|
||||
for(std::set<unsigned int>::const_iterator w = winners.begin(); w != winners.end(); ++w) {
|
||||
LOG_AI_TESTING << "WINNER: "<< *w <<std::endl;
|
||||
resources::recorder->add_log_data("ai_log","winner",str_cast(*w));
|
||||
resources::recorder->add_log_data("ai_log","winner",std::to_string(*w));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void ai_testing::log_game_start()
|
|||
int side = tm-resources::teams->begin()+1;
|
||||
LOG_AI_TESTING << "AI_IDENTIFIER"<<side<<": " << ai::manager::get_active_ai_identifier_for_side(side) <<std::endl;
|
||||
LOG_AI_TESTING << "TEAM"<<side<<": " << tm->side() << std::endl;
|
||||
resources::recorder->add_log_data("ai_log","ai_id"+str_cast(side),ai::manager::get_active_ai_identifier_for_side(side));
|
||||
resources::recorder->add_log_data("ai_log","ai_id"+std::to_string(side),ai::manager::get_active_ai_identifier_for_side(side));
|
||||
///@todo 1.9: add information about ai_config
|
||||
}
|
||||
LOG_AI_TESTING << "VERSION: " << game_config::revision << std::endl;
|
||||
|
@ -104,10 +104,10 @@ void ai_testing::log_game_end()
|
|||
{
|
||||
LOG_AI_TESTING << "GAME_END_TURN: "<< resources::tod_manager->turn() <<std::endl;
|
||||
resources::recorder->add_log_data("ai_log","end_turn",
|
||||
str_cast(resources::tod_manager->turn()));
|
||||
std::to_string(resources::tod_manager->turn()));
|
||||
for (std::vector<team>::const_iterator tm = resources::teams->begin(); tm != resources::teams->end(); ++tm) {
|
||||
int side = tm-resources::teams->begin()+1;
|
||||
resources::recorder->add_log_data("ai_log","end_gold"+str_cast(side),str_cast(tm->gold()));
|
||||
resources::recorder->add_log_data("ai_log","end_units"+str_cast(side),str_cast(resources::gameboard->side_units(side)));
|
||||
resources::recorder->add_log_data("ai_log","end_gold"+std::to_string(side),std::to_string(tm->gold()));
|
||||
resources::recorder->add_log_data("ai_log","end_units"+std::to_string(side),std::to_string(resources::gameboard->side_units(side)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ std::string carryover::get_recruits(bool erase){
|
|||
|
||||
const std::string carryover::to_string(){
|
||||
std::string side = "";
|
||||
side.append("Side " + save_id_ + ": gold " + str_cast<int>(gold_) + " recruits " + get_recruits(false) + " units ");
|
||||
side.append("Side " + save_id_ + ": gold " + std::to_string(gold_) + " recruits " + get_recruits(false) + " units ");
|
||||
BOOST_FOREACH(const config & u_cfg, recall_list_) {
|
||||
side.append(u_cfg["name"].str() + ", ");
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ std::string rgb2highlight_pango(Uint32 rgb)
|
|||
int color_range::index() const
|
||||
{
|
||||
for(int i = 1; i <= gamemap::MAX_PLAYERS; ++i) {
|
||||
if(*this==(game_config::color_info(lexical_cast<std::string>(i)))) {
|
||||
if(*this==(game_config::color_info(std::to_string(i)))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,9 +326,9 @@ public:
|
|||
std::string operator()(const boost::blank &) const { return std::string(); }
|
||||
std::string operator()(const yes_no & b) const { return b.str(); }
|
||||
std::string operator()(const true_false & b) const { return b.str(); }
|
||||
std::string operator()(int i) const { return str_cast(i); }
|
||||
std::string operator()(unsigned long long u) const { return str_cast(u); }
|
||||
std::string operator()(double d) const { return str_cast(d); }
|
||||
std::string operator()(int i) const { return std::to_string(i); }
|
||||
std::string operator()(unsigned long long u) const { return std::to_string(u); }
|
||||
std::string operator()(double d) const { return std::to_string(d); }
|
||||
std::string operator()(std::string const &s) const { return s; }
|
||||
std::string operator()(t_string const &s) const { return s.str(); }
|
||||
};
|
||||
|
|
|
@ -151,7 +151,7 @@ void editor_display::draw_sidebar()
|
|||
text = get_map().get_terrain_editor_string(mouseoverHex_);
|
||||
refresh_report("terrain", &element);
|
||||
refresh_report("terrain_info");
|
||||
text = str_cast(mouseoverHex_);
|
||||
text = lexical_cast<std::string>(mouseoverHex_);
|
||||
refresh_report("position", &element);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace editor {
|
|||
}
|
||||
|
||||
void set_auto_update_transitions(int value) {
|
||||
preferences::set("editor_auto_update_transitions", lexical_cast<std::string>(value));
|
||||
preferences::set("editor_auto_update_transitions", std::to_string(value));
|
||||
}
|
||||
|
||||
std::string default_dir() {
|
||||
|
@ -67,19 +67,19 @@ namespace editor {
|
|||
void set_tod_r(int value)
|
||||
{
|
||||
normalize_editor_rgb(value);
|
||||
preferences::set("editor_r",lexical_cast<std::string>(value));
|
||||
preferences::set("editor_r",std::to_string(value));
|
||||
}
|
||||
|
||||
void set_tod_g(int value)
|
||||
{
|
||||
normalize_editor_rgb(value);
|
||||
preferences::set("editor_g",lexical_cast<std::string>(value));
|
||||
preferences::set("editor_g",std::to_string(value));
|
||||
}
|
||||
|
||||
void set_tod_b(int value)
|
||||
{
|
||||
normalize_editor_rgb(value);
|
||||
preferences::set("editor_b",lexical_cast<std::string>(value));
|
||||
preferences::set("editor_b",std::to_string(value));
|
||||
}
|
||||
|
||||
int tod_r()
|
||||
|
|
|
@ -305,7 +305,7 @@ void context_manager::expand_open_maps_menu(std::vector<std::string>& items)
|
|||
else
|
||||
filename = _("(New Scenario)");
|
||||
}
|
||||
std::string label = "[" + lexical_cast<std::string>(mci) + "] "
|
||||
std::string label = "[" + std::to_string(mci) + "] "
|
||||
+ filename + (changed ? " [*]" : "");
|
||||
if (map_contexts_[mci]->is_embedded()) {
|
||||
label += " (E)";
|
||||
|
|
|
@ -153,7 +153,7 @@ std::set<map_location> editor_map::set_starting_position_labels(display& disp)
|
|||
label += " ";
|
||||
for (int i = 0, size = starting_positions_.size(); i < size; ++i) {
|
||||
if (starting_positions_[i].valid()) {
|
||||
disp.labels().set_label(starting_positions_[i], label + lexical_cast<std::string>(i + 1));
|
||||
disp.labels().set_label(starting_positions_[i], label + std::to_string(i + 1));
|
||||
label_locs.insert(starting_positions_[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@ variant unit_type_callable::get_value(const std::string& key) const
|
|||
} else if(key == "type") {
|
||||
return variant(u_.type_name());
|
||||
} else if(key == "alignment") {
|
||||
return variant(lexical_cast<std::string>(u_.alignment()));
|
||||
return variant(unit_type::ALIGNMENT::enum_to_string(u_.alignment()));
|
||||
} else if(key == "race") {
|
||||
return variant(u_.race_id());
|
||||
} else if(key == "abilities") {
|
||||
|
|
|
@ -1049,7 +1049,7 @@ void variant::serialize_to_string(std::string& str) const
|
|||
str += "null()";
|
||||
break;
|
||||
case TYPE_INT:
|
||||
str += boost::lexical_cast<std::string>(int_value_);
|
||||
str += std::to_string(int_value_);
|
||||
break;
|
||||
case TYPE_DECIMAL: {
|
||||
std::ostringstream s;
|
||||
|
@ -1168,7 +1168,7 @@ std::string variant::string_cast() const
|
|||
case TYPE_NULL:
|
||||
return "0";
|
||||
case TYPE_INT:
|
||||
return boost::lexical_cast<std::string>(int_value_);
|
||||
return std::to_string(int_value_);
|
||||
case TYPE_DECIMAL: {
|
||||
std::ostringstream s;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void game_board::check_victory(bool & continue_level, bool & found_player, bool
|
|||
{
|
||||
DBG_EE << "Found a unit: " << i.id() << " on side " << i.side() << std::endl;
|
||||
const team& tm = teams()[i.side()-1];
|
||||
DBG_EE << "That team's defeat condition is: " << lexical_cast<std::string> (tm.defeat_condition()) << std::endl;
|
||||
DBG_EE << "That team's defeat condition is: " << tm.defeat_condition() << std::endl;
|
||||
if (i.can_recruit() && tm.defeat_condition() == team::DEFEAT_CONDITION::NO_LEADER) {
|
||||
not_defeated.insert(i.side());
|
||||
} else if (tm.defeat_condition() == team::DEFEAT_CONDITION::NO_UNITS) {
|
||||
|
@ -207,10 +207,10 @@ void game_board::side_drop_to(int side_num, team::CONTROLLER ctrl, team::PROXY_C
|
|||
tm.change_proxy(proxy);
|
||||
tm.set_local(true);
|
||||
|
||||
tm.set_current_player(lexical_cast<std::string> (ctrl) + lexical_cast<std::string> (side_num));
|
||||
tm.set_current_player(team::CONTROLLER::enum_to_string(ctrl) + std::to_string(side_num));
|
||||
|
||||
unit_map::iterator leader = units_.find_leader(side_num);
|
||||
if (leader.valid()) leader->rename(lexical_cast<std::string> (ctrl) + lexical_cast<std::string> (side_num));
|
||||
if (leader.valid()) leader->rename(team::CONTROLLER::enum_to_string(ctrl) + std::to_string(side_num));
|
||||
}
|
||||
|
||||
void game_board::side_change_controller(int side_num, bool is_local, const std::string& pname) {
|
||||
|
@ -349,7 +349,7 @@ void game_board::write_config(config & cfg) const
|
|||
config& side = cfg.add_child("side");
|
||||
t->write(side);
|
||||
side["no_leader"] = true;
|
||||
side["side"] = str_cast(side_num);
|
||||
side["side"] = std::to_string(side_num);
|
||||
|
||||
//current units
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ config game_classification::to_config() const
|
|||
|
||||
cfg["label"] = label;
|
||||
cfg["version"] = game_config::version;
|
||||
cfg["campaign_type"] = lexical_cast<std::string> (campaign_type);
|
||||
cfg["campaign_type"] = game_classification::CAMPAIGN_TYPE::enum_to_string(campaign_type);
|
||||
cfg["campaign_define"] = campaign_define;
|
||||
cfg["campaign_extra_defines"] = utils::join(campaign_xtra_defines);
|
||||
cfg["scenario_define"] = scenario_define;
|
||||
|
@ -106,7 +106,7 @@ config game_classification::to_config() const
|
|||
cfg["abbrev"] = abbrev;
|
||||
cfg["end_credits"] = end_credits;
|
||||
cfg["end_text"] = end_text;
|
||||
cfg["end_text_duration"] = str_cast<unsigned int>(end_text_duration);
|
||||
cfg["end_text_duration"] = std::to_string(end_text_duration);
|
||||
cfg["difficulty"] = difficulty;
|
||||
cfg["random_mode"] = random_mode;
|
||||
cfg["oos_debug"] = oos_debug;
|
||||
|
|
|
@ -446,7 +446,7 @@ void game_display::draw_hex(const map_location& loc)
|
|||
if(game_config::debug) {
|
||||
int debugH = debugHighlights_[loc];
|
||||
if (debugH) {
|
||||
std::string txt = lexical_cast<std::string>(debugH);
|
||||
std::string txt = std::to_string(debugH);
|
||||
draw_text_in_hex(loc, LAYER_MOVE_INFO, txt, 18, font::BAD_COLOR);
|
||||
}
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ void game_display::draw_movement_info(const map_location& loc)
|
|||
if (!reach_map_.empty()) {
|
||||
reach_map::iterator reach = reach_map_.find(loc);
|
||||
if (reach != reach_map_.end() && reach->second > 1) {
|
||||
const std::string num = lexical_cast<std::string>(reach->second);
|
||||
const std::string num = std::to_string(reach->second);
|
||||
draw_text_in_hex(loc, LAYER_MOVE_INFO, num, 16, font::YELLOW_COLOR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ connect_engine::connect_engine(saved_game& state,
|
|||
std::string team_prefix(std::string(_("Team")) + " ");
|
||||
int side_count = 1;
|
||||
BOOST_FOREACH(config& side, sides) {
|
||||
const std::string side_str = lexical_cast<std::string>(side_count);
|
||||
const std::string side_str = std::to_string(side_count);
|
||||
config::attribute_value& team_name = side["team_name"];
|
||||
config::attribute_value& user_team_name =
|
||||
side["user_team_name"];
|
||||
|
@ -146,9 +146,9 @@ connect_engine::connect_engine(saved_game& state,
|
|||
original_team_names.push_back(team_name);
|
||||
|
||||
team_name = "Team " +
|
||||
lexical_cast<std::string>(original_team_names.size());
|
||||
std::to_string(original_team_names.size());
|
||||
} else {
|
||||
team_name = "Team " + lexical_cast<std::string>(
|
||||
team_name = "Team " + std::to_string(
|
||||
name_itor - original_team_names.begin() + 1);
|
||||
} // Note that the prefix "Team " is untranslatable, as team_name is not meant to be translated. This is needed so that the attribute
|
||||
// is not interpretted as an int when reading from config, which causes bugs later.
|
||||
|
@ -892,7 +892,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
|||
}
|
||||
if(!parent_.params_.saved_game && cfg_["save_id"].str().empty()) {
|
||||
assert(cfg_["id"].empty()); // we already setted "save_id" to "id" if "id" existed.
|
||||
cfg_["save_id"] = parent_.scenario()["id"].str() + "_" + lexical_cast<std::string>(index);
|
||||
cfg_["save_id"] = parent_.scenario()["id"].str() + "_" + std::to_string(index);
|
||||
}
|
||||
|
||||
update_controller_options();
|
||||
|
@ -1365,7 +1365,7 @@ std::string side_engine::get_color(int index) const
|
|||
}
|
||||
index -= 1;
|
||||
}
|
||||
return lexical_cast<std::string>(index + 1);
|
||||
return std::to_string(index + 1);
|
||||
}
|
||||
|
||||
int side_engine::num_colors() const
|
||||
|
|
|
@ -209,7 +209,7 @@ void scenario::set_sides()
|
|||
pos < map_positions; ++pos) {
|
||||
config& side = data_.add_child("side");
|
||||
side["side"] = pos + 1;
|
||||
side["team_name"] = "Team " + lexical_cast<std::string>(pos + 1);
|
||||
side["team_name"] = "Team " + std::to_string(pos + 1);
|
||||
side["canrecruit"] = true;
|
||||
side["controller"] = "human";
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ void create_engine::init_all_levels()
|
|||
// Stand-alone scenarios.
|
||||
BOOST_FOREACH(const config &data,
|
||||
game_config_manager::get()->game_config().child_range(
|
||||
lexical_cast<std::string> (game_classification::CAMPAIGN_TYPE::MULTIPLAYER)))
|
||||
std::to_string (game_classification::CAMPAIGN_TYPE::MULTIPLAYER)))
|
||||
{
|
||||
if (!data["allow_new_game"].to_bool(true))
|
||||
continue;
|
||||
|
|
|
@ -75,11 +75,11 @@ connect::side::side(connect& parent, ng::side_engine_ptr engine) :
|
|||
color_lock_(engine_->cfg()["color_lock"].to_bool(
|
||||
parent_->force_lock_settings())),
|
||||
changed_(false),
|
||||
label_player_number_(parent.video(), str_cast(engine_->index() + 1),
|
||||
label_player_number_(parent.video(), std::to_string(engine_->index() + 1),
|
||||
font::SIZE_LARGE, font::LOBBY_COLOR),
|
||||
label_original_controller_(parent.video(), engine_->reserved_for(),
|
||||
font::SIZE_SMALL),
|
||||
label_gold_(parent.video(), str_cast(engine_->gold()), font::SIZE_SMALL, font::LOBBY_COLOR),
|
||||
label_gold_(parent.video(), std::to_string(engine_->gold()), font::SIZE_SMALL, font::LOBBY_COLOR),
|
||||
label_income_(parent.video(), get_income_string(engine_->income()), font::SIZE_SMALL,
|
||||
font::LOBBY_COLOR),
|
||||
combo_controller_(new gui::combo_drag(parent.video(),
|
||||
|
@ -220,7 +220,7 @@ void connect::side::process_event()
|
|||
if (slider_gold_.value() != engine_->gold() && slider_gold_.enabled()) {
|
||||
engine_->set_gold(slider_gold_.value());
|
||||
changed_ = true;
|
||||
label_gold_.set_text(str_cast(engine_->gold()));
|
||||
label_gold_.set_text(std::to_string(engine_->gold()));
|
||||
}
|
||||
if (slider_income_.value() != engine_->income() && slider_income_.enabled()) {
|
||||
engine_->set_income(slider_income_.value());
|
||||
|
@ -250,7 +250,7 @@ void connect::side::update_ui()
|
|||
combo_team_.set_selected(engine_->team());
|
||||
combo_color_.set_selected(engine_->color());
|
||||
slider_gold_.set_value(engine_->gold());
|
||||
label_gold_.set_text(str_cast(engine_->gold()));
|
||||
label_gold_.set_text(std::to_string(engine_->gold()));
|
||||
slider_income_.set_value(engine_->income());
|
||||
std::stringstream buf;
|
||||
if (engine_->income() < 0) {
|
||||
|
|
|
@ -620,8 +620,8 @@ void gamebrowser::populate_game_item_map_info(gamebrowser::game_item & item, con
|
|||
// Parsing the map and generating the minimap are both cpu expensive
|
||||
gamemap map(boost::make_shared<terrain_type_data>(game_config), item.map_data);
|
||||
item.mini_map = image::getMinimap(minimap_size_, minimap_size_, map, 0);
|
||||
item.map_info_size = str_cast(map.w()) + utils::unicode_multiplication_sign
|
||||
+ str_cast(map.h());
|
||||
item.map_info_size = std::to_string(map.w()) + utils::unicode_multiplication_sign
|
||||
+ std::to_string(map.h());
|
||||
}
|
||||
} catch (incorrect_map_format_error &e) {
|
||||
ERR_CF << "illegal map: " << e.message << '\n';
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace mp {
|
|||
std::string get_color_string(int id)
|
||||
{
|
||||
std::string prefix = team::get_side_highlight(id);
|
||||
std::map<std::string, t_string>::iterator name = game_config::team_rgb_name.find(str_cast(id + 1));
|
||||
std::map<std::string, t_string>::iterator name = game_config::team_rgb_name.find(std::to_string(id + 1));
|
||||
if(name != game_config::team_rgb_name.end()){
|
||||
return prefix + name->second;
|
||||
}else{
|
||||
|
|
|
@ -372,7 +372,7 @@ void wait::join_game(bool observe)
|
|||
|
||||
const int faction_choice = gui::show_dialog(video(), NULL,
|
||||
_("Choose your faction:"), _("Starting position: ") +
|
||||
lexical_cast<std::string>(side_num + 1), gui::OK_CANCEL,
|
||||
std::to_string(side_num + 1), gui::OK_CANCEL,
|
||||
&choices, &preview_panes);
|
||||
if(faction_choice < 0) {
|
||||
set_result(QUIT);
|
||||
|
|
|
@ -817,7 +817,7 @@ int village_support()
|
|||
|
||||
void set_village_support(int value)
|
||||
{
|
||||
preferences::set("mp_village_support", lexical_cast<std::string>(value));
|
||||
preferences::set("mp_village_support", std::to_string(value));
|
||||
}
|
||||
|
||||
int xp_modifier()
|
||||
|
|
|
@ -211,7 +211,7 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
for(size_t i = 0; i < board_.teams_.size(); i++) {
|
||||
// Labels from players in your ignore list default to hidden
|
||||
if(preferences::is_ignored(board_.teams_[i].current_player())) {
|
||||
std::string label_cat = "side:" + str_cast(i + 1);
|
||||
std::string label_cat = "side:" + std::to_string(i + 1);
|
||||
board_.hidden_label_categories_ref().push_back(label_cat);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,15 +300,15 @@ void default_map_generator::user_config(CVideo& v)
|
|||
font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOR,landform_label,landform_rect.x,landform_rect.y);
|
||||
|
||||
font::draw_text(&screen, screen_area(), font::SIZE_NORMAL,
|
||||
font::NORMAL_COLOR, str_cast(nplayers_),
|
||||
font::NORMAL_COLOR, std::to_string(nplayers_),
|
||||
slider_right + horz_margin, players_rect.y);
|
||||
|
||||
font::draw_text(&screen, screen_area(), font::SIZE_NORMAL,
|
||||
font::NORMAL_COLOR, str_cast(width_),
|
||||
font::NORMAL_COLOR, std::to_string(width_),
|
||||
slider_right + horz_margin, width_rect.y);
|
||||
|
||||
font::draw_text(&screen, screen_area(), font::SIZE_NORMAL,
|
||||
font::NORMAL_COLOR, str_cast(height_),
|
||||
font::NORMAL_COLOR, std::to_string(height_),
|
||||
slider_right+horz_margin,height_rect.y);
|
||||
|
||||
std::stringstream villages_str;
|
||||
|
@ -317,7 +317,7 @@ void default_map_generator::user_config(CVideo& v)
|
|||
slider_right+horz_margin,villages_rect.y);
|
||||
|
||||
font::draw_text(&screen, screen_area(), font::SIZE_NORMAL,
|
||||
font::NORMAL_COLOR, str_cast(castle_size_),
|
||||
font::NORMAL_COLOR, std::to_string(castle_size_),
|
||||
slider_right + horz_margin, castlesize_rect.y);
|
||||
|
||||
std::stringstream landform_str;
|
||||
|
|
|
@ -320,7 +320,7 @@ taddon_description::taddon_description(const std::string& addon_id,
|
|||
register_label("author", true, addon.author);
|
||||
register_label("type", true, addon.display_type());
|
||||
register_label("size", true, size_display_string(addon.size));
|
||||
register_label("downloads", true, str_cast(addon.downloads));
|
||||
register_label("downloads", true, std::to_string(addon.downloads));
|
||||
register_label("created", true, created_text);
|
||||
register_label("updated", true, updated_text);
|
||||
if(!addon.description.empty()) {
|
||||
|
|
|
@ -407,7 +407,7 @@ void taddon_list::pre_show(twindow& window)
|
|||
item["label"] = size_display_string(info.size);
|
||||
data.insert(std::make_pair("size", item));
|
||||
|
||||
item["label"] = lexical_cast<std::string>(info.downloads);
|
||||
item["label"] = std::to_string(info.downloads);
|
||||
data.insert(std::make_pair("downloads", item));
|
||||
|
||||
item["label"] = info.display_type();
|
||||
|
@ -516,7 +516,7 @@ void taddon_list::on_addon_select(twindow& window)
|
|||
status.set_use_markup(true);
|
||||
|
||||
find_widget<tcontrol>(&window, "size", false).set_label(size_display_string(info.size));
|
||||
find_widget<tcontrol>(&window, "downloads", false).set_label(lexical_cast<std::string>(info.downloads));
|
||||
find_widget<tcontrol>(&window, "downloads", false).set_label(std::to_string(info.downloads));
|
||||
find_widget<tcontrol>(&window, "created", false).set_label(format_addon_time(info.created));
|
||||
find_widget<tcontrol>(&window, "updated", false).set_label(format_addon_time(info.updated));
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ void tcampaign_selection::pre_show(twindow& window)
|
|||
tree_group_field["label"] = campaign["completed"].to_bool() ? "misc/laurel.png" : "misc/blank-hex.png";
|
||||
tree_group_item["victory"] = tree_group_field;
|
||||
|
||||
tree.add_node("campaign", tree_group_item).set_id(lexical_cast<std::string>(id++));
|
||||
tree.add_node("campaign", tree_group_item).set_id(std::to_string(id++));
|
||||
|
||||
/*** Add detail item ***/
|
||||
string_map detail_item;
|
||||
|
|
|
@ -161,7 +161,7 @@ void tdebug_clock::update_time(const bool force)
|
|||
std::map<std::string, string_map> item_data;
|
||||
string_map item;
|
||||
|
||||
item["label"] = str_cast(second_stamp);
|
||||
item["label"] = std::to_string(second_stamp);
|
||||
item_data.insert(std::make_pair("time", item));
|
||||
|
||||
if(pane_) {
|
||||
|
|
|
@ -100,8 +100,8 @@ teditor_resize_map::teditor_resize_map(int& width,
|
|||
{
|
||||
register_bool("copy_edge_terrain", false, copy_edge_terrain);
|
||||
|
||||
register_label("old_width", false, str_cast(width));
|
||||
register_label("old_height", false, str_cast(height));
|
||||
register_label("old_width", false, std::to_string(width));
|
||||
register_label("old_height", false, std::to_string(height));
|
||||
}
|
||||
|
||||
void teditor_resize_map::pre_show(twindow& window)
|
||||
|
@ -122,7 +122,7 @@ void teditor_resize_map::pre_show(twindow& window)
|
|||
|
||||
std::string name_prefix = "expand";
|
||||
for(int i = 0; i < 9; ++i) {
|
||||
std::string name = name_prefix + lexical_cast<std::string>(i);
|
||||
std::string name = name_prefix + std::to_string(i);
|
||||
direction_buttons_[i]
|
||||
= find_widget<ttoggle_button>(&window, name, false, true);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void teditor_set_starting_position::pre_show(twindow& window)
|
|||
data.clear();
|
||||
|
||||
utils::string_map symbols;
|
||||
symbols["player_number"] = str_cast(i + 1);
|
||||
symbols["player_number"] = std::to_string(i + 1);
|
||||
|
||||
column["label"] = utils::interpolate_variables_into_string(
|
||||
_("Player $player_number"), &symbols);
|
||||
|
|
|
@ -703,7 +703,7 @@ public:
|
|||
? static_cast<int>((*resources::teams).size())
|
||||
: 0;
|
||||
for(int side = 1; side <= sides; ++side) {
|
||||
std::string side_str = str_cast(side);
|
||||
std::string side_str = std::to_string(side);
|
||||
sm_controllers_.push_back(boost::shared_ptr<single_mode_controller>(
|
||||
new team_mode_controller(
|
||||
std::string("team ") + side_str, model_, side)));
|
||||
|
|
|
@ -54,7 +54,7 @@ tlabel_settings::tlabel_settings(display_context& dc) : viewer(dc) {
|
|||
}
|
||||
for(size_t i = 0; i < dc.teams().size(); i++) {
|
||||
const team& team = dc.teams()[i];
|
||||
const std::string label_cat_key = "side:" + str_cast(i + 1);
|
||||
const std::string label_cat_key = "side:" + std::to_string(i + 1);
|
||||
if(team.hidden()) {
|
||||
labels_display[label_cat_key] = "";
|
||||
continue;
|
||||
|
@ -67,7 +67,7 @@ tlabel_settings::tlabel_settings(display_context& dc) : viewer(dc) {
|
|||
team_name = _("Unknown");
|
||||
}
|
||||
string_map subst;
|
||||
subst["side_number"] = str_cast(i + 1);
|
||||
subst["side_number"] = std::to_string(i + 1);
|
||||
subst["name"] = team_name;
|
||||
labels_display[label_cat_key] = vgettext("Side $side_number ($name)", subst);
|
||||
}
|
||||
|
|
|
@ -623,9 +623,9 @@ void tlobby_main::update_gamelist_header()
|
|||
#ifndef GUI2_EXPERIMENTAL_LISTBOX
|
||||
utils::string_map symbols;
|
||||
symbols["num_shown"]
|
||||
= lexical_cast<std::string>(lobby_info_.games_filtered().size());
|
||||
= std::to_string(lobby_info_.games_filtered().size());
|
||||
symbols["num_total"]
|
||||
= lexical_cast<std::string>(lobby_info_.games().size());
|
||||
= std::to_string(lobby_info_.games().size());
|
||||
std::string games_string
|
||||
= VGETTEXT("Games: showing $num_shown out of $num_total", symbols);
|
||||
find_widget<tlabel>(gamelistbox_, "map", false).set_label(games_string);
|
||||
|
@ -1547,7 +1547,7 @@ bool tlobby_main::do_game_join(int idx, bool observe)
|
|||
}
|
||||
config response;
|
||||
config& join = response.add_child("join");
|
||||
join["id"] = lexical_cast<std::string>(game.id);
|
||||
join["id"] = std::to_string(game.id);
|
||||
join["observe"] = observe;
|
||||
if(join && !observe && game.password_required) {
|
||||
std::string password;
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
<< "\" label: \"" << label << "\")\n";
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
item["id"] = std::string("side_") + str_cast(side_num);
|
||||
item["id"] = std::string("side_") + std::to_string(side_num);
|
||||
item["label"] = label;
|
||||
item["use_markup"] = "true";
|
||||
data.insert(std::make_pair("side", item));
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
for(int side = 1; side <= sides; ++side) {
|
||||
if(!resources::teams->at(side - 1).hidden()) {
|
||||
string_map symbols;
|
||||
symbols["side"] = str_cast(side);
|
||||
symbols["side"] = std::to_string(side);
|
||||
std::string side_str = vgettext("Side $side", symbols);
|
||||
side_str = font::span_color(team::get_side_color(side))
|
||||
+ side_str + "</span>";
|
||||
|
|
|
@ -455,7 +455,7 @@ void tpreferences::initialize_members(twindow& window)
|
|||
find_widget<tslider>(&window, "turbo_slider", false);
|
||||
|
||||
const int selected_speed = std::find(
|
||||
(accl_speeds_.begin()), accl_speeds_.end(), lexical_cast<std::string>(turbo_speed()))
|
||||
(accl_speeds_.begin()), accl_speeds_.end(), std::to_string(turbo_speed()))
|
||||
- (accl_speeds_.begin());
|
||||
|
||||
accl_slider.set_value_labels(accl_speeds_);
|
||||
|
|
|
@ -93,7 +93,7 @@ void tunit_recruit::pre_show(twindow& window)
|
|||
|
||||
const bool can_afford = recruit->cost() < team_.gold() - wb_gold;
|
||||
|
||||
const std::string cost_string = lexical_cast<std::string>(recruit->cost());
|
||||
const std::string cost_string = std::to_string(recruit->cost());
|
||||
|
||||
column["label"] = image_string;
|
||||
row_data.insert(std::make_pair("unit_image", column));
|
||||
|
|
|
@ -57,8 +57,8 @@ std::string get_child_id(const std::string& parent_id,
|
|||
// instead.
|
||||
|
||||
// return (formatter() << parent_id << "_C_" << row << '_' << col).c_str();
|
||||
std::string result = parent_id + "_C_" + lexical_cast<std::string>(row)
|
||||
+ '_' + lexical_cast<std::string>(col);
|
||||
std::string result = parent_id + "_C_" + std::to_string(row)
|
||||
+ '_' + std::to_string(col);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ void tdebug_layout_graph::generate_dot_file(const std::string& generator,
|
|||
id += '_';
|
||||
}
|
||||
const std::string filename = filename_base_ + id
|
||||
+ lexical_cast<std::string>(++sequence_number_)
|
||||
+ std::to_string(++sequence_number_)
|
||||
+ "-" + generator + ".dot";
|
||||
|
||||
std::ofstream file(filename.c_str());
|
||||
|
@ -251,7 +251,7 @@ void tdebug_layout_graph::widget_generate_info(std::ostream& out,
|
|||
for(size_t i = 0; i < generator->get_item_count(); ++i) {
|
||||
|
||||
const std::string child_id = id + "_I_"
|
||||
+ lexical_cast<std::string>(i);
|
||||
+ std::to_string(i);
|
||||
|
||||
widget_generate_info(out, &generator->item(i), child_id, true);
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ void tlistbox::finalize(tbuilder_grid_const_ptr header,
|
|||
}
|
||||
tgrid& p = find_widget<tgrid>(this, "_header_grid", false);
|
||||
for(unsigned i = 0, max = std::max(p.get_cols(), p.get_rows()); i < max; ++i) {
|
||||
if(tselectable_* selectable = find_widget<tselectable_>(&p, "sort_" + lexical_cast<std::string>(i), false, false)) {
|
||||
if(tselectable_* selectable = find_widget<tselectable_>(&p, "sort_" + std::to_string(i), false, false)) {
|
||||
selectable->set_callback_state_change(boost::bind(&tlistbox::order_by_column, this, i, _1));
|
||||
if(orders_.size() < max ) {
|
||||
orders_.resize(max);
|
||||
|
|
|
@ -90,7 +90,7 @@ void tunit_preview_pane::set_displayed_type(const unit_type* type)
|
|||
|
||||
if(label_level_) {
|
||||
utils::string_map symbols;
|
||||
symbols["lvl"] = lexical_cast<std::string>(type->level());
|
||||
symbols["lvl"] = std::to_string(type->level());
|
||||
|
||||
std::string l_str = vgettext("Lvl $lvl", symbols);
|
||||
|
||||
|
|
|
@ -366,11 +366,11 @@ void play_controller::hotkey_handler::expand_autosaves(std::vector<std::string>&
|
|||
std::vector<std::string> newitems;
|
||||
std::vector<std::string> newsaves;
|
||||
for (unsigned int turn = play_controller_.turn(); turn != 0; turn--) {
|
||||
std::string name = saved_game_.classification().label + "-" + _("Auto-Save") + lexical_cast<std::string>(turn);
|
||||
std::string name = saved_game_.classification().label + "-" + _("Auto-Save") + std::to_string(turn);
|
||||
if (savegame::save_game_exists(name, comp_format)) {
|
||||
newsaves.push_back(
|
||||
name + compression::format_extension(comp_format));
|
||||
newitems.push_back(_("Back to Turn ") + lexical_cast<std::string>(turn));
|
||||
newitems.push_back(_("Back to Turn ") + std::to_string(turn));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ bool hotkey_mouse::matches_helper(const SDL_Event &event) const
|
|||
|
||||
const std::string hotkey_mouse::get_name_helper() const
|
||||
{
|
||||
return "mouse " + lexical_cast<std::string>(button_);
|
||||
return "mouse " + std::to_string(button_);
|
||||
}
|
||||
|
||||
void hotkey_mouse::save_helper(config &item) const
|
||||
|
|
|
@ -594,7 +594,7 @@ REGISTER_MOD_PARSER(TC, args)
|
|||
else {
|
||||
// This side is not initialized; use default "n"
|
||||
try {
|
||||
team_color = lexical_cast<std::string>(side_n);
|
||||
team_color = std::to_string(side_n);
|
||||
} catch(bad_lexical_cast const&) {
|
||||
ERR_DP << "bad things happen" << std::endl;
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ const std::vector<std::string>& map_labels::all_categories() const {
|
|||
categories.clear();
|
||||
categories.push_back("team");
|
||||
for(size_t i = 1; i <= resources::teams->size(); i++) {
|
||||
categories.push_back("side:" + str_cast(i));
|
||||
categories.push_back("side:" + std::to_string(i));
|
||||
}
|
||||
std::set<std::string> unique_cats;
|
||||
BOOST_FOREACH(const team_label_map::value_type& m, labels_) {
|
||||
|
@ -597,7 +597,7 @@ bool terrain_label::hidden() const
|
|||
{
|
||||
// Respect user's label preferences
|
||||
std::string category = "cat:" + category_;
|
||||
std::string creator = "side:" + str_cast(creator_ + 1);
|
||||
std::string creator = "side:" + std::to_string(creator_ + 1);
|
||||
const std::vector<std::string>& hidden_categories = parent_->disp().get_disp_context().hidden_label_categories();
|
||||
|
||||
if(std::find(hidden_categories.begin(), hidden_categories.end(), category) != hidden_categories.end())
|
||||
|
|
|
@ -141,7 +141,7 @@ void menu_handler::objectives(int side_num)
|
|||
}
|
||||
|
||||
config cfg;
|
||||
cfg["side"] = str_cast(side_num);
|
||||
cfg["side"] = std::to_string(side_num);
|
||||
gamestate().lua_kernel_->run_wml_action("show_objectives", vconfig(cfg),
|
||||
game_events::queued_event("_from_interface", map_location(),
|
||||
map_location(), config()));
|
||||
|
@ -655,7 +655,7 @@ void menu_handler::recall(int side_num, const map_location &last_hex)
|
|||
int wb_gold = pc_.get_whiteboard() ? pc_.get_whiteboard()->get_spent_gold_for(side_num) : 0;
|
||||
if (current_team.gold() - wb_gold < unit_cost) {
|
||||
utils::string_map i18n_symbols;
|
||||
i18n_symbols["cost"] = lexical_cast<std::string>(unit_cost);
|
||||
i18n_symbols["cost"] = std::to_string(unit_cost);
|
||||
std::string msg = vngettext(
|
||||
"You must have at least 1 gold piece to recall a unit",
|
||||
"You must have at least $cost gold pieces to recall this unit",
|
||||
|
@ -1480,7 +1480,7 @@ class map_command_handler
|
|||
void command_failed_need_arg(int argn)
|
||||
{
|
||||
utils::string_map symbols;
|
||||
symbols["arg_id"] = lexical_cast<std::string>(argn);
|
||||
symbols["arg_id"] = std::to_string(argn);
|
||||
command_failed(VGETTEXT("Missing argument $arg_id", symbols));
|
||||
}
|
||||
void print_usage()
|
||||
|
@ -2082,7 +2082,7 @@ void chat_handler::send_command(const std::string& cmd, const std::string& args
|
|||
|| cmd == "mute" || cmd == "unmute") {
|
||||
data.add_child(cmd)["username"] = args;
|
||||
} else if (cmd == "ping") {
|
||||
data[cmd] = lexical_cast<std::string>(time(NULL));
|
||||
data[cmd] = std::to_string(time(NULL));
|
||||
} else if (cmd == "green") {
|
||||
data.add_child("query")["type"] = "lobbymsg @" + args;
|
||||
} else if (cmd == "red") {
|
||||
|
@ -2518,7 +2518,7 @@ void console_handler::do_droid() {
|
|||
return;
|
||||
} else if (menu_handler_.teams()[side - 1].is_network()) {
|
||||
utils::string_map symbols;
|
||||
symbols["side"] = lexical_cast<std::string>(side);
|
||||
symbols["side"] = std::to_string(side);
|
||||
command_failed(vgettext("Can't droid networked side: '$side'.", symbols));
|
||||
return;
|
||||
} else if (menu_handler_.teams()[side - 1].is_local_human()) {
|
||||
|
@ -2533,7 +2533,7 @@ void console_handler::do_droid() {
|
|||
}
|
||||
} else if (menu_handler_.teams()[side - 1].is_local_ai()) {
|
||||
// menu_handler_.teams()[side - 1].make_human();
|
||||
// menu_handler_.change_controller(lexical_cast<std::string>(side),"human");
|
||||
// menu_handler_.change_controller(std::to_string(side),"human");
|
||||
|
||||
utils::string_map symbols;
|
||||
symbols["side"] = side_s;
|
||||
|
@ -2557,12 +2557,12 @@ void console_handler::do_idle() {
|
|||
return;
|
||||
} else if (menu_handler_.teams()[side - 1].is_network()) {
|
||||
utils::string_map symbols;
|
||||
symbols["side"] = lexical_cast<std::string>(side);
|
||||
symbols["side"] = std::to_string(side);
|
||||
command_failed(vgettext("Can't idle networked side: '$side'.", symbols));
|
||||
return;
|
||||
} else if (menu_handler_.teams()[side - 1].is_local_ai()) {
|
||||
utils::string_map symbols;
|
||||
symbols["side"] = lexical_cast<std::string>(side);
|
||||
symbols["side"] = std::to_string(side);
|
||||
command_failed(vgettext("Can't idle local ai side: '$side'.", symbols));
|
||||
return;
|
||||
} else if (menu_handler_.teams()[side - 1].is_local_human()) {
|
||||
|
@ -3071,7 +3071,7 @@ void menu_handler::user_command()
|
|||
|
||||
void menu_handler::request_control_change ( int side_num, const std::string& player )
|
||||
{
|
||||
std::string side = str_cast(side_num);
|
||||
std::string side = std::to_string(side_num);
|
||||
if (teams()[side_num - 1].is_local_human() && player == preferences::login()) {
|
||||
//this is already our side.
|
||||
return;
|
||||
|
|
|
@ -171,8 +171,8 @@ static void check_timeout()
|
|||
ERR_NW << "No server ping since " << timeout
|
||||
<< " seconds. Connection timed out.\n";
|
||||
utils::string_map symbols;
|
||||
symbols["timeout"] = lexical_cast<std::string>(timeout);
|
||||
throw network::error("No server ping since " + str_cast(timeout) + " second. "
|
||||
symbols["timeout"] = std::to_string(timeout);
|
||||
throw network::error("No server ping since " + std::to_string(timeout) + " second. "
|
||||
"Connection timed out.");
|
||||
}
|
||||
last_ping_check = now;
|
||||
|
|
|
@ -291,13 +291,13 @@ config manager::to_config() const {
|
|||
for(; tunnel != tunnels_.end(); ++tunnel) {
|
||||
store.add_child("tunnel", tunnel->to_config());
|
||||
}
|
||||
store["next_teleport_group_id"] = str_cast(id_);
|
||||
store["next_teleport_group_id"] = std::to_string(id_);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
std::string manager::next_unique_id() {
|
||||
return str_cast(++id_);
|
||||
return std::to_string(++id_);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -447,8 +447,8 @@ void play_controller::do_init_side()
|
|||
gamestate_->init_side_done() = true;
|
||||
init_side_done_now_ = true;
|
||||
|
||||
const std::string turn_num = str_cast(turn());
|
||||
const std::string side_num = str_cast(current_side());
|
||||
const std::string turn_num = std::to_string(turn());
|
||||
const std::string side_num = std::to_string(current_side());
|
||||
|
||||
gamestate().gamedata_.get_variable("side_number") = current_side();
|
||||
|
||||
|
@ -544,8 +544,8 @@ void play_controller::finish_side_turn()
|
|||
// Ending the turn commits all moves.
|
||||
undo_stack().clear();
|
||||
gamestate().board_.end_turn(current_side());
|
||||
const std::string turn_num = str_cast(turn());
|
||||
const std::string side_num = str_cast(current_side());
|
||||
const std::string turn_num = std::to_string(turn());
|
||||
const std::string side_num = std::to_string(current_side());
|
||||
|
||||
// Clear shroud, in case units had been slowed for the turn.
|
||||
actions::clear_shroud(current_side());
|
||||
|
@ -568,7 +568,7 @@ void play_controller::finish_side_turn()
|
|||
void play_controller::finish_turn()
|
||||
{
|
||||
set_scontext_synced sync(2);
|
||||
const std::string turn_num = str_cast(turn());
|
||||
const std::string turn_num = std::to_string(turn());
|
||||
pump().fire("turn end");
|
||||
pump().fire("turn " + turn_num + " end");
|
||||
sync.do_final_checkup();
|
||||
|
|
|
@ -381,8 +381,8 @@ bool fullscreen()
|
|||
|
||||
void _set_resolution(const std::pair<int, int>& res)
|
||||
{
|
||||
preferences::set("xresolution", lexical_cast<std::string>(res.first));
|
||||
preferences::set("yresolution", lexical_cast<std::string>(res.second));
|
||||
preferences::set("xresolution", std::to_string(res.first));
|
||||
preferences::set("yresolution", std::to_string(res.second));
|
||||
}
|
||||
|
||||
void _set_maximized(bool ison)
|
||||
|
|
|
@ -154,7 +154,7 @@ chat_msg::chat_msg(const config &cfg)
|
|||
{
|
||||
nick_ = cfg["id"].str();
|
||||
} else {
|
||||
nick_ = str_cast("*")+cfg["id"].str()+"*";
|
||||
nick_ = "*"+cfg["id"].str()+"*";
|
||||
}
|
||||
int side = cfg["side"].to_int(0);
|
||||
LOG_REPLAY << "side in message: " << side << std::endl;
|
||||
|
|
|
@ -336,7 +336,7 @@ static config unit_alignment(reports::context & rc, const unit* u)
|
|||
if (!u) return config();
|
||||
std::ostringstream str, tooltip;
|
||||
const std::string align = unit_type::alignment_description(u->alignment(), u->gender());
|
||||
const std::string align_id = lexical_cast<std::string>(u->alignment());
|
||||
const std::string align_id = unit_type::ALIGNMENT::enum_to_string(u->alignment());
|
||||
int cm = combat_modifier(rc.units(), rc.map(), rc.screen().displayed_unit_hex(), u->alignment(),
|
||||
u->is_fearless());
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ REPORT_GENERATOR(villages, rc)
|
|||
|
||||
REPORT_GENERATOR(num_units, rc)
|
||||
{
|
||||
return gray_inactive(rc, str_cast(rc.dc().side_units(rc.screen().viewing_side())));
|
||||
return gray_inactive(rc, std::to_string(rc.dc().side_units(rc.screen().viewing_side())));
|
||||
}
|
||||
|
||||
REPORT_GENERATOR(upkeep, rc)
|
||||
|
@ -1296,7 +1296,7 @@ REPORT_GENERATOR(expenses, rc)
|
|||
int viewing_side = rc.screen().viewing_side();
|
||||
const team &viewing_team = rc.teams()[viewing_side - 1];
|
||||
team_data td = rc.dc().calculate_team_data(viewing_team, rc.screen().viewing_side());
|
||||
return gray_inactive(rc,str_cast(td.expenses));
|
||||
return gray_inactive(rc,std::to_string(td.expenses));
|
||||
}
|
||||
|
||||
REPORT_GENERATOR(income, rc)
|
||||
|
|
|
@ -68,7 +68,7 @@ void save_index_class::rebuild(const std::string& name, const time_t& modified)
|
|||
} catch(game::load_game_failed&) {
|
||||
summary["corrupt"] = true;
|
||||
}
|
||||
summary["mod_time"] = str_cast(static_cast<int>(modified));
|
||||
summary["mod_time"] = std::to_string(static_cast<int>(modified));
|
||||
write_save_index();
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ static int impl_unit_set(lua_State *L)
|
|||
u.set_advancements(lua_check<std::vector<config> >(L, 3));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(m, "upkeep") == 0) {
|
||||
if(lua_isnumber(L, 3)) {
|
||||
u.set_upkeep(luaL_checkint(L, 3));
|
||||
|
@ -441,10 +441,10 @@ static int impl_unit_set(lua_State *L)
|
|||
u.set_upkeep(unit::upkeep_loyal());
|
||||
}
|
||||
else if(strcmp(m, "full") == 0) {
|
||||
u.set_upkeep(unit::upkeep_full());
|
||||
u.set_upkeep(unit::upkeep_full());
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
std::string err_msg = "unknown upkeep value of unit: ";
|
||||
err_msg += v;
|
||||
return luaL_argerror(L, 2, err_msg.c_str());
|
||||
|
@ -1551,7 +1551,7 @@ int game_lua_kernel::impl_game_config_get(lua_State *L)
|
|||
const mp_game_settings& mp_settings = play_controller_.get_mp_settings();
|
||||
const game_classification & classification = play_controller_.get_classification();
|
||||
|
||||
return_string_attrib("campaign_type", lexical_cast<std::string>(classification.campaign_type));
|
||||
return_string_attrib("campaign_type", game_classification::CAMPAIGN_TYPE::enum_to_string(classification.campaign_type));
|
||||
if(classification.campaign_type==game_classification::CAMPAIGN_TYPE::MULTIPLAYER) {
|
||||
return_cfgref_attrib("mp_settings", mp_settings.to_config());
|
||||
return_cfgref_attrib("era", game_config_manager::get()->game_config().find_child("era","id",mp_settings.mp_era));
|
||||
|
@ -1967,11 +1967,11 @@ static int load_fake_units(lua_State* L, int arg, T& fake_units)
|
|||
if (!lua_istable(L, entry)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (!luaW_tolocation(L, entry, src)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
lua_rawgeti(L, entry, 3);
|
||||
if (!lua_isnumber(L, -1)) {
|
||||
lua_getfield(L, entry, "side");
|
||||
|
@ -1980,7 +1980,7 @@ static int load_fake_units(lua_State* L, int arg, T& fake_units)
|
|||
}
|
||||
}
|
||||
int side = lua_tointeger(L, -1);
|
||||
|
||||
|
||||
lua_rawgeti(L, entry, 4);
|
||||
if (!lua_isstring(L, -1)) {
|
||||
lua_getfield(L, entry, "type");
|
||||
|
@ -1989,10 +1989,10 @@ static int load_fake_units(lua_State* L, int arg, T& fake_units)
|
|||
}
|
||||
}
|
||||
std::string unit_type = lua_tostring(L, -1);
|
||||
|
||||
|
||||
boost::tuple<map_location, int, std::string> tuple(src, side, unit_type);
|
||||
fake_units.push_back(tuple);
|
||||
|
||||
|
||||
lua_settop(L, entry - 1);
|
||||
}
|
||||
return 0;
|
||||
|
@ -2547,7 +2547,7 @@ int game_lua_kernel::intf_float_label(lua_State *L)
|
|||
if (!lua_isnoneornil(L, 3)) {
|
||||
color = string_to_color(luaL_checkstring(L, 3));
|
||||
}
|
||||
|
||||
|
||||
if (game_display_) {
|
||||
game_display_->float_label(loc, text, color);
|
||||
}
|
||||
|
@ -2865,14 +2865,14 @@ int game_lua_kernel::intf_scroll_to_tile(lua_State *L)
|
|||
int game_lua_kernel::intf_select_hex(lua_State *L)
|
||||
{
|
||||
ERR_LUA << "wesnoth.select_hex is deprecated, use wesnoth.select_unit and/or wesnoth.highlight_hex" << std::endl;
|
||||
|
||||
|
||||
// Need this because check_location may change the stack
|
||||
// By doing this now, we ensure that it won't do so when
|
||||
// intf_select_unit and intf_highlight_hex call it.
|
||||
const map_location loc = luaW_checklocation(L, 1);
|
||||
luaW_pushlocation(L, loc);
|
||||
lua_replace(L, 1);
|
||||
|
||||
|
||||
intf_select_unit(L);
|
||||
if(!lua_isnoneornil(L, 2) && luaW_toboolean(L,2)) {
|
||||
intf_highlight_hex(L);
|
||||
|
@ -4165,7 +4165,7 @@ int game_lua_kernel::intf_teleport(lua_State *L)
|
|||
teleport_path.push_back(src_loc);
|
||||
teleport_path.push_back(vacant_dst);
|
||||
unit_display::move_unit(teleport_path, u, animate);
|
||||
|
||||
|
||||
resources::units->move(src_loc, vacant_dst);
|
||||
unit::clear_status_caches();
|
||||
|
||||
|
@ -4769,7 +4769,7 @@ int game_lua_kernel::cfun_builtin_effect(lua_State *L)
|
|||
// The times= key is supposed to be ignored by the effect function.
|
||||
// However, just in case someone doesn't realize this, we will set it to 1 here.
|
||||
cfg["times"] = 1;
|
||||
|
||||
|
||||
if(need_apply) {
|
||||
u.get()->apply_builtin_effect(which_effect, cfg);
|
||||
return 0;
|
||||
|
|
|
@ -42,7 +42,7 @@ int intf_get_direction(lua_State* L)
|
|||
int nargs = lua_gettop(L);
|
||||
if (nargs != 2 and nargs != 3) {
|
||||
std::string msg("get_direction: must pass 2 or 3 args, found ");
|
||||
msg += str_cast(nargs);
|
||||
msg += std::to_string(nargs);
|
||||
luaL_error(L, msg.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ void preproc_define::write(config_writer& writer, const std::string& name) const
|
|||
writer.write_key_val("name", name);
|
||||
writer.write_key_val("value", value);
|
||||
writer.write_key_val("textdomain", textdomain);
|
||||
writer.write_key_val("linenum", lexical_cast<std::string>(linenum));
|
||||
writer.write_key_val("linenum", std::to_string(linenum));
|
||||
writer.write_key_val("location", get_location(location));
|
||||
|
||||
BOOST_FOREACH(const std::string &arg, arguments)
|
||||
|
|
|
@ -231,7 +231,7 @@ std::vector< std::string > square_parenthetical_split(std::string const &val,
|
|||
int increment = (end >= begin ? 1 : -1);
|
||||
end+=increment; //include end in expansion
|
||||
for (int k=begin; k!=end; k+=increment) {
|
||||
std::string pb = boost::lexical_cast<std::string>(k);
|
||||
std::string pb = std::to_string(k);
|
||||
for (size_t p=pb.size(); p<=padding; p++)
|
||||
pb = std::string("0") + pb;
|
||||
square_expansion.push_back(pb);
|
||||
|
|
|
@ -425,7 +425,7 @@ set_scontext_synced::set_scontext_synced()
|
|||
|
||||
set_scontext_synced::set_scontext_synced(int number)
|
||||
: set_scontext_synced_base()
|
||||
, new_checkup_(generate_checkup("checkup" + boost::lexical_cast<std::string>(number))), disabler_()
|
||||
, new_checkup_(generate_checkup("checkup" + std::to_string(number))), disabler_()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
|
|
@ -285,11 +285,11 @@ void user_choice_manager::search_in_replay()
|
|||
}
|
||||
if(required_.find(from_side) == required_.end())
|
||||
{
|
||||
replay::process_error("MP synchronization: we got an answer from side " + boost::lexical_cast<std::string>(from_side) + "for [" + tagname_ + "] which is not was we expected\n");
|
||||
replay::process_error("MP synchronization: we got an answer from side " + std::to_string(from_side) + "for [" + tagname_ + "] which is not was we expected\n");
|
||||
}
|
||||
if(res_.find(from_side) != res_.end())
|
||||
{
|
||||
replay::process_error("MP synchronization: we got already our answer from side " + boost::lexical_cast<std::string>(from_side) + "for [" + tagname_ + "] now we have it twice.\n");
|
||||
replay::process_error("MP synchronization: we got already our answer from side " + std::to_string(from_side) + "for [" + tagname_ + "] now we have it twice.\n");
|
||||
}
|
||||
res_[from_side] = action->child(tagname_);
|
||||
changed_event_.notify_observers();
|
||||
|
@ -318,7 +318,7 @@ void user_choice_manager::update_local_choice()
|
|||
if(res_.find(side) == res_.end())
|
||||
{
|
||||
sides_str += " ";
|
||||
sides_str += lexical_cast<std::string>(side);
|
||||
sides_str += std::to_string(side);
|
||||
//and it is local
|
||||
if((*resources::teams)[side-1].is_local() && !(*resources::teams)[side-1].is_idle())
|
||||
{
|
||||
|
|
|
@ -330,7 +330,7 @@ void team::build(const config &cfg, const gamemap& map, int gold)
|
|||
if (gold_ != info_.gold)
|
||||
info_.start_gold = gold;
|
||||
// Old code was doing:
|
||||
// info_.start_gold = str_cast(gold) + " (" + info_.start_gold + ")";
|
||||
// info_.start_gold = std::to_string(gold) + " (" + info_.start_gold + ")";
|
||||
// Was it correct?
|
||||
|
||||
// Load in the villages the side controls at the start
|
||||
|
@ -660,7 +660,7 @@ void validate_side(int side)
|
|||
}
|
||||
|
||||
if(side < 1 || side > int(teams->size())) {
|
||||
throw game::game_error("invalid side(" + str_cast(side) + ") found in unit definition");
|
||||
throw game::game_error("invalid side(" + std::to_string(side) + ") found in unit definition");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -846,7 +846,7 @@ std::string team::get_side_color_index(int side)
|
|||
return side_map;
|
||||
}
|
||||
}
|
||||
return str_cast(side);
|
||||
return std::to_string(side);
|
||||
}
|
||||
|
||||
std::string team::get_side_highlight(int side)
|
||||
|
|
|
@ -215,7 +215,7 @@ protected:
|
|||
if ( seen_ids_.find(id)!=seen_ids_.end() ) {
|
||||
//seen before
|
||||
config u_tmp = u;
|
||||
u_tmp["side"] = str_cast(side_);
|
||||
u_tmp["side"] = std::to_string(side_);
|
||||
t_->recall_list().add(unit_ptr(new unit(u_tmp,true)));
|
||||
} else {
|
||||
//not seen before
|
||||
|
|
|
@ -270,14 +270,14 @@ bool terrain_filter::match_internal(const map_location& loc, const bool ignore_x
|
|||
if(!tod_type.empty()) {
|
||||
const std::vector<std::string>& vals = utils::split(tod_type);
|
||||
if(tod.lawful_bonus<0) {
|
||||
if(std::find(vals.begin(),vals.end(),lexical_cast<std::string>(unit_type::ALIGNMENT::CHAOTIC)) == vals.end()) {
|
||||
if(std::find(vals.begin(),vals.end(),std::to_string(unit_type::ALIGNMENT::CHAOTIC)) == vals.end()) {
|
||||
return false;
|
||||
}
|
||||
} else if(tod.lawful_bonus>0) {
|
||||
if(std::find(vals.begin(),vals.end(),lexical_cast<std::string>(unit_type::ALIGNMENT::LAWFUL)) == vals.end()) {
|
||||
if(std::find(vals.begin(),vals.end(),std::to_string(unit_type::ALIGNMENT::LAWFUL)) == vals.end()) {
|
||||
return false;
|
||||
}
|
||||
} else if(std::find(vals.begin(),vals.end(),lexical_cast<std::string>(unit_type::ALIGNMENT::NEUTRAL)) == vals.end()) {
|
||||
} else if(std::find(vals.begin(),vals.end(),std::to_string(unit_type::ALIGNMENT::NEUTRAL)) == vals.end()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -783,7 +783,7 @@ static std::string number_to_string_(t_terrain terrain, const int start_position
|
|||
|
||||
// Insert the start position
|
||||
if(start_position > 0) {
|
||||
result = str_cast(start_position) + " ";
|
||||
result = std::to_string(start_position) + " ";
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -87,7 +87,7 @@ bool validate(const char* str)
|
|||
type_send val = initializer value; \
|
||||
\
|
||||
BOOST_CHECK_EXCEPTION( \
|
||||
lexical_cast<std::string>(val), const char*, validate); \
|
||||
std::to_string(val), const char*, validate); \
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE_TEMPLATE(test_lexical_cast_throw, T, test_types)
|
||||
|
@ -200,14 +200,14 @@ BOOST_AUTO_TEST_CASE(test_lexical_cast_unsigned_long_long)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(test_lexical_cast_result)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(lexical_cast<std::string>(true), "1");
|
||||
BOOST_CHECK_EQUAL(lexical_cast<std::string>(false), "0");
|
||||
BOOST_CHECK_EQUAL(std::to_string(true), "1");
|
||||
BOOST_CHECK_EQUAL(std::to_string(false), "0");
|
||||
|
||||
BOOST_CHECK_EQUAL(lexical_cast<std::string>(1), "1");
|
||||
BOOST_CHECK_EQUAL(lexical_cast<std::string>(1u), "1");
|
||||
BOOST_CHECK_EQUAL(std::to_string(1), "1");
|
||||
BOOST_CHECK_EQUAL(std::to_string(1u), "1");
|
||||
|
||||
BOOST_CHECK_EQUAL(lexical_cast<std::string>(1.2f), "1.2");
|
||||
BOOST_CHECK_EQUAL(lexical_cast<std::string>(1.2), "1.2");
|
||||
BOOST_CHECK_EQUAL(std::to_string(1.2f), "1.2");
|
||||
BOOST_CHECK_EQUAL(std::to_string(1.2), "1.2");
|
||||
|
||||
BOOST_CHECK_EQUAL(lexical_cast<int>("1"), 1);
|
||||
BOOST_CHECK_EQUAL(lexical_cast<int>("-1"), -1);
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace foo {
|
|||
enum enumname {con1, con2 ,con3}
|
||||
}
|
||||
|
||||
foo::enumname lexical_cast<std::string> ( std::string str ) throws bad_lexical_cast
|
||||
foo::enumname std::to_string ( std::string str ) throws bad_lexical_cast
|
||||
{
|
||||
...
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE ( test_make_enum_namespace )
|
|||
|
||||
BOOST_CHECK_EQUAL ( str, "name1" );
|
||||
|
||||
std::string str2 = lexical_cast<std::string> (e); //returns "name2" since e is con2
|
||||
std::string str2 = std::to_string (e); //returns "name2" since e is con2
|
||||
|
||||
BOOST_CHECK_EQUAL ( str2, "name2" );
|
||||
|
||||
|
@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE ( test_make_enum_class )
|
|||
|
||||
BOOST_CHECK_EQUAL ( str, "name1" );
|
||||
|
||||
std::string str2 = lexical_cast<std::string> (e); //returns "name2" since e is val2
|
||||
std::string str2 = std::to_string (e); //returns "name2" since e is val2
|
||||
|
||||
BOOST_CHECK_EQUAL ( str2, "name2" );
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ struct mp_connect_fixture {
|
|||
state->mp_settings().saved_game = false;
|
||||
|
||||
state->set_scenario(config_manager->
|
||||
game_config().find_child(lexical_cast<std::string>(game_classification::CAMPAIGN_TYPE::MULTIPLAYER), "id", state->mp_settings().name));
|
||||
game_config().find_child(std::to_string(game_classification::CAMPAIGN_TYPE::MULTIPLAYER), "id", state->mp_settings().name));
|
||||
|
||||
state->mp_settings().num_turns = state->get_starting_pos()["turns"];
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ static void create(std::string& command, std::string::const_iterator begin)
|
|||
utf8::insert(command,
|
||||
utf8::size(command),
|
||||
" -> OK ID "
|
||||
+ boost::lexical_cast<std::string>(windows.size() - 1));
|
||||
+ std::to_string(windows.size() - 1));
|
||||
}
|
||||
|
||||
static void modify(std::string& command, std::string::const_iterator begin)
|
||||
|
|
|
@ -533,7 +533,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
|
|||
|
||||
animations.push_back(*itor);
|
||||
animations.back().event_ = utils::split("movement");
|
||||
animations.back().unit_anim_.override(0,200,particule::NO_CYCLE,"","",0,"0~1:200",lexical_cast<std::string>(display::LAYER_UNIT_MOVE_DEFAULT-display::LAYER_UNIT_FIRST));
|
||||
animations.back().unit_anim_.override(0,200,particule::NO_CYCLE,"","",0,"0~1:200",std::to_string(display::LAYER_UNIT_MOVE_DEFAULT-display::LAYER_UNIT_FIRST));
|
||||
|
||||
animations.push_back(*itor);
|
||||
animations.back().event_ = utils::split("defend");
|
||||
|
@ -546,7 +546,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
|
|||
|
||||
animations.push_back(*itor);
|
||||
animations.back().event_ = utils::split("attack");
|
||||
animations.back().unit_anim_.override(-150,300,particule::NO_CYCLE,"","",0,"0~0.6:150,0.6~0:150",lexical_cast<std::string>(display::LAYER_UNIT_MOVE_DEFAULT-display::LAYER_UNIT_FIRST));
|
||||
animations.back().unit_anim_.override(-150,300,particule::NO_CYCLE,"","",0,"0~0.6:150,0.6~0:150",std::to_string(display::LAYER_UNIT_MOVE_DEFAULT-display::LAYER_UNIT_FIRST));
|
||||
animations.back().primary_attack_filter_.push_back(config());
|
||||
animations.back().primary_attack_filter_.back()["range"] = "melee";
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ bool basic_unit_filter_impl::internal_matches_filter(const unit & u, const map_l
|
|||
|
||||
if (!vcfg["side"].empty() && vcfg["side"].to_int(-999) != u.side()) {
|
||||
std::vector<std::string> sides = utils::split(vcfg["side"]);
|
||||
const std::string u_side = str_cast(u.side());
|
||||
const std::string u_side = std::to_string(u.side());
|
||||
if (std::find(sides.begin(), sides.end(), u_side) == sides.end()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ frame_builder::frame_builder() :
|
|||
auto_vflip_(t_unset),
|
||||
auto_hflip_(t_unset),
|
||||
primary_frame_(t_unset),
|
||||
drawing_layer_(str_cast(display::LAYER_UNIT_DEFAULT - display::LAYER_UNIT_FIRST))
|
||||
drawing_layer_(std::to_string(display::LAYER_UNIT_DEFAULT - display::LAYER_UNIT_FIRST))
|
||||
{}
|
||||
|
||||
frame_builder::frame_builder(const config& cfg,const std::string& frame_string) :
|
||||
|
@ -603,11 +603,11 @@ std::vector<std::string> frame_parsed_parameters::debug_strings() const {
|
|||
if (!sound_.empty()) v.push_back("sound="+sound_);
|
||||
if (!text_.empty()) {
|
||||
v.push_back("text="+text_);
|
||||
v.push_back("text_color="+str_cast<Uint32>(text_color_));
|
||||
v.push_back("text_color="+std::to_string(text_color_));
|
||||
}
|
||||
if (!blend_ratio_.get_original().empty()) {
|
||||
v.push_back("blend_ratio="+blend_ratio_.get_original());
|
||||
v.push_back("blend_with="+str_cast<Uint32>(blend_with_));
|
||||
v.push_back("blend_with="+std::to_string(blend_with_));
|
||||
}
|
||||
if (!highlight_ratio_.get_original().empty()) v.push_back("highlight_ratio="+highlight_ratio_.get_original());
|
||||
if (!offset_.get_original().empty()) v.push_back("offset="+offset_.get_original());
|
||||
|
|
|
@ -836,9 +836,9 @@ std::string unit_type::alignment_description(ALIGNMENT align, unit_race::GENDER
|
|||
std::string str = std::string();
|
||||
if (gender == unit_race::FEMALE) {
|
||||
ALIGNMENT_FEMALE_VARIATION fem = align.cast<ALIGNMENT_FEMALE_VARIATION::type>();
|
||||
str = lexical_cast<std::string>(fem);
|
||||
str = ALIGNMENT_FEMALE_VARIATION::enum_to_string(fem);
|
||||
} else {
|
||||
str = lexical_cast<std::string>(align);
|
||||
str = ALIGNMENT::enum_to_string(align);
|
||||
}
|
||||
return translation::sgettext(str.c_str());
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ void adjust_profile(std::string& profile)
|
|||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// else, check for the file with /transparent appended...
|
||||
offset != std::string::npos ?
|
||||
|
|
|
@ -1465,7 +1465,7 @@ void unit::write(config& cfg) const
|
|||
cfg["alignment"] = alignment_.to_string();
|
||||
cfg["flag_rgb"] = flag_rgb_;
|
||||
cfg["unrenamable"] = unrenamable_;
|
||||
cfg["alpha"] = str_cast(alpha_);
|
||||
cfg["alpha"] = std::to_string(alpha_);
|
||||
|
||||
cfg["attacks_left"] = attacks_left_;
|
||||
cfg["max_attacks"] = max_attacks_;
|
||||
|
|
|
@ -171,12 +171,6 @@ float lexical_cast_default<float, const std::string&>(const std::string& a, floa
|
|||
template<>
|
||||
float lexical_cast_default<float, const char*>(const char* a, float def);
|
||||
|
||||
template<typename From>
|
||||
std::string str_cast(From a)
|
||||
{
|
||||
return lexical_cast<std::string,From>(a);
|
||||
}
|
||||
|
||||
template<typename To, typename From>
|
||||
To lexical_cast_in_range(From a, To def, To min, To max)
|
||||
{
|
||||
|
|
|
@ -452,7 +452,7 @@ static void draw_numbers(map_location const& hex, side_actions::numbers_t number
|
|||
{
|
||||
int number = numbers_to_draw[i];
|
||||
|
||||
std::string number_text = boost::lexical_cast<std::string>(number);
|
||||
std::string number_text = std::to_string(number);
|
||||
size_t font_size;
|
||||
if (int(i) == main_number) font_size = 19;
|
||||
else if (secondary_numbers.find(i)!=secondary_numbers.end()) font_size = 17;
|
||||
|
|
|
@ -71,8 +71,8 @@ void progress_bar::draw_contents()
|
|||
//remove 50% of color to simulate a shadow effect
|
||||
sdl::fill_rect(surf,&lightning,SDL_MapRGB(surf->format,fcr/2,fcg/2,fcb/2));
|
||||
|
||||
const std::string text = text_.empty() ? str_cast(progress_) + "%" :
|
||||
text_ + " (" + str_cast(progress_) + "%)";
|
||||
const std::string text = text_.empty() ? std::to_string(progress_) + "%" :
|
||||
text_ + " (" + std::to_string(progress_) + "%)";
|
||||
SDL_Rect text_area = font::text_area(text,font::SIZE_NORMAL);
|
||||
|
||||
text_area.x = area.x + area.w/2 - text_area.w/2;
|
||||
|
|
Loading…
Add table
Reference in a new issue