mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 17:21:19 +00:00
Added conversions from config::proxy_string to int.
This commit is contained in:
parent
74b2a21f63
commit
ab21de1ef1
@ -525,13 +525,13 @@ namespace {
|
|||||||
LOG_CS << "Upload aborted - invalid file names in add-on data.\n";
|
LOG_CS << "Upload aborted - invalid file names in add-on data.\n";
|
||||||
network::send_data(construct_error("Add-on rejected: The add-on contains an illegal file or directory name."
|
network::send_data(construct_error("Add-on rejected: The add-on contains an illegal file or directory name."
|
||||||
" File or directory names may not contain any of the following characters: '/ \\ : ~'"), sock, gzipped);
|
" File or directory names may not contain any of the following characters: '/ \\ : ~'"), sock, gzipped);
|
||||||
} else if (campaign && (*campaign)["passphrase"] != upload["passphrase"]) {
|
} else if (campaign && (*campaign)["passphrase"].str() != upload["passphrase"]) {
|
||||||
// the user password failed, now test for the master password, in master password
|
// the user password failed, now test for the master password, in master password
|
||||||
// mode the upload behaves different since it's only intended to update translations.
|
// mode the upload behaves different since it's only intended to update translations.
|
||||||
// In a later version the translations will be separated from the addon.
|
// In a later version the translations will be separated from the addon.
|
||||||
LOG_CS << "Upload is admin upload.\n";
|
LOG_CS << "Upload is admin upload.\n";
|
||||||
if (!campaigns()["master_password"].empty()
|
if (!campaigns()["master_password"].empty()
|
||||||
&& campaigns()["master_password"] == upload["passphrase"])
|
&& campaigns()["master_password"].str() == upload["passphrase"])
|
||||||
{
|
{
|
||||||
std::string message = "Add-on accepted.";
|
std::string message = "Add-on accepted.";
|
||||||
|
|
||||||
@ -585,7 +585,7 @@ namespace {
|
|||||||
|
|
||||||
(*campaign)["title"] = upload["title"];
|
(*campaign)["title"] = upload["title"];
|
||||||
(*campaign)["name"] = upload["name"];
|
(*campaign)["name"] = upload["name"];
|
||||||
(*campaign)["filename"] = "data/" + upload["name"];
|
(*campaign)["filename"] = "data/" + upload["name"].str();
|
||||||
(*campaign)["passphrase"] = upload["passphrase"];
|
(*campaign)["passphrase"] = upload["passphrase"];
|
||||||
(*campaign)["author"] = upload["author"];
|
(*campaign)["author"] = upload["author"];
|
||||||
(*campaign)["description"] = upload["description"];
|
(*campaign)["description"] = upload["description"];
|
||||||
|
@ -48,18 +48,18 @@ cave_map_generator::cave_map_generator(const config &cfg) :
|
|||||||
flipx_(false),
|
flipx_(false),
|
||||||
flipy_(false)
|
flipy_(false)
|
||||||
{
|
{
|
||||||
width_ = atoi(cfg_["map_width"].c_str());
|
width_ = cfg_["map_width"];
|
||||||
height_ = atoi(cfg_["map_height"].c_str());
|
height_ = cfg_["map_height"];
|
||||||
|
|
||||||
village_density_ = atoi(cfg_["village_density"].c_str());
|
village_density_ = cfg_["village_density"];
|
||||||
|
|
||||||
const int r = rand()%100;
|
int r = rand() % 100;
|
||||||
const int chance = atoi(cfg_["flipx_chance"].c_str());
|
int chance = cfg_["flipx_chance"];
|
||||||
|
|
||||||
flipx_ = r < chance;
|
flipx_ = r < chance;
|
||||||
|
|
||||||
LOG_NG << "flipx: " << r << " < " << chance << " = " << (flipx_ ? "true" : "false") << "\n";
|
LOG_NG << "flipx: " << r << " < " << chance << " = " << (flipx_ ? "true" : "false") << "\n";
|
||||||
flipy_ = (rand()%100) < atoi(cfg_["flipy_chance"].c_str());
|
flipy_ = rand() % 100 < cfg_["flipy_chance"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cave_map_generator::config_name() const
|
std::string cave_map_generator::config_name() const
|
||||||
|
@ -44,6 +44,11 @@ config::proxy_string &config::proxy_string::operator=(int v)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int config::proxy_string::to_int(int def) const
|
||||||
|
{
|
||||||
|
return lexical_cast_default(real_str_.c_str(), def);
|
||||||
|
}
|
||||||
|
|
||||||
config config::invalid;
|
config config::invalid;
|
||||||
|
|
||||||
const char* config::diff_track_attribute = "__diff_track";
|
const char* config::diff_track_attribute = "__diff_track";
|
||||||
|
@ -190,11 +190,13 @@ public:
|
|||||||
proxy_string& operator=(const t_string &str)
|
proxy_string& operator=(const t_string &str)
|
||||||
{ real_str_ = str; return *this; }
|
{ real_str_ = str; return *this; }
|
||||||
|
|
||||||
|
int to_int(int def = 0) const;
|
||||||
|
|
||||||
bool empty() const { return real_str_.empty(); }
|
bool empty() const { return real_str_.empty(); }
|
||||||
const char *c_str() const { return real_str_.c_str(); }
|
|
||||||
const std::string &str() const { return real_str_.str(); }
|
const std::string &str() const { return real_str_.str(); }
|
||||||
const t_string &t_str() const { return real_str_; }
|
const t_string &t_str() const { return real_str_; }
|
||||||
|
|
||||||
|
operator int() const { return to_int(); }
|
||||||
operator std::string() const { return real_str_.str(); }
|
operator std::string() const { return real_str_.str(); }
|
||||||
operator t_string() const { return real_str_; }
|
operator t_string() const { return real_str_; }
|
||||||
|
|
||||||
|
@ -1112,27 +1112,27 @@ WML_HANDLER_FUNCTION(set_variable, /*event_info*/, cfg)
|
|||||||
const std::string add = cfg["add"];
|
const std::string add = cfg["add"];
|
||||||
if(add.empty() == false) {
|
if(add.empty() == false) {
|
||||||
if(isint(var.str()) && isint(add)) {
|
if(isint(var.str()) && isint(add)) {
|
||||||
var = str_cast( std::atoi(var.c_str()) + std::atoi(add.c_str()) );
|
var = var.to_int() + atoi(add.c_str());
|
||||||
} else {
|
} else {
|
||||||
var = str_cast( std::atof(var.c_str()) + std::atof(add.c_str()) );
|
var = str_cast(atof(var.str().c_str()) + atof(add.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string sub = cfg["sub"];
|
const std::string sub = cfg["sub"];
|
||||||
if(sub.empty() == false) {
|
if(sub.empty() == false) {
|
||||||
if(isint(var.str()) && isint(sub)) {
|
if(isint(var.str()) && isint(sub)) {
|
||||||
var = str_cast( std::atoi(var.c_str()) - std::atoi(sub.c_str()) );
|
var = var.to_int() - atoi(sub.c_str());
|
||||||
} else {
|
} else {
|
||||||
var = str_cast( std::atof(var.c_str()) - std::atof(sub.c_str()) );
|
var = str_cast(atof(var.str().c_str()) - atof(sub.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string multiply = cfg["multiply"];
|
const std::string multiply = cfg["multiply"];
|
||||||
if(multiply.empty() == false) {
|
if(multiply.empty() == false) {
|
||||||
if(isint(var.str()) && isint(multiply)) {
|
if(isint(var.str()) && isint(multiply)) {
|
||||||
var = str_cast( std::atoi(var.c_str()) * std::atoi(multiply.c_str()) );
|
var = var.to_int() * atoi(multiply.c_str());
|
||||||
} else {
|
} else {
|
||||||
var = str_cast( std::atof(var.c_str()) * std::atof(multiply.c_str()) );
|
var = str_cast(atof(var.str().c_str()) * atof(multiply.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1143,9 +1143,9 @@ WML_HANDLER_FUNCTION(set_variable, /*event_info*/, cfg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(isint(var.str()) && isint(divide)) {
|
if(isint(var.str()) && isint(divide)) {
|
||||||
var = str_cast( std::atoi(var.c_str()) / std::atoi(divide.c_str()) );
|
var = var.to_int() / atoi(divide.c_str());
|
||||||
} else {
|
} else {
|
||||||
var = str_cast( std::atof(var.c_str()) / std::atof(divide.c_str()) );
|
var = str_cast(atof(var.str().c_str()) / atof(divide.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1156,16 +1156,16 @@ WML_HANDLER_FUNCTION(set_variable, /*event_info*/, cfg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(isint(var.str()) && isint(modulo)) {
|
if(isint(var.str()) && isint(modulo)) {
|
||||||
var = str_cast( std::atoi(var.c_str()) % std::atoi(modulo.c_str()) );
|
var = var.to_int() % atoi(modulo.c_str());
|
||||||
} else {
|
} else {
|
||||||
double value = std::fmod( std::atof(var.c_str()), std::atof(modulo.c_str()) );
|
double value = std::fmod(atof(var.str().c_str()), atof(modulo.c_str()));
|
||||||
var = str_cast(value);
|
var = str_cast(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string round_val = cfg["round"];
|
const std::string round_val = cfg["round"];
|
||||||
if(round_val.empty() == false) {
|
if(round_val.empty() == false) {
|
||||||
double value = std::atof(var.c_str());
|
double value = atof(var.str().c_str());
|
||||||
if (round_val == "ceil") {
|
if (round_val == "ceil") {
|
||||||
value = std::ceil(value);
|
value = std::ceil(value);
|
||||||
} else if (round_val == "floor") {
|
} else if (round_val == "floor") {
|
||||||
|
@ -321,7 +321,7 @@ static server_type open_connection(game_display& disp, const std::string& origin
|
|||||||
} else if((*error)["error_code"] == MP_INCORRECT_PASSWORD_ERROR) {
|
} else if((*error)["error_code"] == MP_INCORRECT_PASSWORD_ERROR) {
|
||||||
error_message = _("The password you provided was incorrect.");
|
error_message = _("The password you provided was incorrect.");
|
||||||
} else {
|
} else {
|
||||||
error_message = (*error)["message"];
|
error_message = (*error)["message"].str();
|
||||||
}
|
}
|
||||||
|
|
||||||
gui2::tmp_login dlg(error_message, !((*error)["password_request"].empty()));
|
gui2::tmp_login dlg(error_message, !((*error)["password_request"].empty()));
|
||||||
|
@ -1559,7 +1559,7 @@ void connect::load_game()
|
|||||||
} else {
|
} else {
|
||||||
level_.clear();
|
level_.clear();
|
||||||
params_.saved_game = false;
|
params_.saved_game = false;
|
||||||
params_.mp_scenario = params_.scenario_data["id"];
|
params_.mp_scenario = params_.scenario_data["id"].str();
|
||||||
level_.merge_with(params_.scenario_data);
|
level_.merge_with(params_.scenario_data);
|
||||||
level_["turns"] = num_turns_;
|
level_["turns"] = num_turns_;
|
||||||
level_.add_child("multiplayer", params_.to_config());
|
level_.add_child("multiplayer", params_.to_config());
|
||||||
@ -1585,7 +1585,7 @@ void connect::load_game()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the map name to the title.
|
// Add the map name to the title.
|
||||||
append_to_title(" - " + level_["name"]);
|
append_to_title(" - " + level_["name"].t_str());
|
||||||
|
|
||||||
|
|
||||||
std::string era = params_.mp_era;
|
std::string era = params_.mp_era;
|
||||||
@ -1668,7 +1668,7 @@ void connect::update_and_send_diff(bool update_time_of_day)
|
|||||||
if (update_time_of_day)
|
if (update_time_of_day)
|
||||||
{
|
{
|
||||||
// Set random start ToD
|
// Set random start ToD
|
||||||
tod_manager tod_mng(level_,atoi(level_["turns"].c_str()),&state_);
|
tod_manager tod_mng(level_, level_["turns"], &state_);
|
||||||
}
|
}
|
||||||
|
|
||||||
config diff = level_.get_diff(old_level);
|
config diff = level_.get_diff(old_level);
|
||||||
|
@ -124,8 +124,8 @@ void level_to_gamestate(config& level, game_state& state)
|
|||||||
|
|
||||||
level["campaign_type"] = "multiplayer";
|
level["campaign_type"] = "multiplayer";
|
||||||
state.classification().campaign_type = "multiplayer";
|
state.classification().campaign_type = "multiplayer";
|
||||||
state.classification().completion = level["completion"];
|
state.classification().completion = level["completion"].str();
|
||||||
state.classification().version = level["version"];
|
state.classification().version = level["version"].str();
|
||||||
|
|
||||||
if (const config &vars = level.child("variables")) {
|
if (const config &vars = level.child("variables")) {
|
||||||
state.set_variables(vars);
|
state.set_variables(vars);
|
||||||
|
@ -209,7 +209,7 @@ void wait::join_game(bool observe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the map name to the title.
|
// Add the map name to the title.
|
||||||
append_to_title(": " + level_["name"]);
|
append_to_title(": " + level_["name"].t_str());
|
||||||
|
|
||||||
if (!observe) {
|
if (!observe) {
|
||||||
//search for an appropriate vacant slot. If a description is set
|
//search for an appropriate vacant slot. If a description is set
|
||||||
|
@ -91,7 +91,7 @@ void play_replay(display& disp, game_state& gamestate, const config& game_config
|
|||||||
try {
|
try {
|
||||||
// Preserve old label eg. replay
|
// Preserve old label eg. replay
|
||||||
if (gamestate.classification().label.empty())
|
if (gamestate.classification().label.empty())
|
||||||
gamestate.classification().label = starting_pos["name"];
|
gamestate.classification().label = starting_pos["name"].str();
|
||||||
//if (gamestate.abbrev.empty())
|
//if (gamestate.abbrev.empty())
|
||||||
// gamestate.abbrev = (*scenario)["abbrev"];
|
// gamestate.abbrev = (*scenario)["abbrev"];
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
|
|||||||
gamestate.set_menu_items(gamestate.snapshot.child_range("menu_item"));
|
gamestate.set_menu_items(gamestate.snapshot.child_range("menu_item"));
|
||||||
// Replace game label with that from snapshot
|
// Replace game label with that from snapshot
|
||||||
if (!gamestate.snapshot["label"].empty()){
|
if (!gamestate.snapshot["label"].empty()){
|
||||||
gamestate.classification().label = gamestate.snapshot["label"];
|
gamestate.classification().label = gamestate.snapshot["label"].str();
|
||||||
}
|
}
|
||||||
// Helper for transitioning middle-of-scenario savefiles from 1.6 to 1.8.
|
// Helper for transitioning middle-of-scenario savefiles from 1.6 to 1.8.
|
||||||
// To be removed for 1.10.
|
// To be removed for 1.10.
|
||||||
@ -497,7 +497,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
|
|||||||
{
|
{
|
||||||
std::string id = side["save_id"];
|
std::string id = side["save_id"];
|
||||||
if(id.empty()) {
|
if(id.empty()) {
|
||||||
id = side["id"];
|
id = side["id"].str();
|
||||||
}
|
}
|
||||||
if(!id.empty()) {
|
if(!id.empty()) {
|
||||||
/* Update side info to match current_player info
|
/* Update side info to match current_player info
|
||||||
|
@ -320,7 +320,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
|
|||||||
// Log before prestart events: they do weird things.
|
// Log before prestart events: they do weird things.
|
||||||
if (first_human_team_ != -1) { //sp logs
|
if (first_human_team_ != -1) { //sp logs
|
||||||
log.start(gamestate_, teams_[first_human_team_],
|
log.start(gamestate_, teams_[first_human_team_],
|
||||||
loading_game_ ? gamestate_.get_variable("turn_number").c_str() : "",
|
loading_game_ ? gamestate_.get_variable("turn_number").str().c_str() : "",
|
||||||
number_of_turns(), resources::game_map->write());
|
number_of_turns(), resources::game_map->write());
|
||||||
} else { //ai vs. ai upload logs
|
} else { //ai vs. ai upload logs
|
||||||
log.start(gamestate_, resources::game_map->write());
|
log.start(gamestate_, resources::game_map->write());
|
||||||
|
@ -450,11 +450,11 @@ void loadgame::load_game(std::string& filename, bool show_replay, bool cancel_or
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gamestate_.classification().difficulty = load_config_["difficulty"];
|
gamestate_.classification().difficulty = load_config_["difficulty"].str();
|
||||||
gamestate_.classification().campaign_define = load_config_["campaign_define"];
|
gamestate_.classification().campaign_define = load_config_["campaign_define"].str();
|
||||||
gamestate_.classification().campaign_type = load_config_["campaign_type"];
|
gamestate_.classification().campaign_type = load_config_["campaign_type"].str();
|
||||||
gamestate_.classification().campaign_xtra_defines = utils::split(load_config_["campaign_extra_defines"]);
|
gamestate_.classification().campaign_xtra_defines = utils::split(load_config_["campaign_extra_defines"]);
|
||||||
gamestate_.classification().version = load_config_["version"];
|
gamestate_.classification().version = load_config_["version"].str();
|
||||||
|
|
||||||
check_version_compatibility();
|
check_version_compatibility();
|
||||||
|
|
||||||
|
@ -439,14 +439,14 @@ void server::load_config() {
|
|||||||
input_.reset(new input_stream(fifo_path));
|
input_.reset(new input_stream(fifo_path));
|
||||||
|
|
||||||
save_replays_ = utils::string_bool(cfg_["save_replays"], false);
|
save_replays_ = utils::string_bool(cfg_["save_replays"], false);
|
||||||
replay_save_path_ = cfg_["replay_save_path"];
|
replay_save_path_ = cfg_["replay_save_path"].str();
|
||||||
|
|
||||||
tor_ip_list_ = utils::split(cfg_["tor_ip_list_path"].empty() ? "" : read_file(cfg_["tor_ip_list_path"]), '\n');
|
tor_ip_list_ = utils::split(cfg_["tor_ip_list_path"].empty() ? "" : read_file(cfg_["tor_ip_list_path"]), '\n');
|
||||||
|
|
||||||
admin_passwd_ = cfg_["passwd"];
|
admin_passwd_ = cfg_["passwd"].str();
|
||||||
motd_ = cfg_["motd"];
|
motd_ = cfg_["motd"].str();
|
||||||
lan_server_ = lexical_cast_default<time_t>(cfg_["lan_server"], 0);
|
lan_server_ = lexical_cast_default<time_t>(cfg_["lan_server"], 0);
|
||||||
uh_name_ = cfg_["user_handler"];
|
uh_name_ = cfg_["user_handler"].str();
|
||||||
|
|
||||||
deny_unregistered_login_ = utils::string_bool(cfg_["deny_unregistered_login"], false);
|
deny_unregistered_login_ = utils::string_bool(cfg_["deny_unregistered_login"], false);
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ void server::load_config() {
|
|||||||
// Example config line:
|
// Example config line:
|
||||||
// restart_command="./wesnothd-debug -d -c ~/.wesnoth1.5/server.cfg"
|
// restart_command="./wesnothd-debug -d -c ~/.wesnoth1.5/server.cfg"
|
||||||
// remember to make new one as a daemon or it will block old one
|
// remember to make new one as a daemon or it will block old one
|
||||||
restart_command = cfg_["restart_command"];
|
restart_command = cfg_["restart_command"].str();
|
||||||
|
|
||||||
fps_limit_.set_ms_per_frame(lexical_cast_default<size_t>(cfg_["ms_per_frame"], 20));
|
fps_limit_.set_ms_per_frame(lexical_cast_default<size_t>(cfg_["ms_per_frame"], 20));
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ static stats::battle_result_map read_battle_result_map(const config& cfg)
|
|||||||
foreach (const config &i, cfg.child_range("sequence"))
|
foreach (const config &i, cfg.child_range("sequence"))
|
||||||
{
|
{
|
||||||
config item = i;
|
config item = i;
|
||||||
const int key = atoi(item["_num"].c_str());
|
int key = item["_num"];
|
||||||
item.remove_attribute("_num");
|
item.remove_attribute("_num");
|
||||||
m[key] = read_str_int_map(item);
|
m[key] = read_str_int_map(item);
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ theme::menu* theme::refresh_title(const std::string& id, const std::string& new_
|
|||||||
theme::menu* theme::refresh_title2(const std::string& id, const std::string& title_tag){
|
theme::menu* theme::refresh_title2(const std::string& id, const std::string& title_tag){
|
||||||
std::string new_title;
|
std::string new_title;
|
||||||
|
|
||||||
config& cfg = find_ref(id, cfg_, false);
|
const config &cfg = find_ref(id, cfg_, false);
|
||||||
if (! cfg[title_tag].empty())
|
if (! cfg[title_tag].empty())
|
||||||
new_title = cfg[title_tag];
|
new_title = cfg[title_tag];
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void tod_manager::set_start_ToD(config &level, int current_turn)
|
|||||||
{
|
{
|
||||||
if (!level["current_tod"].empty())
|
if (!level["current_tod"].empty())
|
||||||
{
|
{
|
||||||
set_time_of_day(atoi(level["current_tod"].c_str()));
|
set_time_of_day(level["current_tod"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string random_start_time = level["random_start_time"];
|
std::string random_start_time = level["random_start_time"];
|
||||||
|
@ -2517,12 +2517,12 @@ void unit::add_modification(const std::string& type, const config& mod, bool no_
|
|||||||
// Apply variations -- only apply if we are adding this for the first time.
|
// Apply variations -- only apply if we are adding this for the first time.
|
||||||
if (!last_effect.empty() && no_add == false) {
|
if (!last_effect.empty() && no_add == false) {
|
||||||
if ((last_effect)["apply_to"] == "variation") {
|
if ((last_effect)["apply_to"] == "variation") {
|
||||||
variation_ = (last_effect)["name"];
|
variation_ = last_effect["name"].str();
|
||||||
advance_to(this->type());
|
advance_to(this->type());
|
||||||
} else if ((last_effect)["apply_to"] == "type") {
|
} else if ((last_effect)["apply_to"] == "type") {
|
||||||
if (!new_child->has_attribute("prev_type"))
|
if (!new_child->has_attribute("prev_type"))
|
||||||
(*new_child)["prev_type"] = type_id();
|
(*new_child)["prev_type"] = type_id();
|
||||||
type_ = (last_effect)["name"];
|
type_ = last_effect["name"].str();
|
||||||
int hit_points = hit_points_;
|
int hit_points = hit_points_;
|
||||||
int experience = experience_;
|
int experience = experience_;
|
||||||
int movement = movement_;
|
int movement = movement_;
|
||||||
|
@ -692,8 +692,8 @@ unit_type::~unit_type()
|
|||||||
|
|
||||||
void unit_type::set_config(const config& cfg)
|
void unit_type::set_config(const config& cfg)
|
||||||
{
|
{
|
||||||
cfg_ = cfg;
|
cfg_ = cfg;
|
||||||
id_ = cfg_["id"];
|
id_ = cfg["id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
void unit_type::build_full(const config& cfg, const movement_type_map& mv_types,
|
void unit_type::build_full(const config& cfg, const movement_type_map& mv_types,
|
||||||
@ -800,10 +800,10 @@ void unit_type::build_help_index(const config& cfg, const movement_type_map& mv_
|
|||||||
movement_ = lexical_cast_default<int>(cfg["movement"], 1);
|
movement_ = lexical_cast_default<int>(cfg["movement"], 1);
|
||||||
max_attacks_ = lexical_cast_default<int>(cfg["attacks"], 1);
|
max_attacks_ = lexical_cast_default<int>(cfg["attacks"], 1);
|
||||||
cost_ = lexical_cast_default<int>(cfg["cost"], 1);
|
cost_ = lexical_cast_default<int>(cfg["cost"], 1);
|
||||||
usage_ = cfg_["usage"];
|
usage_ = cfg_["usage"].str();
|
||||||
undead_variation_ = cfg_["undead_variation"];
|
undead_variation_ = cfg_["undead_variation"].str();
|
||||||
image_ = cfg_["image"];
|
image_ = cfg_["image"].str();
|
||||||
image_profile_ = cfg_["profile"];
|
image_profile_ = cfg_["profile"].str();
|
||||||
|
|
||||||
const race_map::const_iterator race_it = races.find(cfg["race"]);
|
const race_map::const_iterator race_it = races.find(cfg["race"]);
|
||||||
if(race_it != races.end()) {
|
if(race_it != races.end()) {
|
||||||
@ -1168,7 +1168,7 @@ void unit_type_data::set_config(config &cfg)
|
|||||||
merge_cfg.clear_children("base_unit");
|
merge_cfg.clear_children("base_unit");
|
||||||
std::string id = merge_cfg["id"];
|
std::string id = merge_cfg["id"];
|
||||||
if(id.empty()) {
|
if(id.empty()) {
|
||||||
id = from_cfg["name"];
|
id = from_cfg["name"].str();
|
||||||
}
|
}
|
||||||
|
|
||||||
ut = merge_cfg;
|
ut = merge_cfg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user