Removed hardcoding of boolean names when storing values into config object.
This commit is contained in:
parent
445b143754
commit
01e0010adf
35 changed files with 153 additions and 147 deletions
|
@ -1321,8 +1321,8 @@ bool attack::perform_hit(bool attacker_turn, statistics::attack_context &stats)
|
|||
{
|
||||
log_scope2(log_engine, "setting random results");
|
||||
config cfg;
|
||||
cfg["hits"] = hits ? "yes" : "no";
|
||||
cfg["dies"] = dies ? "yes" : "no";
|
||||
cfg["hits"] = hits;
|
||||
cfg["dies"] = dies;
|
||||
cfg["unit_hit"] = "defender";
|
||||
cfg["damage"] = lexical_cast<std::string>(damage);
|
||||
cfg["chance"] = lexical_cast<std::string>(attacker.cth_);
|
||||
|
|
|
@ -131,10 +131,10 @@ bool aspect::redeploy(const config &cfg, const std::string& /*id*/)
|
|||
config aspect::to_config() const
|
||||
{
|
||||
config cfg;
|
||||
cfg["invalidate_on_turn_start"] = invalidate_on_turn_start_ ? "yes" : "no";
|
||||
cfg["invalidate_on_tod_change"] = invalidate_on_tod_change_ ? "yes" : "no";
|
||||
cfg["invalidate_on_gamestate_change"] = invalidate_on_gamestate_change_ ? "yes" : "no";
|
||||
cfg["invalidate_on_minor_gamestate_change"] = invalidate_on_minor_gamestate_change_ ? "yes" : "no";
|
||||
cfg["invalidate_on_turn_start"] = invalidate_on_turn_start_;
|
||||
cfg["invalidate_on_tod_change"] = invalidate_on_tod_change_;
|
||||
cfg["invalidate_on_gamestate_change"] = invalidate_on_gamestate_change_;
|
||||
cfg["invalidate_on_minor_gamestate_change"] = invalidate_on_minor_gamestate_change_;
|
||||
cfg["engine"] = engine_;
|
||||
cfg["name"] = name_;
|
||||
cfg["id"] = id_;
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
|
||||
static void value_to_cfg(const bool &value, config &cfg)
|
||||
{
|
||||
cfg["value"] = value ? "yes" : "no";
|
||||
cfg["value"] = value;
|
||||
}
|
||||
|
||||
static config value_to_cfg(const bool &value)
|
||||
|
|
|
@ -356,7 +356,7 @@ bool configuration::upgrade_side_config_from_1_07_02_to_1_07_03(side_number side
|
|||
if (aiparam.has_attribute("protect_leader")) {
|
||||
config c;
|
||||
c["value"] = aiparam["protect_leader"];
|
||||
c["canrecruit"] = "yes";
|
||||
c["canrecruit"] = true;
|
||||
c["side_number"] = str_cast(side);
|
||||
if (aiparam.has_attribute("protect_leader_radius")) {
|
||||
c["radius"] = aiparam["protect_leader_radius"];
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
static lg::log_domain log_config("config");
|
||||
#define ERR_CF LOG_STREAM(err, log_config)
|
||||
|
||||
config::proxy_string &config::proxy_string::operator=(bool b)
|
||||
{
|
||||
real_str_ = b ? "yes" : "no";
|
||||
return *this;
|
||||
}
|
||||
|
||||
config config::invalid;
|
||||
|
||||
const char* config::diff_track_attribute = "__diff_track";
|
||||
|
|
|
@ -186,6 +186,7 @@ public:
|
|||
proxy_string &operator=(const proxy_string &other)
|
||||
{ return this->operator=(other.real_str_); }
|
||||
|
||||
proxy_string &operator=(bool);
|
||||
proxy_string& operator=(const char *str)
|
||||
{ real_str_ = str; return *this; }
|
||||
proxy_string& operator=(const t_string &str)
|
||||
|
|
|
@ -343,7 +343,7 @@ void save_preview_pane::draw_contents()
|
|||
savegame::manager::load_summary((*info_)[index_].name, summary, &dummy);
|
||||
*summaries_[index_] = summary;
|
||||
} catch(game::load_game_failed&) {
|
||||
summary["corrupt"] = "yes";
|
||||
summary["corrupt"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace editor {
|
|||
}
|
||||
|
||||
void set_use_mdi(bool value) {
|
||||
preferences::set("editor_use_mdi", value ? "yes" : "no");
|
||||
preferences::set("editor_use_mdi", value);
|
||||
}
|
||||
|
||||
std::string default_dir() {
|
||||
|
@ -50,7 +50,7 @@ namespace editor {
|
|||
}
|
||||
|
||||
void set_draw_terrain_codes(bool value) {
|
||||
preferences::set("editor_draw_terrain_codes", value ? "yes" : "no");
|
||||
preferences::set("editor_draw_terrain_codes", value);
|
||||
}
|
||||
|
||||
bool draw_hex_coordinates() {
|
||||
|
@ -58,7 +58,7 @@ namespace editor {
|
|||
}
|
||||
|
||||
void set_draw_hex_coordinates(bool value) {
|
||||
preferences::set("editor_draw_hex_coordinates", value ? "yes" : "no");
|
||||
preferences::set("editor_draw_hex_coordinates", value);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -802,7 +802,7 @@ bool game_controller::play_multiplayer_mode()
|
|||
snprintf(buf,sizeof(buf),"%d",side_num);
|
||||
s["side"] = buf;
|
||||
|
||||
s["canrecruit"] = "yes";
|
||||
s["canrecruit"] = true;
|
||||
|
||||
s.append(*side);
|
||||
|
||||
|
|
|
@ -1003,7 +1003,7 @@ void game_display::write_overlays(config& cfg) const
|
|||
item["image"] = i->second.image;
|
||||
item["halo"] = i->second.halo;
|
||||
item["team_name"] = i->second.team_name;
|
||||
item["visible_in_fog"] = i->second.visible_in_fog ? "yes" : "no";
|
||||
item["visible_in_fog"] = i->second.visible_in_fog;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3194,7 +3194,7 @@ static void commit_wmi_commands() {
|
|||
|
||||
mref->command = *(wcc.second);
|
||||
mref->command["name"] = mref->name;
|
||||
mref->command["first_time_only"] = "no";
|
||||
mref->command["first_time_only"] = false;
|
||||
|
||||
if(has_current_handler) {
|
||||
if(is_empty_command) {
|
||||
|
|
|
@ -386,7 +386,7 @@ bool remember_password()
|
|||
|
||||
void set_remember_password(bool remember)
|
||||
{
|
||||
preferences::set("remember_password", remember ? "yes" : "no");
|
||||
preferences::set("remember_password", remember);
|
||||
preferences::set("password", remember ? prv::password : "");
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ bool turn_dialog()
|
|||
|
||||
void set_turn_dialog(bool ison)
|
||||
{
|
||||
preferences::set("turn_dialog", ison ? "yes" : "no");
|
||||
preferences::set("turn_dialog", ison);
|
||||
}
|
||||
|
||||
bool delay_shroud_updates_on_start()
|
||||
|
@ -407,7 +407,7 @@ bool delay_shroud_updates_on_start()
|
|||
|
||||
void set_delay_shroud_updates_on_start(bool value)
|
||||
{
|
||||
preferences::set("delay_shroud_updates_on_start", value ? "yes" : "no");
|
||||
preferences::set("delay_shroud_updates_on_start", value);
|
||||
}
|
||||
|
||||
bool show_combat()
|
||||
|
@ -422,7 +422,7 @@ bool allow_observers()
|
|||
|
||||
void set_allow_observers(bool value)
|
||||
{
|
||||
preferences::set("allow_observers", value ? "yes" : "no");
|
||||
preferences::set("allow_observers", value);
|
||||
}
|
||||
|
||||
bool use_map_settings()
|
||||
|
@ -432,7 +432,7 @@ bool use_map_settings()
|
|||
|
||||
void set_use_map_settings(bool value)
|
||||
{
|
||||
preferences::set("mp_use_map_settings", value ? "yes" : "no");
|
||||
preferences::set("mp_use_map_settings", value);
|
||||
}
|
||||
|
||||
int mp_server_warning_disabled()
|
||||
|
@ -469,7 +469,7 @@ bool random_start_time()
|
|||
|
||||
void set_random_start_time(bool value)
|
||||
{
|
||||
preferences::set("mp_random_start_time", value ? "yes" : "no");
|
||||
preferences::set("mp_random_start_time", value);
|
||||
}
|
||||
|
||||
bool fog()
|
||||
|
@ -479,7 +479,7 @@ bool fog()
|
|||
|
||||
void set_fog(bool value)
|
||||
{
|
||||
preferences::set("mp_fog", value ? "yes" : "no");
|
||||
preferences::set("mp_fog", value);
|
||||
}
|
||||
|
||||
bool shroud()
|
||||
|
@ -489,7 +489,7 @@ bool shroud()
|
|||
|
||||
void set_shroud(bool value)
|
||||
{
|
||||
preferences::set("mp_shroud", value ? "yes" : "no");
|
||||
preferences::set("mp_shroud", value);
|
||||
}
|
||||
|
||||
int turns()
|
||||
|
@ -509,7 +509,7 @@ bool skip_mp_replay()
|
|||
|
||||
void set_skip_mp_replay(bool value)
|
||||
{
|
||||
preferences::set("skip_mp_replay", value ? "yes" : "no");
|
||||
preferences::set("skip_mp_replay", value);
|
||||
}
|
||||
|
||||
bool countdown()
|
||||
|
@ -519,7 +519,7 @@ bool countdown()
|
|||
|
||||
void set_countdown(bool value)
|
||||
{
|
||||
preferences::set("mp_countdown", value ? "yes" : "no");
|
||||
preferences::set("mp_countdown", value);
|
||||
}
|
||||
|
||||
int countdown_init_time()
|
||||
|
@ -613,12 +613,12 @@ bool show_ai_moves()
|
|||
|
||||
void set_show_ai_moves(bool value)
|
||||
{
|
||||
preferences::set("show_ai_moves", value ? "yes" : "no");
|
||||
preferences::set("show_ai_moves", value);
|
||||
}
|
||||
|
||||
void set_show_side_colours(bool value)
|
||||
{
|
||||
preferences::set("show_side_colours", value ? "yes" : "no");
|
||||
preferences::set("show_side_colours", value);
|
||||
}
|
||||
|
||||
bool show_side_colours()
|
||||
|
@ -628,7 +628,7 @@ bool show_side_colours()
|
|||
|
||||
void set_save_replays(bool value)
|
||||
{
|
||||
preferences::set("save_replays", value ? "yes" : "no");
|
||||
preferences::set("save_replays", value);
|
||||
}
|
||||
|
||||
bool save_replays()
|
||||
|
@ -638,7 +638,7 @@ bool save_replays()
|
|||
|
||||
void set_delete_saves(bool value)
|
||||
{
|
||||
preferences::set("delete_saves", value ? "yes" : "no");
|
||||
preferences::set("delete_saves", value);
|
||||
}
|
||||
|
||||
bool delete_saves()
|
||||
|
@ -648,7 +648,7 @@ bool delete_saves()
|
|||
|
||||
void set_ask_delete_saves(bool value)
|
||||
{
|
||||
preferences::set("ask_delete", value ? "yes" : "no");
|
||||
preferences::set("ask_delete", value);
|
||||
}
|
||||
|
||||
bool ask_delete_saves()
|
||||
|
@ -658,7 +658,7 @@ bool ask_delete_saves()
|
|||
|
||||
void set_interrupt_when_ally_sighted(bool value)
|
||||
{
|
||||
preferences::set("ally_sighted_interrupts", value ? "yes" : "no");
|
||||
preferences::set("ally_sighted_interrupts", value);
|
||||
}
|
||||
|
||||
bool interrupt_when_ally_sighted()
|
||||
|
@ -719,7 +719,7 @@ bool show_floating_labels()
|
|||
|
||||
void set_show_floating_labels(bool value)
|
||||
{
|
||||
preferences::set("floating_labels", value ? "yes" : "no");
|
||||
preferences::set("floating_labels", value);
|
||||
}
|
||||
|
||||
bool message_private()
|
||||
|
@ -740,7 +740,7 @@ bool show_haloes()
|
|||
void set_show_haloes(bool value)
|
||||
{
|
||||
haloes = value;
|
||||
preferences::set("show_haloes", value ? "yes" : "no");
|
||||
preferences::set("show_haloes", value);
|
||||
}
|
||||
|
||||
bool flip_time()
|
||||
|
@ -750,7 +750,7 @@ bool flip_time()
|
|||
|
||||
void set_flip_time(bool value)
|
||||
{
|
||||
preferences::set("flip_time", value ? "yes" : "no");
|
||||
preferences::set("flip_time", value);
|
||||
}
|
||||
|
||||
bool has_upload_log()
|
||||
|
@ -765,7 +765,7 @@ bool upload_log()
|
|||
|
||||
void set_upload_log(bool value)
|
||||
{
|
||||
preferences::set("upload_log_new", value ? "yes" : "no");
|
||||
preferences::set("upload_log_new", value);
|
||||
}
|
||||
|
||||
std::string upload_id()
|
||||
|
@ -803,7 +803,7 @@ bool chat_timestamping() {
|
|||
}
|
||||
|
||||
void set_chat_timestamping(bool value) {
|
||||
preferences::set("chat_timestamp", value ? "yes" : "no");
|
||||
preferences::set("chat_timestamp", value);
|
||||
}
|
||||
|
||||
int chat_lines()
|
||||
|
|
|
@ -978,7 +978,7 @@ void preferences_dialog::process_event()
|
|||
if(adv != NULL) {
|
||||
const config& pref = *adv;
|
||||
preferences::set(pref["field"],
|
||||
advanced_button_.checked() ? "yes" : "no");
|
||||
advanced_button_.checked());
|
||||
set_advanced_menu();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ void game_state::write_snapshot(config& cfg) const
|
|||
new_cfg["id"]=j->first;
|
||||
new_cfg["image"]=j->second->image;
|
||||
new_cfg["description"]=j->second->description;
|
||||
new_cfg["needs_select"]= (j->second->needs_select) ? "yes" : "no";
|
||||
new_cfg["needs_select"] = j->second->needs_select;
|
||||
if(!j->second->show_if.empty())
|
||||
new_cfg.add_child("show_if", j->second->show_if);
|
||||
if(!j->second->filter_location.empty())
|
||||
|
@ -378,8 +378,8 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
|
|||
const bool has_replay = cfg_replay && !cfg_replay.empty();
|
||||
const bool has_snapshot = cfg_snapshot && cfg_snapshot.child("side");
|
||||
|
||||
cfg_summary["replay"] = has_replay ? "yes" : "no";
|
||||
cfg_summary["snapshot"] = has_snapshot ? "yes" : "no";
|
||||
cfg_summary["replay"] = has_replay;
|
||||
cfg_summary["snapshot"] = has_snapshot;
|
||||
|
||||
cfg_summary["label"] = cfg_save["label"];
|
||||
cfg_summary["parent"] = cfg_save["parent"];
|
||||
|
@ -869,7 +869,7 @@ protected:
|
|||
leader_cfg_ = side_cfg_;
|
||||
|
||||
if (!leader_cfg_.has_attribute("canrecruit")){
|
||||
leader_cfg_["canrecruit"] = "yes";
|
||||
leader_cfg_["canrecruit"] = true;
|
||||
}
|
||||
if (!leader_cfg_.has_attribute("placement")){
|
||||
leader_cfg_["placement"] = "map,leader";
|
||||
|
|
|
@ -1541,7 +1541,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["observe"] = observe ? "yes" : "no";
|
||||
join["observe"] = observe;
|
||||
if (join && !observe && game.password_required) {
|
||||
std::string password;
|
||||
//TODO replace with a gui2 dialog
|
||||
|
|
|
@ -474,13 +474,13 @@ void save_hotkeys(config& cfg)
|
|||
|
||||
if (i->get_type() == hotkey_item::BY_KEYCODE) {
|
||||
item["key"] = SDL_GetKeyName(SDLKey(i->get_keycode()));
|
||||
item["shift"] = i->get_shift() ? "yes" : "no";
|
||||
item["shift"] = i->get_shift();
|
||||
} else if (i->get_type() == hotkey_item::BY_CHARACTER) {
|
||||
item["key"] = utils::wchar_to_string(i->get_character());
|
||||
}
|
||||
item["alt"] = i->get_alt() ? "yes" : "no";
|
||||
item["ctrl"] = i->get_ctrl() ? "yes" : "no";
|
||||
item["cmd"] = i->get_cmd() ? "yes" : "no";
|
||||
item["alt"] = i->get_alt();
|
||||
item["ctrl"] = i->get_ctrl();
|
||||
item["cmd"] = i->get_cmd();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ bool lobby_sounds()
|
|||
|
||||
void set_lobby_sounds(bool v)
|
||||
{
|
||||
preferences::set("lobby_sounds", v ? "yes" : "no");
|
||||
preferences::set("lobby_sounds", v);
|
||||
}
|
||||
|
||||
bool sort_list()
|
||||
|
@ -36,7 +36,7 @@ bool sort_list()
|
|||
|
||||
void _set_sort_list(bool sort)
|
||||
{
|
||||
preferences::set("sort_list", sort ? "yes" : "no");
|
||||
preferences::set("sort_list", sort);
|
||||
}
|
||||
|
||||
bool iconize_list()
|
||||
|
@ -46,7 +46,7 @@ bool iconize_list()
|
|||
|
||||
void _set_iconize_list(bool sort)
|
||||
{
|
||||
preferences::set("iconize_list", sort ? "yes" : "no");
|
||||
preferences::set("iconize_list", sort);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -353,8 +353,8 @@ void terrain_label::write(config& cfg) const
|
|||
cfg["text"] = text();
|
||||
cfg["team_name"] = (this->team_name());
|
||||
cfg["colour"] = cfg_colour();
|
||||
cfg["visible_in_fog"] = visible_in_fog() ? "yes" : "no";
|
||||
cfg["visible_in_shroud"] = visible_in_shroud() ? "yes" : "no";
|
||||
cfg["visible_in_fog"] = visible_in_fog_;
|
||||
cfg["visible_in_shroud"] = visible_in_shroud_;
|
||||
}
|
||||
|
||||
const std::string& terrain_label::text() const
|
||||
|
|
|
@ -3433,7 +3433,7 @@ void menu_handler::change_side_controller(const std::string& side, const std::st
|
|||
change["player"] = player;
|
||||
|
||||
if(own_side) {
|
||||
change["own_side"] = "yes";
|
||||
change["own_side"] = true;
|
||||
}
|
||||
|
||||
network::send_data(cfg, 0, true);
|
||||
|
|
|
@ -153,17 +153,17 @@ config mp_game_settings::to_config() const
|
|||
cfg["mp_era"] = mp_era;
|
||||
cfg["mp_scenario"] = mp_scenario;
|
||||
cfg["experience_modifier"] = lexical_cast<std::string>(xp_modifier);
|
||||
cfg["mp_countdown"] = mp_countdown ? "yes" : "no";
|
||||
cfg["mp_countdown"] = mp_countdown;
|
||||
cfg["mp_countdown_init_time"] = lexical_cast_default<std::string>(mp_countdown_init_time, "270");
|
||||
cfg["mp_countdown_turn_bonus"] = lexical_cast_default<std::string>(mp_countdown_turn_bonus, "35");
|
||||
cfg["mp_countdown_reservoir_time"] = lexical_cast_default<std::string>(mp_countdown_reservoir_time, "330");
|
||||
cfg["mp_countdown_action_bonus"] = lexical_cast_default<std::string>(mp_countdown_action_bonus, "13");
|
||||
cfg["mp_village_gold"] = lexical_cast<std::string>(village_gold);
|
||||
cfg["mp_fog"] = fog_game ? "yes" : "no";
|
||||
cfg["mp_shroud"] = shroud_game ? "yes" : "no";
|
||||
cfg["mp_use_map_settings"] = use_map_settings ? "yes" : "no";
|
||||
cfg["observer"] = allow_observers ? "yes" : "no";
|
||||
cfg["savegame"] = saved_game ? "yes" : "no";
|
||||
cfg["mp_fog"] = fog_game;
|
||||
cfg["mp_shroud"] = shroud_game;
|
||||
cfg["mp_use_map_settings"] = use_map_settings;
|
||||
cfg["observer"] = allow_observers;
|
||||
cfg["savegame"] = saved_game;
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
|
|
@ -685,7 +685,7 @@ config connect::side::get_config() const
|
|||
break;
|
||||
case CNTR_EMPTY:
|
||||
description = N_("(Empty slot)");
|
||||
res["no_leader"] = "yes";
|
||||
res["no_leader"] = true;
|
||||
break;
|
||||
case CNTR_RESERVED:
|
||||
{
|
||||
|
@ -711,7 +711,7 @@ config connect::side::get_config() const
|
|||
}
|
||||
|
||||
res["name"] = res["user_description"];
|
||||
res["allow_changes"] = (enabled_ && allow_changes_) ? "yes" : "no";
|
||||
res["allow_changes"] = enabled_ && allow_changes_;
|
||||
|
||||
if(enabled_) {
|
||||
if (leader_.empty()) {
|
||||
|
@ -732,21 +732,21 @@ config connect::side::get_config() const
|
|||
// res["team"] = lexical_cast<std::string>(team_);
|
||||
res["team_name"] = parent_->team_names_[team_];
|
||||
res["user_team_name"] = parent_->user_team_names_[team_];
|
||||
res["allow_player"] = allow_player_ ? "yes" : "no";
|
||||
res["allow_player"] = allow_player_;
|
||||
res["colour"] = lexical_cast<std::string>(colour_ + 1);
|
||||
res["gold"] = lexical_cast<std::string>(gold_);
|
||||
res["income"] = lexical_cast<std::string>(income_);
|
||||
|
||||
if(!parent_->params_.use_map_settings || res["fog"].empty() || (res["fog"] != "yes" && res["fog"] != "no")) {
|
||||
res["fog"] = parent_->params_.fog_game ? "yes" : "no";
|
||||
res["fog"] = parent_->params_.fog_game;
|
||||
}
|
||||
|
||||
if(!parent_->params_.use_map_settings || res["shroud"].empty() || (res["shroud"] != "yes" && res["shroud"] != "no")) {
|
||||
res["shroud"] = parent_->params_.shroud_game ? "yes" : "no";
|
||||
res["shroud"] = parent_->params_.shroud_game;
|
||||
}
|
||||
|
||||
res["share_maps"] = parent_->params_.share_maps ? "yes" : "no";
|
||||
res["share_view"] = parent_->params_.share_view ? "yes" : "no";
|
||||
res["share_maps"] = parent_->params_.share_maps;
|
||||
res["share_view"] = parent_->params_.share_view;
|
||||
if(!parent_->params_.use_map_settings || res["village_gold"].empty())
|
||||
res["village_gold"] = lexical_cast<std::string>(parent_->params_.village_gold);
|
||||
}
|
||||
|
@ -1237,7 +1237,7 @@ void connect::process_network_data(const config& data, const network::connection
|
|||
const std::string name = data["name"];
|
||||
if(name.empty()) {
|
||||
config response;
|
||||
response["failed"] = "yes";
|
||||
response["failed"] = true;
|
||||
network::send_data(response, sock, true);
|
||||
ERR_CF << "ERROR: No username provided with the side.\n";
|
||||
return;
|
||||
|
@ -1251,7 +1251,7 @@ void connect::process_network_data(const config& data, const network::connection
|
|||
*/
|
||||
if(find_player_side(name) != -1) {
|
||||
config response;
|
||||
response["failed"] = "yes";
|
||||
response["failed"] = true;
|
||||
response["message"] = "The nick '" + name + "' is already in use.";
|
||||
network::send_data(response, sock, true);
|
||||
return;
|
||||
|
@ -1279,7 +1279,7 @@ void connect::process_network_data(const config& data, const network::connection
|
|||
|
||||
if(itor == sides_.end()) {
|
||||
config response;
|
||||
response["failed"] = "yes";
|
||||
response["failed"] = true;
|
||||
network::send_data(response, sock, true);
|
||||
config kick;
|
||||
kick["username"] = data["name"];
|
||||
|
@ -1313,7 +1313,7 @@ void connect::process_network_data(const config& data, const network::connection
|
|||
} else {
|
||||
ERR_CF << "tried to take illegal side: " << side_taken << '\n';
|
||||
config response;
|
||||
response["failed"] = "yes";
|
||||
response["failed"] = true;
|
||||
network::send_data(response, sock, true);
|
||||
}
|
||||
}
|
||||
|
@ -1589,12 +1589,12 @@ void connect::load_game()
|
|||
{
|
||||
if (!tod_manager::is_start_ToD(level_["random_start_time"]))
|
||||
{
|
||||
level_["random_start_time"] = "yes";
|
||||
level_["random_start_time"] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
level_["random_start_time"] = "no";
|
||||
level_["random_start_time"] = false;
|
||||
}
|
||||
|
||||
level_["experience_modifier"] = lexical_cast<std::string>(params_.xp_modifier);
|
||||
|
@ -1638,7 +1638,7 @@ void connect::load_game()
|
|||
// This will force connecting clients to be using the same version number as us.
|
||||
level_["version"] = game_config::version;
|
||||
|
||||
level_["observer"] = params_.allow_observers ? "yes" : "no";
|
||||
level_["observer"] = params_.allow_observers;
|
||||
|
||||
if(level_["objectives"].empty()) {
|
||||
level_["objectives"] = "<big>" + t_string(N_("Victory:"), "wesnoth") +
|
||||
|
|
|
@ -573,17 +573,13 @@ config play_controller::to_config() const
|
|||
|
||||
cfg.merge_attributes(level_);
|
||||
|
||||
std::stringstream buf;
|
||||
|
||||
for(std::vector<team>::const_iterator t = teams_.begin(); t != teams_.end(); ++t) {
|
||||
int side_num = t - teams_.begin() + 1;
|
||||
|
||||
config& side = cfg.add_child("side");
|
||||
t->write(side);
|
||||
side["no_leader"] = "yes";
|
||||
buf.str(std::string());
|
||||
buf << side_num;
|
||||
side["side"] = buf.str();
|
||||
side["no_leader"] = true;
|
||||
side["side"] = str_cast(side_num);
|
||||
|
||||
if (!linger_){
|
||||
//current visible units
|
||||
|
|
|
@ -202,7 +202,7 @@ static void preload_lua_tags(const config &game_config, config &target)
|
|||
{
|
||||
config &ev = target.add_child("event");
|
||||
ev["name"] = "preload";
|
||||
ev["first_time_only"] = "no";
|
||||
ev["first_time_only"] = false;
|
||||
ev.add_child("lua", cfg);
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
|
|||
LOG_NG << "Adding dummy preload event.\n";
|
||||
config &ev = gamestate.snapshot.add_child("event");
|
||||
ev["name"] = "preload";
|
||||
ev["first_time_only"] = "no";
|
||||
ev["first_time_only"] = false;
|
||||
config &lua = ev.add_child("lua");
|
||||
lua["code"] = "wesnoth.dofile 'lua/wml-tags.lua'";
|
||||
}
|
||||
|
|
|
@ -912,7 +912,7 @@ void playsingle_controller::store_gold(bool obs)
|
|||
while (side_it != side_range.second) {
|
||||
if ((*side_it)["save_id"] == t.save_id()) {
|
||||
(*side_it)["gold"] = str_cast<int>(carryover_gold);
|
||||
(*side_it)["gold_add"] = end_level.carryover_add ? "yes" : "no";
|
||||
(*side_it)["gold_add"] = end_level.carryover_add;
|
||||
(*side_it)["colour"] = t.colour();
|
||||
(*side_it)["current_player"] = t.current_player();
|
||||
(*side_it)["name"] = t.name();
|
||||
|
@ -926,7 +926,7 @@ void playsingle_controller::store_gold(bool obs)
|
|||
config &new_side = gamestate_.snapshot.add_child("side");
|
||||
new_side["save_id"] = t.save_id();
|
||||
new_side["gold"] = str_cast<int>(carryover_gold);
|
||||
new_side["gold_add"] = end_level.carryover_add ? "yes" : "no";
|
||||
new_side["gold_add"] = end_level.carryover_add;
|
||||
new_side["colour"] = t.colour();
|
||||
new_side["current_player"] = t.current_player();
|
||||
new_side["name"] = t.name();
|
||||
|
|
|
@ -98,7 +98,13 @@ void write_preferences()
|
|||
|
||||
}
|
||||
|
||||
void set(const std::string& key, std::string value) {
|
||||
void set(const std::string &key, bool value)
|
||||
{
|
||||
prefs[key] = value;
|
||||
}
|
||||
|
||||
void set(const std::string &key, const std::string &value)
|
||||
{
|
||||
prefs[key] = value;
|
||||
}
|
||||
|
||||
|
@ -141,7 +147,7 @@ bool fullscreen()
|
|||
|
||||
void _set_fullscreen(bool ison)
|
||||
{
|
||||
prefs["fullscreen"] = (ison ? "yes" : "no");
|
||||
prefs["fullscreen"] = ison;
|
||||
}
|
||||
|
||||
bool scroll_to_action()
|
||||
|
@ -151,7 +157,7 @@ bool scroll_to_action()
|
|||
|
||||
void _set_scroll_to_action(bool ison)
|
||||
{
|
||||
prefs["scroll_to_action"] = (ison ? "yes" : "no");
|
||||
prefs["scroll_to_action"] = ison;
|
||||
}
|
||||
|
||||
int min_allowed_width()
|
||||
|
@ -215,7 +221,7 @@ bool turbo()
|
|||
|
||||
void _set_turbo(bool ison)
|
||||
{
|
||||
prefs["turbo"] = (ison ? "yes" : "no");
|
||||
prefs["turbo"] = ison;
|
||||
}
|
||||
|
||||
double turbo_speed()
|
||||
|
@ -235,7 +241,7 @@ bool idle_anim()
|
|||
|
||||
void _set_idle_anim(const bool ison)
|
||||
{
|
||||
prefs["idle_anim"] = (ison ? "yes" : "no");
|
||||
prefs["idle_anim"] = ison;
|
||||
}
|
||||
|
||||
int idle_anim_rate()
|
||||
|
@ -265,7 +271,7 @@ bool ellipses()
|
|||
|
||||
void _set_ellipses(bool ison)
|
||||
{
|
||||
preferences::set("show_side_colours", (ison ? "yes" : "no"));
|
||||
preferences::set("show_side_colours", ison);
|
||||
}
|
||||
|
||||
bool grid()
|
||||
|
@ -275,7 +281,7 @@ bool grid()
|
|||
|
||||
void _set_grid(bool ison)
|
||||
{
|
||||
preferences::set("grid", (ison ? "yes" : "no"));
|
||||
preferences::set("grid", ison);
|
||||
}
|
||||
|
||||
size_t sound_buffer_size()
|
||||
|
@ -376,15 +382,15 @@ bool turn_bell()
|
|||
bool set_turn_bell(bool ison)
|
||||
{
|
||||
if(!turn_bell() && ison) {
|
||||
preferences::set("turn_bell", "yes");
|
||||
preferences::set("turn_bell", true);
|
||||
if(!music_on() && !sound_on() && !UI_sound_on()) {
|
||||
if(!sound::init_sound()) {
|
||||
preferences::set("turn_bell", "no");
|
||||
preferences::set("turn_bell", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if(turn_bell() && !ison) {
|
||||
preferences::set("turn_bell", "no");
|
||||
preferences::set("turn_bell", false);
|
||||
sound::stop_bell();
|
||||
if(!music_on() && !sound_on() && !UI_sound_on())
|
||||
sound::close_sound();
|
||||
|
@ -400,15 +406,15 @@ bool UI_sound_on()
|
|||
bool set_UI_sound(bool ison)
|
||||
{
|
||||
if(!UI_sound_on() && ison) {
|
||||
preferences::set("UI_sound", "yes");
|
||||
preferences::set("UI_sound", true);
|
||||
if(!music_on() && !sound_on() && !turn_bell()) {
|
||||
if(!sound::init_sound()) {
|
||||
preferences::set("UI_sound", "no");
|
||||
preferences::set("UI_sound", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if(UI_sound_on() && !ison) {
|
||||
preferences::set("UI_sound", "no");
|
||||
preferences::set("UI_sound", false);
|
||||
sound::stop_UI_sound();
|
||||
if(!music_on() && !sound_on() && !turn_bell())
|
||||
sound::close_sound();
|
||||
|
@ -428,15 +434,15 @@ bool sound_on()
|
|||
|
||||
bool set_sound(bool ison) {
|
||||
if(!sound_on() && ison) {
|
||||
preferences::set("sound", "yes");
|
||||
preferences::set("sound", true);
|
||||
if(!music_on() && !turn_bell() && !UI_sound_on()) {
|
||||
if(!sound::init_sound()) {
|
||||
preferences::set("sound", "no");
|
||||
preferences::set("sound", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if(sound_on() && !ison) {
|
||||
preferences::set("sound", "no");
|
||||
preferences::set("sound", false);
|
||||
sound::stop_sound();
|
||||
if(!music_on() && !turn_bell() && !UI_sound_on())
|
||||
sound::close_sound();
|
||||
|
@ -451,17 +457,17 @@ bool music_on()
|
|||
|
||||
bool set_music(bool ison) {
|
||||
if(!music_on() && ison) {
|
||||
preferences::set("music", "yes");
|
||||
preferences::set("music", true);
|
||||
if(!sound_on() && !turn_bell() && !UI_sound_on()) {
|
||||
if(!sound::init_sound()) {
|
||||
preferences::set("music", "no");
|
||||
preferences::set("music", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
sound::play_music();
|
||||
} else if(music_on() && !ison) {
|
||||
preferences::set("music", "no");
|
||||
preferences::set("music", false);
|
||||
if(!sound_on() && !turn_bell() && !UI_sound_on())
|
||||
sound::close_sound();
|
||||
else
|
||||
|
@ -500,7 +506,7 @@ bool mouse_scroll_enabled()
|
|||
|
||||
void enable_mouse_scroll(bool value)
|
||||
{
|
||||
set("mouse_scrolling", value ? "yes" : "no");
|
||||
set("mouse_scrolling", value);
|
||||
}
|
||||
|
||||
int mouse_scroll_threshold()
|
||||
|
@ -545,7 +551,7 @@ bool use_colour_cursors()
|
|||
|
||||
void _set_colour_cursors(bool value)
|
||||
{
|
||||
preferences::set("colour_cursors", value ? "yes" : "no");
|
||||
preferences::set("colour_cursors", value);
|
||||
colour_cursors = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ namespace preferences {
|
|||
void write_preferences();
|
||||
|
||||
// Low-level, should be seen only by preferences_display ?
|
||||
void set(const std::string& key, std::string value);
|
||||
void set(const std::string& key, const std::string &value);
|
||||
void set(const std::string &key, bool value);
|
||||
void clear(const std::string& key);
|
||||
void set_child(const std::string& key, const config& val);
|
||||
const config &get_child(const std::string &key);
|
||||
|
|
|
@ -329,7 +329,7 @@ void replay::add_label(const terrain_label* label)
|
|||
assert(label);
|
||||
config* const cmd = add_command(false);
|
||||
|
||||
(*cmd)["undo"] = "no";
|
||||
(*cmd)["undo"] = false;
|
||||
|
||||
config val;
|
||||
|
||||
|
@ -342,7 +342,7 @@ void replay::clear_labels(const std::string& team_name)
|
|||
{
|
||||
config* const cmd = add_command(false);
|
||||
|
||||
(*cmd)["undo"] = "no";
|
||||
(*cmd)["undo"] = false;
|
||||
config val;
|
||||
val["team_name"] = team_name;
|
||||
cmd->add_child("clear_labels",val);
|
||||
|
@ -351,7 +351,7 @@ void replay::clear_labels(const std::string& team_name)
|
|||
void replay::add_rename(const std::string& name, const map_location& loc)
|
||||
{
|
||||
config* const cmd = add_command(false);
|
||||
(*cmd)["async"] = "yes"; // Not undoable, but depends on moves/recruits that are
|
||||
(*cmd)["async"] = true; // Not undoable, but depends on moves/recruits that are
|
||||
config val;
|
||||
loc.write(val);
|
||||
val["name"] = name;
|
||||
|
@ -379,7 +379,7 @@ void replay::add_event(const std::string& name, const map_location& loc)
|
|||
config& source = ev.add_child("source");
|
||||
loc.write(source);
|
||||
}
|
||||
(*cmd)["undo"] = "no";
|
||||
(*cmd)["undo"] = false;
|
||||
}
|
||||
|
||||
void replay::add_log_data(const std::string &key, const std::string &var)
|
||||
|
@ -431,7 +431,7 @@ void replay::add_advancement(const map_location& loc)
|
|||
config* const cmd = add_command(false);
|
||||
|
||||
config val;
|
||||
(*cmd)["undo"] = "no";
|
||||
(*cmd)["undo"] = false;
|
||||
loc.write(val);
|
||||
cmd->add_child("advance_unit",val);
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ void replay::speak(const config& cfg)
|
|||
config* const cmd = add_command(false);
|
||||
if(cmd != NULL) {
|
||||
cmd->add_child("speak",cfg);
|
||||
(*cmd)["undo"] = "no";
|
||||
(*cmd)["undo"] = false;
|
||||
add_chat_message_location();
|
||||
}
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ config replay::get_data_range(int cmd_start, int cmd_end, DATA_TYPE data_type)
|
|||
res.add_child("command",*cmd[cmd_start]);
|
||||
|
||||
if(data_type == NON_UNDO_DATA) {
|
||||
(*cmd[cmd_start])["sent"] = "yes";
|
||||
(*cmd[cmd_start])["sent"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,7 +708,7 @@ void replay::add_config(const config& cfg, MARK_SENT mark)
|
|||
add_chat_message_location();
|
||||
}
|
||||
if(mark == MARK_AS_SENT) {
|
||||
cfg["sent"] = "yes";
|
||||
cfg["sent"] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -853,8 +853,8 @@ void savegame::extract_summary_data_from_save(config& out)
|
|||
const bool has_replay = gamestate_.replay_data.empty() == false;
|
||||
const bool has_snapshot = gamestate_.snapshot.child("side");
|
||||
|
||||
out["replay"] = has_replay ? "yes" : "no";
|
||||
out["snapshot"] = has_snapshot ? "yes" : "no";
|
||||
out["replay"] = has_replay;
|
||||
out["snapshot"] = has_snapshot;
|
||||
|
||||
out["label"] = gamestate_.classification().label;
|
||||
out["parent"] = gamestate_.classification().parent;
|
||||
|
@ -1028,12 +1028,8 @@ void game_savegame::before_save()
|
|||
|
||||
void game_savegame::write_game_snapshot()
|
||||
{
|
||||
|
||||
snapshot()["snapshot"] = "yes";
|
||||
|
||||
std::stringstream buf;
|
||||
buf << gui_.playing_team();
|
||||
snapshot()["playing_team"] = buf.str();
|
||||
snapshot()["snapshot"] = true;
|
||||
snapshot()["playing_team"] = str_cast(gui_.playing_team());
|
||||
|
||||
write_events(snapshot());
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void music_track::write(config &parent_node, bool append)
|
|||
m["ms_before"] = lexical_cast<std::string>(ms_before_);
|
||||
m["ms_after"] = lexical_cast<std::string>(ms_after_);
|
||||
if(append) {
|
||||
m["append"] = "yes";
|
||||
m["append"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -221,8 +221,8 @@ void positional_source::write_config(config& cfg) const
|
|||
cfg["sounds"] = this->files_;
|
||||
cfg["delay"] = str_cast<unsigned int>(this->min_delay_);
|
||||
cfg["chance"] = str_cast<unsigned int>(this->chance_);
|
||||
cfg["check_fogged"] = this->check_fogged_ ? "yes" : "no";
|
||||
cfg["check_shrouded"] = this->check_shrouded_ ? "yes" : "no";
|
||||
cfg["check_fogged"] = check_fogged_;
|
||||
cfg["check_shrouded"] = check_shrouded_;
|
||||
|
||||
cfg["x"] = cfg["y"] = "";
|
||||
bool first_loc = true;
|
||||
|
|
|
@ -586,7 +586,7 @@ stats calculate_stats(int category, std::string save_id)
|
|||
config write_stats()
|
||||
{
|
||||
config res;
|
||||
res["mid_scenario"] = (mid_scenario ? "yes" : "no");
|
||||
res["mid_scenario"] = mid_scenario;
|
||||
|
||||
for(std::vector<scenario_stats>::const_iterator i = master_stats.begin(); i != master_stats.end(); ++i) {
|
||||
res.add_child("scenario",i->write());
|
||||
|
|
22
src/team.cpp
22
src/team.cpp
|
@ -171,7 +171,7 @@ void team::team_info::write(config& cfg) const
|
|||
{
|
||||
cfg["gold"] = str_cast(gold);
|
||||
cfg["start_gold"] = str_cast(start_gold);
|
||||
cfg["gold_add"] = gold_add ? "yes" : "no";
|
||||
cfg["gold_add"] = gold_add;
|
||||
cfg["income"] = str_cast(income);
|
||||
cfg["name"] = name;
|
||||
cfg["team_name"] = team_name;
|
||||
|
@ -182,14 +182,14 @@ void team::team_info::write(config& cfg) const
|
|||
cfg["flag_icon"] = flag_icon;
|
||||
cfg["id"] = description;
|
||||
cfg["objectives"] = objectives;
|
||||
cfg["objectives_changed"] = objectives_changed ? "yes" : "no";
|
||||
cfg["objectives_changed"] = objectives_changed;
|
||||
cfg["countdown_time"]= countdown_time;
|
||||
cfg["action_bonus_count"]= str_cast(action_bonus_count);
|
||||
cfg["village_gold"] = str_cast(income_per_village);
|
||||
cfg["disallow_observers"] = disallow_observers ? "yes" : "no";
|
||||
cfg["allow_player"] = allow_player ? "yes" : "no";
|
||||
cfg["no_leader"] = no_leader ? "yes" : "no";
|
||||
cfg["hidden"] = hidden ? "yes" : "no";
|
||||
cfg["disallow_observers"] = disallow_observers;
|
||||
cfg["allow_player"] = allow_player;
|
||||
cfg["no_leader"] = no_leader;
|
||||
cfg["hidden"] = hidden;
|
||||
|
||||
switch(controller) {
|
||||
case AI: cfg["controller"] = "ai"; break;
|
||||
|
@ -211,15 +211,15 @@ void team::team_info::write(config& cfg) const
|
|||
|
||||
cfg["recruit"] = can_recruit_str.str();
|
||||
|
||||
cfg["share_maps"] = share_maps ? "yes" : "no";
|
||||
cfg["share_view"] = share_view ? "yes" : "no";
|
||||
cfg["share_maps"] = share_maps;
|
||||
cfg["share_view"] = share_view;
|
||||
|
||||
if(music.empty() == false)
|
||||
cfg["music"] = music;
|
||||
|
||||
cfg["colour"] = lexical_cast_default<std::string>(colour);
|
||||
|
||||
cfg["persistent"] = persistent ? "yes" : "no";
|
||||
cfg["persistent"] = persistent;
|
||||
|
||||
cfg.add_child("ai",ai::manager::to_config(side));
|
||||
}
|
||||
|
@ -279,8 +279,8 @@ team::team(const config& cfg, const gamemap& map, int gold) :
|
|||
void team::write(config& cfg) const
|
||||
{
|
||||
info_.write(cfg);
|
||||
cfg["shroud"] = uses_shroud() ? "yes" : "no";
|
||||
cfg["fog"] = uses_fog() ? "yes" : "no";
|
||||
cfg["shroud"] = uses_shroud();
|
||||
cfg["fog"] = uses_fog();
|
||||
cfg["gold"] = str_cast(gold_);
|
||||
|
||||
// Write village locations
|
||||
|
|
|
@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE( test_send_client )
|
|||
config& child = cfg_send.add_child("test_client_send");
|
||||
|
||||
child["test"] = "yes!";
|
||||
cfg_send["test_running"] = "yes";
|
||||
cfg_send["test_running"] = true;
|
||||
network::send_data(cfg_send, client_client1, true);
|
||||
|
||||
network::connection receive_from;
|
||||
|
|
14
src/unit.cpp
14
src/unit.cpp
|
@ -694,7 +694,7 @@ void unit::generate_name(rand_rng::simple_rng* rng)
|
|||
if (!name_.empty() || !utils::string_bool(cfg_["generate_name"], true)) return;
|
||||
|
||||
name_ = race_->generate_name(gender_, rng);
|
||||
cfg_["generate_name"] = "no";
|
||||
cfg_["generate_name"] = false;
|
||||
}
|
||||
|
||||
// Apply mandatory traits (e.g. undead, mechanical) to a unit and then
|
||||
|
@ -771,7 +771,7 @@ void unit::generate_traits(bool musthaveonly, game_state* state)
|
|||
|
||||
// Once random traits are added, don't do it again.
|
||||
// Such as when restoring a saved character.
|
||||
cfg_["random_traits"] = "no";
|
||||
cfg_["random_traits"] = false;
|
||||
}
|
||||
|
||||
std::vector<std::string> unit::get_traits_list() const
|
||||
|
@ -1575,7 +1575,7 @@ void unit::write(config& cfg) const
|
|||
|
||||
cfg["role"] = role_;
|
||||
cfg["ai_special"] = ai_special_;
|
||||
cfg["flying"] = flying_ ? "yes" : "no";
|
||||
cfg["flying"] = flying_;
|
||||
|
||||
config status_flags;
|
||||
std::map<std::string,std::string> all_states = get_states();
|
||||
|
@ -1595,7 +1595,7 @@ void unit::write(config& cfg) const
|
|||
cfg["underlying_id"] = lexical_cast<std::string>(underlying_id_);
|
||||
|
||||
if(can_recruit())
|
||||
cfg["canrecruit"] = "yes";
|
||||
cfg["canrecruit"] = true;
|
||||
|
||||
cfg["facing"] = map_location::write_direction(facing_);
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ void unit::write(config& cfg) const
|
|||
cfg["moves"] = lexical_cast_default<std::string>(movement_);
|
||||
cfg["max_moves"] = lexical_cast_default<std::string>(max_movement_);
|
||||
|
||||
cfg["resting"] = resting_ ? "yes" : "no";
|
||||
cfg["resting"] = resting_;
|
||||
|
||||
cfg["advances_to"] = utils::join(advances_to_);
|
||||
|
||||
|
@ -1638,12 +1638,12 @@ void unit::write(config& cfg) const
|
|||
cfg["alignment"] = "neutral";
|
||||
}
|
||||
cfg["flag_rgb"] = flag_rgb_;
|
||||
cfg["unrenamable"] = unrenamable_ ? "yes" : "no";
|
||||
cfg["unrenamable"] = unrenamable_;
|
||||
cfg["alpha"] = lexical_cast_default<std::string>(alpha_);
|
||||
|
||||
cfg["attacks_left"] = lexical_cast_default<std::string>(attacks_left_);
|
||||
cfg["max_attacks"] = lexical_cast_default<std::string>(max_attacks_);
|
||||
cfg["zoc"] = emit_zoc_ ? "yes" : "no";
|
||||
cfg["zoc"] = emit_zoc_;
|
||||
cfg.clear_children("attack");
|
||||
for(std::vector<attack_type>::const_iterator i = attacks_.begin(); i != attacks_.end(); ++i) {
|
||||
cfg.add_child("attack",i->get_cfg());
|
||||
|
|
|
@ -487,7 +487,7 @@ void unit_animation::add_anims( std::vector<unit_animation> & animations, const
|
|||
foreach (config &anim, expanded_cfg.child_range("standing_anim"))
|
||||
{
|
||||
anim["apply_to"] = "standing,default";
|
||||
if (anim["offscreen"].empty()) anim["offscreen"] = "no";
|
||||
if (anim["offscreen"].empty()) anim["offscreen"] = false;
|
||||
if (anim["layer"].empty()) anim["layer"] = default_layer;
|
||||
animations.push_back(unit_animation(anim));
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ void unit_animation::add_anims( std::vector<unit_animation> & animations, const
|
|||
foreach (config &anim, expanded_cfg.child_range("idle_anim"))
|
||||
{
|
||||
anim["apply_to"] = "idling";
|
||||
if (anim["offscreen"].empty()) anim["offscreen"] = "no";
|
||||
if (anim["offscreen"].empty()) anim["offscreen"] = false;
|
||||
if (anim["layer"].empty()) anim["layer"] = default_layer;
|
||||
animations.push_back(unit_animation(anim));
|
||||
}
|
||||
|
@ -587,9 +587,9 @@ void unit_animation::add_anims( std::vector<unit_animation> & animations, const
|
|||
}
|
||||
if (anim["hits"].empty())
|
||||
{
|
||||
anim["hits"] = "no";
|
||||
anim["hits"] = false;
|
||||
animations.push_back(unit_animation(anim));
|
||||
anim["hits"] = "yes";
|
||||
anim["hits"] = true;
|
||||
animations.push_back(unit_animation(anim));
|
||||
animations.back().add_frame(225,frame_builder()
|
||||
.image(animations.back().get_last_frame().parameters(0).image)
|
||||
|
|
Loading…
Add table
Reference in a new issue