Replace config_of with new variadic config constructor
This commit is contained in:
parent
3b276ff39a
commit
96ca0b026e
56 changed files with 203 additions and 304 deletions
|
@ -225,7 +225,6 @@
|
|||
<Unit filename="../../src/commandline_options.hpp" />
|
||||
<Unit filename="../../src/config.cpp" />
|
||||
<Unit filename="../../src/config.hpp" />
|
||||
<Unit filename="../../src/config_assign.hpp" />
|
||||
<Unit filename="../../src/config_attribute_value.cpp" />
|
||||
<Unit filename="../../src/config_attribute_value.hpp" />
|
||||
<Unit filename="../../src/config_cache.cpp" />
|
||||
|
|
|
@ -160,7 +160,6 @@
|
|||
<ClInclude Include="..\..\src\color.hpp" />
|
||||
<ClInclude Include="..\..\src\color_range.hpp" />
|
||||
<ClInclude Include="..\..\src\config.hpp" />
|
||||
<ClInclude Include="..\..\src\config_assign.hpp" />
|
||||
<ClInclude Include="..\..\src\config_attribute_value.hpp" />
|
||||
<ClInclude Include="..\..\src\filesystem.hpp" />
|
||||
<ClInclude Include="..\..\src\font\constants.hpp" />
|
||||
|
|
|
@ -87,7 +87,6 @@
|
|||
<ClInclude Include="..\..\src\color.hpp" />
|
||||
<ClInclude Include="..\..\src\color_range.hpp" />
|
||||
<ClInclude Include="..\..\src\config.hpp" />
|
||||
<ClInclude Include="..\..\src\config_assign.hpp" />
|
||||
<ClInclude Include="..\..\src\config_attribute_value.hpp" />
|
||||
<ClInclude Include="..\..\src\filesystem.hpp" />
|
||||
<ClInclude Include="..\..\src\game_config.hpp" />
|
||||
|
|
|
@ -2497,7 +2497,6 @@
|
|||
EC74C11B197576F500B85A1A /* open.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = open.cpp; sourceTree = "<group>"; };
|
||||
EC74C11C197576F500B85A1A /* open.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = open.hpp; sourceTree = "<group>"; };
|
||||
EC79D70C19548D5000EC7C1F /* game_cache_options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = game_cache_options.cpp; sourceTree = "<group>"; };
|
||||
EC84245618F30D9000FC1EEF /* config_assign.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = config_assign.hpp; sourceTree = "<group>"; };
|
||||
EC84245D18F30D9100FC1EEF /* replay_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = replay_helper.cpp; sourceTree = "<group>"; };
|
||||
EC84245E18F30D9100FC1EEF /* replay_helper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = replay_helper.hpp; sourceTree = "<group>"; };
|
||||
EC84246018F30D9100FC1EEF /* synced_checkup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = synced_checkup.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2900,7 +2899,6 @@
|
|||
F46C5DCA13A5074C00DD0816 /* commandline_options.hpp */,
|
||||
B5599AA80EC62181008DD061 /* config.cpp */,
|
||||
B5599AA70EC62181008DD061 /* config.hpp */,
|
||||
EC84245618F30D9000FC1EEF /* config_assign.hpp */,
|
||||
EC0341DF1ECF46FE000F2E2B /* config_attribute_value.cpp */,
|
||||
EC0341E01ECF46FE000F2E2B /* config_attribute_value.hpp */,
|
||||
B5599AA40EC62181008DD061 /* config_cache.cpp */,
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "ai/lua/aspect_advancements.hpp"
|
||||
#include "attack_prediction.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
|
@ -917,7 +916,7 @@ namespace {
|
|||
|
||||
// Make sure that if we're serializing a game here,
|
||||
// we got the same results as the game did originally.
|
||||
const config local_results = config_of("chance", attacker.cth_)("hits", hits)("damage", damage);
|
||||
const config local_results {"chance", attacker.cth_, "hits", hits, "damage", damage};
|
||||
config replay_results;
|
||||
bool equals_replay = checkup_instance->local_checkup(local_results, replay_results);
|
||||
if (!equals_replay)
|
||||
|
@ -994,7 +993,7 @@ namespace {
|
|||
|
||||
replay_results.clear();
|
||||
// there was also a attribute cfg["unit_hit"] which was never used so i deleted.
|
||||
equals_replay = checkup_instance->local_checkup(config_of("dies", dies), replay_results);
|
||||
equals_replay = checkup_instance->local_checkup(config {"dies", dies}, replay_results);
|
||||
if (!equals_replay)
|
||||
{
|
||||
bool results_dies = replay_results["dies"].to_bool();
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "actions/vision.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "filter_context.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
|
@ -511,7 +510,7 @@ namespace { // Helpers for place_recruit()
|
|||
const std::string checksum = get_checksum(new_unit);
|
||||
config original_checksum_config;
|
||||
|
||||
bool checksum_equals = checkup_instance->local_checkup(config_of("checksum", checksum),original_checksum_config);
|
||||
bool checksum_equals = checkup_instance->local_checkup(config {"checksum", checksum},original_checksum_config);
|
||||
if(!checksum_equals)
|
||||
{
|
||||
const std::string old_checksum = original_checksum_config["checksum"];
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "actions/undo.hpp"
|
||||
#include "actions/vision.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
@ -1215,10 +1214,11 @@ static size_t move_unit_internal(undo_list* undo_stack,
|
|||
mover.try_actual_movement(show_move);
|
||||
|
||||
config co;
|
||||
config cn = config_of
|
||||
("stopped_early", mover.stopped_early())
|
||||
("final_hex_x", mover.final_hex().wml_x())
|
||||
("final_hex_y", mover.final_hex().wml_y());
|
||||
config cn {
|
||||
"stopped_early", mover.stopped_early(),
|
||||
"final_hex_x", mover.final_hex().wml_x(),
|
||||
"final_hex_y", mover.final_hex().wml_y(),
|
||||
};
|
||||
bool matches_replay = checkup_instance->local_checkup(cn,co);
|
||||
if(!matches_replay)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "serialization/parser.hpp"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "units/types.hpp"
|
||||
#include "variable.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -1792,7 +1791,7 @@ recruitment_aspect::recruitment_aspect(readonly_context &context, const config &
|
|||
parsed_cfg.clear_children("pattern", "total");
|
||||
// Then, if there's no [recruit], add one.
|
||||
if (!parsed_cfg.has_child("recruit")) {
|
||||
parsed_cfg.add_child("recruit", config_of("importance", 0));
|
||||
parsed_cfg.add_child("recruit", config {"importance", 0});
|
||||
}
|
||||
// Finally, populate our lists
|
||||
for (config job : parsed_cfg.child_range("recruit")) {
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "chat_events.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2014 - 2017 by David White <dave@whitevine.net>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "config.hpp"
|
||||
|
||||
class config_of
|
||||
{
|
||||
public:
|
||||
template <typename AT>
|
||||
config_of(const std::string& attrname, AT value)
|
||||
{
|
||||
this->operator()(attrname, value);
|
||||
}
|
||||
|
||||
config_of(const std::string& tagname, const config& child)
|
||||
{
|
||||
this->operator()(tagname, child);
|
||||
}
|
||||
|
||||
template <typename AT>
|
||||
config_of& operator()(const std::string& attrname, AT value)
|
||||
{
|
||||
data_[attrname] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
config_of& operator()(const std::string& tagname, const config& child)
|
||||
{
|
||||
data_.add_child(tagname, child);
|
||||
return *this;
|
||||
}
|
||||
|
||||
config_of& operator()(const std::string& tagname, const config_of& child)
|
||||
{
|
||||
data_.add_child(tagname, child);
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator config() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
private:
|
||||
config data_;
|
||||
};
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "controller_base.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "show_dialog.hpp" //gui::in_dialog
|
||||
#include "display.hpp"
|
||||
#include "events.hpp"
|
||||
|
@ -307,7 +306,7 @@ void controller_base::show_menu(const std::vector<config>& items_arg, int xloc,
|
|||
const hotkey::hotkey_command& command = hotkey::get_hotkey_command(id);
|
||||
|
||||
if(cmd_exec->can_execute_command(command) && (!context_menu || in_context_menu(command.id))) {
|
||||
items.emplace_back(config_of("id", id));
|
||||
items.emplace_back(config {"id", id});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "resources.hpp"
|
||||
#include "reports.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "desktop/clipboard.hpp"
|
||||
#include "floating_label.hpp"
|
||||
#include "game_board.hpp"
|
||||
|
@ -651,7 +650,7 @@ bool editor_controller::execute_command(const hotkey::hotkey_command& cmd, int i
|
|||
sound::play_music_once(music_tracks_[index].id());
|
||||
get_current_map_context().add_to_playlist(music_tracks_[index]);
|
||||
std::vector<config> items;
|
||||
items.emplace_back(config_of("id", "editor-playlist"));
|
||||
items.emplace_back(config {"id", "editor-playlist"});
|
||||
std::shared_ptr<gui::button> b = gui_->find_menu_button("menu-playlist");
|
||||
show_menu(items, b->location().x +1, b->location().y + b->height() +1, false, *gui_);
|
||||
return true;
|
||||
|
@ -1015,7 +1014,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
if((can_execute_command(command) && (!context_menu || in_context_menu(command.id)))
|
||||
|| command.id == hotkey::HOTKEY_NULL)
|
||||
{
|
||||
items.emplace_back(config_of("id", id));
|
||||
items.emplace_back(config {"id", id});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1067,7 +1066,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
auto pos = items.erase(items.begin());
|
||||
int dir = 0;
|
||||
std::generate_n(std::inserter<std::vector<config>>(items, pos), int(map_location::NDIRECTIONS), [&dir]() -> config {
|
||||
return config_of("label", map_location::write_translated_direction(map_location::DIRECTION(dir++)));
|
||||
return config {"label", map_location::write_translated_direction(map_location::DIRECTION(dir++))};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1074,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
active_menu_ = editor::MUSIC;
|
||||
auto pos = items.erase(items.begin());
|
||||
std::transform(music_tracks_.begin(), music_tracks_.end(), std::inserter<std::vector<config>>(items, pos), [](const sound::music_track& track) -> config {
|
||||
return config_of("label", track.title().empty() ? track.id() : track.title());
|
||||
return config {"label", track.title().empty() ? track.id() : track.title()};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1083,7 +1082,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
active_menu_ = editor::SCHEDULE;
|
||||
auto pos = items.erase(items.begin());
|
||||
std::transform(tods_.begin(), tods_.end(), std::inserter<std::vector<config>>(items, pos), [](const tods_map::value_type& tod) -> config {
|
||||
return config_of("label", tod.second.first);
|
||||
return config {"label", tod.second.first};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1090,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
active_menu_ = editor::LOCAL_SCHEDULE;
|
||||
auto pos = items.erase(items.begin());
|
||||
std::transform(tods_.begin(), tods_.end(), std::inserter<std::vector<config>>(items, pos), [](const tods_map::value_type& tod) -> config {
|
||||
return config_of("label", tod.second.first);
|
||||
return config {"label", tod.second.first};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "resources.hpp"
|
||||
#include "team.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "display.hpp"
|
||||
#include "editor/map/context_manager.hpp"
|
||||
#include "editor/map/map_context.hpp"
|
||||
|
@ -332,7 +331,7 @@ void context_manager::expand_open_maps_menu(std::vector<config>& items, int i)
|
|||
const std::string label = ss.str();
|
||||
const std::string details = get_menu_marker(changed);
|
||||
|
||||
contexts.emplace_back(config_of("label", label)("details", details));
|
||||
contexts.emplace_back(config {"label", label, "details", details});
|
||||
}
|
||||
|
||||
items.insert(pos, contexts.begin(), contexts.end());
|
||||
|
@ -345,7 +344,7 @@ void context_manager::expand_load_mru_menu(std::vector<config>& items, int i)
|
|||
auto pos = items.erase(items.begin() + i);
|
||||
|
||||
if(mru.empty()) {
|
||||
items.insert(pos, config_of("label", _("No Recent Files")));
|
||||
items.insert(pos, config {"label", _("No Recent Files")});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -358,7 +357,7 @@ void context_manager::expand_load_mru_menu(std::vector<config>& items, int i)
|
|||
|
||||
std::vector<config> temp;
|
||||
std::transform(mru.begin(), mru.end(), std::back_inserter(temp), [](const std::string& str) {
|
||||
return config_of("label", str);
|
||||
return config {"label", str};
|
||||
});
|
||||
|
||||
items.insert(pos, temp.begin(), temp.end());
|
||||
|
@ -395,7 +394,7 @@ void context_manager::expand_areas_menu(std::vector<config>& items, int i)
|
|||
const std::string label = ss.str();
|
||||
const std::string details = get_menu_marker(changed);
|
||||
|
||||
area_entries.emplace_back(config_of("label", label)("details", details));
|
||||
area_entries.emplace_back(config {"label", label, "details", details});
|
||||
}
|
||||
|
||||
items.insert(pos, area_entries.begin(), area_entries.end());
|
||||
|
@ -419,7 +418,7 @@ void context_manager::expand_sides_menu(std::vector<config>& items, int i)
|
|||
label << teamname;
|
||||
}
|
||||
|
||||
contexts.emplace_back(config_of("label", label.str()));
|
||||
contexts.emplace_back(config {"label", label.str()});
|
||||
}
|
||||
|
||||
items.insert(pos, contexts.begin(), contexts.end());
|
||||
|
@ -435,10 +434,10 @@ void context_manager::expand_time_menu(std::vector<config>& items, int i)
|
|||
assert(tod_m != nullptr);
|
||||
|
||||
for(const time_of_day& time : tod_m->times()) {
|
||||
times.emplace_back(config_of
|
||||
("details", time.name) // Use 'details' field here since the image will take the first column
|
||||
("image", time.image)
|
||||
);
|
||||
times.emplace_back(config {
|
||||
"details", time.name, // Use 'details' field here since the image will take the first column
|
||||
"image", time.image,
|
||||
});
|
||||
}
|
||||
|
||||
items.insert(pos, times.begin(), times.end());
|
||||
|
@ -452,10 +451,10 @@ void context_manager::expand_local_time_menu(std::vector<config>& items, int i)
|
|||
tod_manager* tod_m = get_map_context().get_time_manager();
|
||||
|
||||
for(const time_of_day& time : tod_m->times(get_map_context().get_active_area())) {
|
||||
times.emplace_back(config_of
|
||||
("details", time.name) // Use 'details' field here since the image will take the first column
|
||||
("image", time.image)
|
||||
);
|
||||
times.emplace_back(config {
|
||||
"details", time.name, // Use 'details' field here since the image will take the first column
|
||||
"image", time.image,
|
||||
});
|
||||
}
|
||||
|
||||
items.insert(pos, times.begin(), times.end());
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "preferences/editor.hpp"
|
||||
#include "editor/map/map_context.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "display.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "game_board.hpp"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "editor/palette/editor_palettes.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "font/text_formatting.hpp"
|
||||
#include "tooltips.hpp"
|
||||
|
@ -63,10 +62,10 @@ void editor_palette<Item>::expand_palette_groups_menu(std::vector<config>& items
|
|||
img += ".png";
|
||||
}
|
||||
|
||||
groups.emplace_back(config_of
|
||||
("label", groupname)
|
||||
("icon", img)
|
||||
);
|
||||
groups.emplace_back(config {
|
||||
"label", groupname,
|
||||
"icon", img,
|
||||
});
|
||||
}
|
||||
|
||||
items.insert(pos, groups.begin(), groups.end());
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "actions/move.hpp"
|
||||
#include "actions/vision.hpp"
|
||||
#include "ai/manager.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "fake_unit_ptr.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "game_classification.hpp"
|
||||
|
@ -681,7 +680,7 @@ WML_HANDLER_FUNCTION(set_variables,, cfg)
|
|||
|
||||
for(std::vector<std::string>::iterator i=split_vector.begin(); i!=split_vector.end(); ++i)
|
||||
{
|
||||
data.emplace_back(config_of(key_name, *i));
|
||||
data.emplace_back(config {key_name, *i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "resources.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "game_data.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/location.hpp"
|
||||
|
@ -130,7 +129,7 @@ void wmi_manager::get_items(const map_location& hex,
|
|||
&& item->can_show(hex, gamedata, fc)) {
|
||||
// Include this item.
|
||||
items.push_back(item);
|
||||
descriptions.emplace_back(config_of("id", item->menu_text()));
|
||||
descriptions.emplace_back(config {"id", item->menu_text()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "game_initialization/connect_engine.hpp"
|
||||
|
||||
#include "ai/configuration.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "game_initialization/mp_game_utils.hpp"
|
||||
#include "game_initialization/playcampaign.hpp"
|
||||
|
@ -764,15 +763,15 @@ void connect_engine::send_level_data() const
|
|||
{
|
||||
// Send initial information.
|
||||
if(first_scenario_) {
|
||||
send_to_server(config_of
|
||||
("create_game", config_of
|
||||
("name", params_.name)
|
||||
("password", params_.password)
|
||||
)
|
||||
);
|
||||
send_to_server(config {
|
||||
"create_game", config {
|
||||
"name", params_.name,
|
||||
"password", params_.password,
|
||||
},
|
||||
});
|
||||
send_to_server(level_);
|
||||
} else {
|
||||
send_to_server(config_of("update_game", config()));
|
||||
send_to_server(config {"update_game", config()});
|
||||
config next_level;
|
||||
next_level.add_child("store_next_scenario", level_);
|
||||
send_to_server(next_level);
|
||||
|
@ -872,12 +871,12 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine, const
|
|||
{
|
||||
// Save default attributes that could be overwirtten by the faction, so that correct faction lists would be
|
||||
// initialized by flg_manager when the new side config is sent over network.
|
||||
cfg_.add_child("default_faction", config_of
|
||||
("type", cfg_["type"])
|
||||
("gender", cfg_["gender"])
|
||||
("faction", cfg_["faction"])
|
||||
("recruit", cfg_["recruit"])
|
||||
);
|
||||
cfg_.add_child("default_faction", config {
|
||||
"type", cfg_["type"],
|
||||
"gender", cfg_["gender"],
|
||||
"faction", cfg_["faction"],
|
||||
"recruit", cfg_["recruit"],
|
||||
});
|
||||
|
||||
if(cfg_["side"].to_int(index_ + 1) != index_ + 1) {
|
||||
ERR_CF << "found invalid side=" << cfg_["side"].to_int(index_ + 1) << " in definition of side number " << index_ + 1 << std::endl;
|
||||
|
@ -1042,7 +1041,7 @@ config side_engine::new_config() const
|
|||
assert(controller_ != CNTR_LAST);
|
||||
if(controller_ == CNTR_COMPUTER && allow_player_) {
|
||||
// Do not import default ai cfg otherwise - all is set by scenario config.
|
||||
res.add_child_at("ai", config_of("ai_algorithm", ai_algorithm_), 0);
|
||||
res.add_child_at("ai", config {"ai_algorithm", ai_algorithm_}, 0);
|
||||
}
|
||||
|
||||
if(controller_ == CNTR_EMPTY) {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "game_initialization/create_engine.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
|
@ -362,7 +361,7 @@ void create_engine::prepare_for_scenario()
|
|||
state_.classification().scenario_define = current_level().data()["define"].str();
|
||||
|
||||
state_.set_carryover_sides_start(
|
||||
config_of("next_scenario", current_level().data()["id"])
|
||||
config {"next_scenario", current_level().data()["id"]}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -389,7 +388,7 @@ void create_engine::prepare_for_campaign(const std::string& difficulty)
|
|||
utils::split(current_level_data["extra_defines"]);
|
||||
|
||||
state_.set_carryover_sides_start(
|
||||
config_of("next_scenario", current_level_data["first_scenario"])
|
||||
config {"next_scenario", current_level_data["first_scenario"]}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "game_initialization/multiplayer.hpp"
|
||||
|
||||
#include "addon/manager.hpp" // for installed_addons
|
||||
#include "config_assign.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "game_initialization/mp_game_utils.hpp"
|
||||
|
@ -675,7 +674,7 @@ void start_local_game_commandline(CVideo& video, const config& game_config, save
|
|||
|
||||
game_config_manager::get()->load_game_config_for_game(state.classification());
|
||||
state.set_carryover_sides_start(
|
||||
config_of("next_scenario", parameters.name)
|
||||
config {"next_scenario", parameters.name}
|
||||
);
|
||||
|
||||
state.expand_random_scenario();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "game_initialization/singleplayer.hpp"
|
||||
#include "config.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "gui/dialogs/campaign_selection.hpp"
|
||||
#include "gui/dialogs/message.hpp"
|
||||
|
@ -101,7 +100,7 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
|
||||
if(!jump_to_campaign.scenario_id_.empty()) {
|
||||
state.set_carryover_sides_start(
|
||||
config_of("next_scenario", jump_to_campaign.scenario_id_)
|
||||
config {"next_scenario", jump_to_campaign.scenario_id_}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "commandline_options.hpp" // for commandline_options
|
||||
#include "config.hpp" // for config, etc
|
||||
#include "config_assign.hpp"
|
||||
#include "cursor.hpp" // for set, CURSOR_TYPE::NORMAL
|
||||
#include "exceptions.hpp" // for error
|
||||
#include "filesystem.hpp" // for get_user_config_dir, etc
|
||||
|
@ -467,7 +466,7 @@ void game_launcher::set_test(const std::string& id)
|
|||
state_.mp_settings().show_connect = false;
|
||||
|
||||
state_.set_carryover_sides_start(
|
||||
config_of("next_scenario", id)
|
||||
config {"next_scenario", id}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -516,7 +515,7 @@ int game_launcher::unit_test()
|
|||
state_.classification().campaign_type = game_classification::CAMPAIGN_TYPE::TEST;
|
||||
state_.classification().campaign_define = "TEST";
|
||||
state_.set_carryover_sides_start(
|
||||
config_of("next_scenario", test_scenario_)
|
||||
config {"next_scenario", test_scenario_}
|
||||
);
|
||||
|
||||
|
||||
|
@ -701,7 +700,7 @@ void game_launcher::set_tutorial()
|
|||
state_.mp_settings().mp_era = "era_default";
|
||||
state_.mp_settings().show_connect = false;
|
||||
state_.set_carryover_sides_start(
|
||||
config_of("next_scenario", "tutorial")
|
||||
config {"next_scenario", "tutorial"}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
#include "generators/cave_map_generator.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "pathfind/pathfind.hpp"
|
||||
|
@ -94,12 +93,12 @@ cave_map_generator::cave_map_generator_job::cave_map_generator_job(const cave_ma
|
|||
, res_(params.cfg_.child_or_empty("settings"))
|
||||
, rng_() //initialises with rand()
|
||||
{
|
||||
res_.add_child("event", config_of
|
||||
("name", "start")
|
||||
("message", config_of
|
||||
("message", "scenario_generation=cave is deprecated and will be removed soon.")
|
||||
)
|
||||
);
|
||||
res_.add_child("event", config {
|
||||
"name", "start",
|
||||
"message", config {
|
||||
"message", "scenario_generation=cave is deprecated and will be removed soon.",
|
||||
},
|
||||
});
|
||||
uint32_t seed = randomseed.get_ptr() ? *randomseed.get_ptr() : seed_rng::next_seed();
|
||||
rng_.seed(seed);
|
||||
LOG_NG << "creating random cave with seed: " << seed << '\n';
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "desktop/clipboard.hpp"
|
||||
#include "desktop/open.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "help/help.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/auxiliary/filter.hpp"
|
||||
|
@ -355,7 +354,7 @@ void addon_manager::pre_show(window& window)
|
|||
|
||||
std::vector<config> status_filter_entries;
|
||||
for(const auto& f : status_filter_types_) {
|
||||
status_filter_entries.emplace_back(config_of("label", t_string(f.second, GETTEXT_DOMAIN)));
|
||||
status_filter_entries.emplace_back(config {"label", t_string(f.second, GETTEXT_DOMAIN)});
|
||||
}
|
||||
|
||||
status_filter.set_values(status_filter_entries);
|
||||
|
@ -365,7 +364,7 @@ void addon_manager::pre_show(window& window)
|
|||
|
||||
std::vector<config> type_filter_entries;
|
||||
for(const auto& f : type_filter_types_) {
|
||||
type_filter_entries.emplace_back(config_of("label", t_string(f.second, GETTEXT_DOMAIN))("checkbox", false));
|
||||
type_filter_entries.emplace_back(config {"label", t_string(f.second, GETTEXT_DOMAIN), "checkbox", false});
|
||||
}
|
||||
|
||||
type_filter.set_values(type_filter_entries);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "gui/dialogs/campaign_selection.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
|
@ -169,7 +168,7 @@ void campaign_selection::pre_show(window& window)
|
|||
for(const auto& mod : engine_.get_const_extras_by_type(ng::create_engine::MOD)) {
|
||||
const bool active = std::find(enabled.begin(), enabled.end(), mod->id) != enabled.end();
|
||||
|
||||
mod_menu_values.emplace_back(config_of("label", mod->name)("checkbox", active));
|
||||
mod_menu_values.emplace_back(config {"label", mod->name, "checkbox", active});
|
||||
|
||||
mod_states_.push_back(active);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "gui/widgets/menu_button.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "units/types.hpp"
|
||||
|
@ -138,13 +137,13 @@ void faction_select::on_faction_select(window& window)
|
|||
|
||||
if(unit) {
|
||||
const std::string icon = formatter() << unit->image() << "~RC(" << unit->flag_rgb() << ">" << tc_color_ << ")";
|
||||
leaders.emplace_back(config_of("label", unit->type_name())("icon", icon));
|
||||
leaders.emplace_back(config {"label", unit->type_name(), "icon", icon});
|
||||
} else if(leader == "random") {
|
||||
leaders.emplace_back(config_of("label", _("Random"))("icon", ng::random_enemy_picture));
|
||||
leaders.emplace_back(config {"label", _("Random"), "icon", ng::random_enemy_picture});
|
||||
} else if(leader == "null") {
|
||||
leaders.emplace_back(config_of("label", font::unicode_em_dash));
|
||||
leaders.emplace_back(config {"label", font::unicode_em_dash});
|
||||
} else {
|
||||
leaders.emplace_back(config_of("label", "?"));
|
||||
leaders.emplace_back(config {"label", "?"});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "gui/dialogs/multiplayer/mp_create_game.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
@ -172,7 +171,7 @@ void mp_create_game::pre_show(window& win)
|
|||
//
|
||||
std::vector<config> game_types;
|
||||
for(level_type_info& type_info : level_types_) {
|
||||
game_types.emplace_back(config_of("label", type_info.second));
|
||||
game_types.emplace_back(config {"label", type_info.second});
|
||||
}
|
||||
|
||||
if(game_types.empty()) {
|
||||
|
@ -205,7 +204,7 @@ void mp_create_game::pre_show(window& win)
|
|||
|
||||
std::vector<config> era_names;
|
||||
for(const auto& era : create_engine_.get_const_extras_by_type(ng::create_engine::ERA)) {
|
||||
era_names.emplace_back(config_of("label", era->name)("tooltip", era->description));
|
||||
era_names.emplace_back(config {"label", era->name, "tooltip", era->description});
|
||||
}
|
||||
|
||||
if(era_names.empty()) {
|
||||
|
@ -272,7 +271,7 @@ void mp_create_game::pre_show(window& win)
|
|||
//
|
||||
std::vector<config> rfm_options;
|
||||
for(const auto& type : rfm_types_) {
|
||||
rfm_options.emplace_back(config_of("label", mp_game_settings::RANDOM_FACTION_MODE::enum_to_string(type)));
|
||||
rfm_options.emplace_back(config {"label", mp_game_settings::RANDOM_FACTION_MODE::enum_to_string(type)});
|
||||
};
|
||||
|
||||
// Manually insert tooltips. Need to find a better way to do this
|
||||
|
@ -398,20 +397,22 @@ void mp_create_game::pre_show(window& win)
|
|||
plugins_context_->set_accessor("game_config", [this](const config&) {return cfg_; });
|
||||
plugins_context_->set_accessor("get_selected", [this](const config&) {
|
||||
const ng::level& current_level = create_engine_.current_level();
|
||||
return config_of
|
||||
("id", current_level.id())
|
||||
("name", current_level.name())
|
||||
("icon", current_level.icon())
|
||||
("description", current_level.description())
|
||||
("allow_era_choice", current_level.allow_era_choice())
|
||||
("type", create_engine_.current_level_type());
|
||||
return config {
|
||||
"id", current_level.id(),
|
||||
"name", current_level.name(),
|
||||
"icon", current_level.icon(),
|
||||
"description", current_level.description(),
|
||||
"allow_era_choice", current_level.allow_era_choice(),
|
||||
"type", create_engine_.current_level_type(),
|
||||
};
|
||||
});
|
||||
|
||||
plugins_context_->set_accessor("find_level", [this](const config& cfg) {
|
||||
const std::string id = cfg["id"].str();
|
||||
return config_of
|
||||
("index", create_engine_.find_level_by_id(id))
|
||||
("type", create_engine_.find_level_type_by_id(id));
|
||||
return config {
|
||||
"index", create_engine_.find_level_by_id(id),
|
||||
"type", create_engine_.find_level_type_by_id(id),
|
||||
};
|
||||
});
|
||||
|
||||
plugins_context_->set_accessor_int("find_era", [this](const config& cfg) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "gui/dialogs/multiplayer/mp_options_helper.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
|
@ -328,7 +327,7 @@ config mp_options_helper::get_options_config()
|
|||
mod.add_child("options", options_data_[source.id]);
|
||||
#else
|
||||
for(const auto& option : options_data_[source.id].attribute_range()) {
|
||||
mod.add_child("option", config_of("id", option.first)("value", option.second));
|
||||
mod.add_child("option", config {"id", option.first, "value", option.second});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "gui/dialogs/multiplayer/mp_staging.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "font/text_formatting.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
@ -201,7 +200,7 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
// We use an index-based loop in order to get the index of the selected option
|
||||
std::vector<config> ai_options;
|
||||
for(unsigned i = 0; i < ai_algorithms_.size(); i++) {
|
||||
ai_options.emplace_back(config_of("label", ai_algorithms_[i]->text));
|
||||
ai_options.emplace_back(config {"label", ai_algorithms_[i]->text});
|
||||
|
||||
if(ai_algorithms_[i]->id == side->ai_algorithm()) {
|
||||
selection = i;
|
||||
|
@ -220,7 +219,7 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
//
|
||||
std::vector<config> controller_names;
|
||||
for(const auto& controller : side->controller_options()) {
|
||||
controller_names.emplace_back(config_of("label", controller.second));
|
||||
controller_names.emplace_back(config {"label", controller.second});
|
||||
}
|
||||
|
||||
menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
|
||||
|
@ -246,7 +245,7 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
//
|
||||
std::vector<config> team_names;
|
||||
for(const auto& team : side->player_teams()) {
|
||||
team_names.emplace_back(config_of("label", team));
|
||||
team_names.emplace_back(config {"label", team});
|
||||
}
|
||||
|
||||
menu_button& team_selection = find_widget<menu_button>(&row_grid, "side_team", false);
|
||||
|
@ -264,10 +263,10 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
//
|
||||
std::vector<config> color_options;
|
||||
for(const auto& color : side->color_options()) {
|
||||
color_options.emplace_back(config_of
|
||||
("label", font::get_color_string_pango(color))
|
||||
("icon", (formatter() << "misc/status.png~RC(magenta>" << color << ")").str())
|
||||
);
|
||||
color_options.emplace_back(config {
|
||||
"label", font::get_color_string_pango(color),
|
||||
"icon", (formatter() << "misc/status.png~RC(magenta>" << color << ")").str(),
|
||||
});
|
||||
}
|
||||
|
||||
menu_button& color_selection = find_widget<menu_button>(&row_grid, "side_color", false);
|
||||
|
@ -488,7 +487,7 @@ void mp_staging::network_handler(window& window)
|
|||
|
||||
std::vector<config> controller_names;
|
||||
for(const auto& controller : side->controller_options()) {
|
||||
controller_names.emplace_back(config_of("label", controller.second));
|
||||
controller_names.emplace_back(config {"label", controller.second});
|
||||
}
|
||||
|
||||
menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "gui/dialogs/preferences_dialog.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "formatter.hpp"
|
||||
|
@ -702,7 +701,7 @@ void preferences_dialog::post_build(window& window)
|
|||
|
||||
std::vector<config> hotkey_category_entries;
|
||||
for(const auto& name : cat_names_) {
|
||||
hotkey_category_entries.emplace_back(config_of("label", name)("checkbox", false));
|
||||
hotkey_category_entries.emplace_back(config {"label", name, "checkbox", false});
|
||||
}
|
||||
|
||||
multimenu_button& hotkey_menu = find_widget<multimenu_button>(&window, "hotkey_category_menu", false);
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "gui/dialogs/statistics_dialog.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "font/constants.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
@ -68,7 +67,7 @@ void statistics_dialog::pre_show(window& window)
|
|||
//
|
||||
std::vector<config> menu_items;
|
||||
for(const auto& scenario : scenarios_) {
|
||||
menu_items.emplace_back(config_of("label", *scenario.first));
|
||||
menu_items.emplace_back(config {"label", *scenario.first});
|
||||
}
|
||||
|
||||
menu_button& scenario_menu = find_widget<menu_button>(&window, "scenario_menu", false);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "wesnothd_connection.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "preferences/lobby.hpp"
|
||||
#include "log.hpp"
|
||||
|
@ -228,7 +227,7 @@ void chatbox::set_self_active(const bool /*active*/)
|
|||
void chatbox::send_chat_message(const std::string& message,
|
||||
bool /*allies_only*/)
|
||||
{
|
||||
::config c = config_of("message", config_of("message", message)("sender", preferences::login()));
|
||||
::config c {"message", ::config {"message", message, "sender", preferences::login()}};
|
||||
add_chat_message(time(nullptr), preferences::login(), 0, message);
|
||||
|
||||
if(wesnothd_connection_) {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "gui/core/register_widget.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
#include "utils/functional.hpp"
|
||||
|
@ -48,7 +47,7 @@ menu_button::menu_button()
|
|||
, keep_open_(false)
|
||||
, droplist_(nullptr)
|
||||
{
|
||||
values_.emplace_back(config_of("label", this->get_label()));
|
||||
values_.emplace_back(::config {"label", this->get_label()});
|
||||
|
||||
connect_signal<event::MOUSE_ENTER>(
|
||||
std::bind(&menu_button::signal_handler_mouse_enter, this, _2, _3));
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "gui/core/register_widget.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
#include "formula/string_utils.hpp"
|
||||
|
@ -48,7 +47,7 @@ multimenu_button::multimenu_button()
|
|||
, toggle_states_()
|
||||
, droplist_(nullptr)
|
||||
{
|
||||
values_.emplace_back(config_of("label", this->get_label()));
|
||||
values_.emplace_back(::config {"label", this->get_label()});
|
||||
|
||||
connect_signal<event::MOUSE_ENTER>(
|
||||
std::bind(&multimenu_button::signal_handler_mouse_enter, this, _2, _3));
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "hotkey/hotkey_handler.hpp"
|
||||
|
||||
#include "actions/create.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "font/standard_colors.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
|
@ -393,13 +392,13 @@ void play_controller::hotkey_handler::expand_autosaves(std::vector<config>& item
|
|||
|
||||
if(savegame::save_game_exists(name, comp_format)) {
|
||||
newsaves.emplace_back(name + compression::format_extension(comp_format));
|
||||
newitems.emplace_back(config_of("label", _("Back to Turn ") + std::to_string(turn)));
|
||||
newitems.emplace_back(config {"label", _("Back to Turn ") + std::to_string(turn)});
|
||||
}
|
||||
}
|
||||
|
||||
if(savegame::save_game_exists(start_name, comp_format)) {
|
||||
newsaves.emplace_back(start_name + compression::format_extension(comp_format));
|
||||
newitems.emplace_back(config_of("label", _("Back to Start")));
|
||||
newitems.emplace_back(config {"label", _("Back to Start")});
|
||||
}
|
||||
|
||||
// Make sure list doesn't get too long: keep top two, midpoint and bottom.
|
||||
|
@ -438,7 +437,7 @@ void play_controller::hotkey_handler::show_menu(const std::vector<config>& items
|
|||
const hotkey::hotkey_command& command = hotkey::get_hotkey_command(id);
|
||||
|
||||
if(id == "wml" || (can_execute_command(command) && (!context_menu || in_context_menu(command.id)))) {
|
||||
items.emplace_back(config_of("id", id));
|
||||
items.emplace_back(config {"id", id});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "ai/manager.hpp"
|
||||
#include "chat_command_handler.hpp"
|
||||
#include "color.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "display_chat_manager.hpp"
|
||||
#include "font/standard_colors.hpp"
|
||||
#include "formatter.hpp"
|
||||
|
@ -691,11 +690,12 @@ void create_and_place(game_display&,
|
|||
unit_race::GENDER gender = unit_race::NUM_GENDERS)
|
||||
{
|
||||
synced_context::run_and_throw("debug_create_unit",
|
||||
config_of
|
||||
("x", loc.wml_x())
|
||||
("y", loc.wml_y())
|
||||
("type", u_type.id())
|
||||
("gender", gender_string(gender))
|
||||
config {
|
||||
"x", loc.wml_x(),
|
||||
"y", loc.wml_y(),
|
||||
"type", u_type.id(),
|
||||
"gender", gender_string(gender),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -753,7 +753,7 @@ void menu_handler::change_side(mouse_handler& mousehandler)
|
|||
void menu_handler::kill_unit(mouse_handler& mousehandler)
|
||||
{
|
||||
const map_location loc = mousehandler.get_last_hex();
|
||||
synced_context::run_and_throw("debug_kill", config_of("x", loc.wml_x())("y", loc.wml_y()));
|
||||
synced_context::run_and_throw("debug_kill", config {"x", loc.wml_x(), "y", loc.wml_y()});
|
||||
}
|
||||
|
||||
void menu_handler::label_terrain(mouse_handler& mousehandler, bool team_only)
|
||||
|
@ -1001,10 +1001,11 @@ void menu_handler::add_chat_message(const time_t& time,
|
|||
gui_->get_chat_manager().add_chat_message(time, speaker, side, message, type, false);
|
||||
|
||||
plugins_manager::get()->notify_event("chat",
|
||||
config_of
|
||||
("sender", preferences::login())
|
||||
("message", message)
|
||||
("whisper", type == events::chat_handler::MESSAGE_PRIVATE)
|
||||
config {
|
||||
"sender", preferences::login(),
|
||||
"message", message,
|
||||
"whisper", type == events::chat_handler::MESSAGE_PRIVATE,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1616,7 +1617,7 @@ void console_handler::do_nosaves()
|
|||
|
||||
void console_handler::do_next_level()
|
||||
{
|
||||
synced_context::run_and_throw("debug_next_level", config_of("next_level", get_data()));
|
||||
synced_context::run_and_throw("debug_next_level", config {"next_level", get_data()});
|
||||
}
|
||||
|
||||
void console_handler::do_choose_level()
|
||||
|
@ -1660,7 +1661,7 @@ void console_handler::do_choose_level()
|
|||
}
|
||||
|
||||
if(size_t(choice) < options.size()) {
|
||||
synced_context::run_and_throw("debug_next_level", config_of("next_level", options[choice]));
|
||||
synced_context::run_and_throw("debug_next_level", config {"next_level", options[choice]});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1673,13 +1674,13 @@ void console_handler::do_turn()
|
|||
if(!data.empty()) {
|
||||
turn = lexical_cast_default<int>(data, 1);
|
||||
}
|
||||
synced_context::run_and_throw("debug_turn", config_of("turn", turn));
|
||||
synced_context::run_and_throw("debug_turn", config {"turn", turn});
|
||||
}
|
||||
|
||||
void console_handler::do_turn_limit()
|
||||
{
|
||||
int limit = get_data().empty() ? -1 : lexical_cast_default<int>(get_data(), 1);
|
||||
synced_context::run_and_throw("debug_turn_limit", config_of("turn_limit", limit));
|
||||
synced_context::run_and_throw("debug_turn_limit", config {"turn_limit", limit});
|
||||
}
|
||||
|
||||
void console_handler::do_debug()
|
||||
|
@ -1706,7 +1707,7 @@ void console_handler::do_lua()
|
|||
return;
|
||||
}
|
||||
|
||||
synced_context::run_and_throw("debug_lua", config_of("code", get_data()));
|
||||
synced_context::run_and_throw("debug_lua", config {"code", get_data()});
|
||||
}
|
||||
|
||||
void console_handler::do_unsafe_lua()
|
||||
|
@ -1768,7 +1769,7 @@ void console_handler::do_set_var()
|
|||
if(j != data.end()) {
|
||||
const std::string name(data.begin(), j);
|
||||
const std::string value(j + 1, data.end());
|
||||
synced_context::run_and_throw("debug_set_var", config_of("name", name)("value", value));
|
||||
synced_context::run_and_throw("debug_set_var", config {"name", name, "value", value});
|
||||
} else {
|
||||
command_failed(_("Variable not found"));
|
||||
}
|
||||
|
@ -1826,11 +1827,12 @@ void console_handler::do_unit()
|
|||
}
|
||||
|
||||
synced_context::run_and_throw("debug_unit",
|
||||
config_of
|
||||
("x", loc.wml_x())
|
||||
("y", loc.wml_y())
|
||||
("name", parameters[0])
|
||||
("value", parameters[1])
|
||||
config {
|
||||
"x", loc.wml_x(),
|
||||
"y", loc.wml_y(),
|
||||
"name", parameters[0],
|
||||
"value", parameters[1],
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1881,12 +1883,12 @@ void console_handler::do_shroud()
|
|||
|
||||
void console_handler::do_gold()
|
||||
{
|
||||
synced_context::run_and_throw("debug_gold", config_of("gold", lexical_cast_default<int>(get_data(), 1000)));
|
||||
synced_context::run_and_throw("debug_gold", config {"gold", lexical_cast_default<int>(get_data(), 1000)});
|
||||
}
|
||||
|
||||
void console_handler::do_event()
|
||||
{
|
||||
synced_context::run_and_throw("debug_event", config_of("eventname", get_data()));
|
||||
synced_context::run_and_throw("debug_event", config {"eventname", get_data()});
|
||||
}
|
||||
|
||||
void console_handler::do_toggle_draw_coordinates()
|
||||
|
@ -1950,7 +1952,7 @@ void menu_handler::request_control_change(int side_num, const std::string& playe
|
|||
} else {
|
||||
// The server will (or won't because we aren't allowed to change the controller)
|
||||
// send us a [change_controller] back, which we then handle in playturn.cpp
|
||||
pc_.send_to_wesnothd(config_of("change_controller", config_of("side", side)("player", player)));
|
||||
pc_.send_to_wesnothd(config {"change_controller", config {"side", side, "player", player}});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "ai/manager.hpp"
|
||||
#include "ai/game_info.hpp"
|
||||
#include "ai/testing.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "display_chat_manager.hpp"
|
||||
#include "game_end_exceptions.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
|
@ -315,12 +314,13 @@ LEVEL_RESULT playsingle_controller::play_scenario(const config& level)
|
|||
}
|
||||
// If we're a player, and the result is victory/defeat, then send
|
||||
// a message to notify the server of the reason for the game ending.
|
||||
send_to_wesnothd(config_of
|
||||
("info", config_of
|
||||
("type", "termination")
|
||||
("condition", "game over")
|
||||
("result", is_victory ? "victory" : "defeat")
|
||||
));
|
||||
send_to_wesnothd(config {
|
||||
"info", config {
|
||||
"type", "termination",
|
||||
"condition", "game over",
|
||||
"result", is_victory ? "victory" : "defeat",
|
||||
},
|
||||
});
|
||||
// Play victory music once all victory events
|
||||
// are finished, if we aren't observers and the
|
||||
// carryover dialog isn't disabled.
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*/
|
||||
|
||||
#include "playturn_network_adapter.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "log.hpp"
|
||||
|
||||
#include "utils/functional.hpp"
|
||||
|
@ -55,7 +54,7 @@ void playturn_network_adapter::read_from_network()
|
|||
config child;
|
||||
child["side_num"] = back["side_drop"];
|
||||
child["controller"] = back["controller"];
|
||||
this->data_.emplace_back(config_of("side_drop", child));
|
||||
this->data_.emplace_back(config {"side_drop", child});
|
||||
back.remove_attribute("side_drop");
|
||||
back.remove_attribute("controller");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "replay.hpp"
|
||||
|
||||
#include "actions/undo.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "display_chat_manager.hpp"
|
||||
#include "floating_label.hpp"
|
||||
#include "game_display.hpp"
|
||||
|
@ -647,7 +646,7 @@ bool replay::add_start_if_not_there_yet()
|
|||
//since pos is 0, at_end() is equivalent to empty()
|
||||
if(at_end() || !base_->get_command_at(0).has_child("start"))
|
||||
{
|
||||
base_->insert_command(0) = config_of("start", config())("sent", true);
|
||||
base_->insert_command(0) = config {"start", config(), "sent", true};
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "log.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "playsingle_controller.hpp"
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
|
||||
#include "saved_game.hpp"
|
||||
#include "carryover.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "cursor.hpp"
|
||||
#include "log.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
|
@ -217,7 +216,7 @@ void saved_game::expand_scenario()
|
|||
|
||||
// Add addon_id information if it exists.
|
||||
if (!scenario["addon_id"].empty() && scenario["require_scenario"].to_bool(false)) {
|
||||
mp_settings_.update_addon_requirements(config_of("id",scenario["addon_id"])("version", scenario["addon_version"])("min_version", scenario["addon_min_version"]));
|
||||
mp_settings_.update_addon_requirements(config {"id",scenario["addon_id"], "version", scenario["addon_version"], "min_version", scenario["addon_min_version"]});
|
||||
}
|
||||
|
||||
update_label();
|
||||
|
@ -269,7 +268,7 @@ void saved_game::load_mod(const std::string& type, const std::string& id)
|
|||
std::string require_attr = "require_" + type;
|
||||
bool require_default = (type == "era"); // By default, eras have "require_era = true", and mods have "require_modification = false"
|
||||
if (!cfg["addon_id"].empty() && cfg[require_attr].to_bool(require_default)) {
|
||||
mp_settings_.update_addon_requirements(config_of("id",cfg["addon_id"])("version", cfg["addon_version"])("min_version", cfg["addon_min_version"]));
|
||||
mp_settings_.update_addon_requirements(config {"id",cfg["addon_id"], "version", cfg["addon_version"], "min_version", cfg["addon_min_version"]});
|
||||
}
|
||||
|
||||
// Copy events
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "save_index.hpp"
|
||||
#include "carryover.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "format_time_summary.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
|
@ -773,12 +772,12 @@ static void convert_old_saves_1_13_0(config& cfg)
|
|||
}
|
||||
//This code is needed because for example otherwise it won't find the (empty) era
|
||||
if(!cfg.has_child("multiplayer")) {
|
||||
cfg.add_child("multiplayer", config_of
|
||||
("mp_era", "era_blank")
|
||||
("show_connect", false)
|
||||
("show_configure", false)
|
||||
("mp_use_map_settings", true)
|
||||
);
|
||||
cfg.add_child("multiplayer", config {
|
||||
"mp_era", "era_blank",
|
||||
"show_connect", false,
|
||||
"show_configure", false,
|
||||
"mp_use_map_settings", true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,6 @@
|
|||
#include "variable.hpp" // for vconfig, etc
|
||||
#include "variable_info.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include "utils/functional.hpp" // for bind_t, bind
|
||||
#include <boost/range/algorithm/copy.hpp> // boost::copy
|
||||
|
@ -2957,7 +2956,10 @@ static int intf_modify_ai(lua_State *L, const char* action)
|
|||
{
|
||||
int side_num = luaL_checkinteger(L, 1);
|
||||
std::string path = luaL_checkstring(L, 2);
|
||||
config cfg = config_of("action", action)("path", path);
|
||||
config cfg {
|
||||
"action", action,
|
||||
"path", path
|
||||
};
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
ai::manager::modify_active_ai_for_side(side_num, cfg);
|
||||
return 0;
|
||||
|
@ -2990,12 +2992,12 @@ static int intf_append_ai(lua_State *L)
|
|||
int side_num = luaL_checkinteger(L, 1);
|
||||
config cfg = luaW_checkconfig(L, 2);
|
||||
if(!cfg.has_child("ai")) {
|
||||
cfg = config_of("ai", cfg);
|
||||
cfg = config {"ai", cfg};
|
||||
}
|
||||
bool added_dummy_stage = false;
|
||||
if(!cfg.child("ai").has_child("stage")) {
|
||||
added_dummy_stage = true;
|
||||
cfg.child("ai").add_child("stage", config_of("name", "empty"));
|
||||
cfg.child("ai").add_child("stage", config {"name", "empty"});
|
||||
}
|
||||
ai::configuration::expand_simplified_aspects(side_num, cfg);
|
||||
if(added_dummy_stage) {
|
||||
|
|
|
@ -19,7 +19,6 @@ See the COPYING file for more details.
|
|||
#include "scripting/push_check.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "sound_music_track.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include <set>
|
||||
|
||||
|
@ -161,9 +160,10 @@ static int intf_music_add(lua_State* L) {
|
|||
index = lua_tointeger(L, 1);
|
||||
lua_remove(L, 1);
|
||||
}
|
||||
config cfg = config_of
|
||||
("name", luaL_checkstring(L, 1))
|
||||
("append", true);
|
||||
config cfg = config {
|
||||
"name", luaL_checkstring(L, 1),
|
||||
"append", true,
|
||||
};
|
||||
bool found_ms_before = false, found_ms_after = false, found_imm = false;
|
||||
for(int i = 2; i <= lua_gettop(L); i++) {
|
||||
if(lua_isboolean(L, i)) {
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
#include "scripting/plugins/manager.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
#include "utils/functional.hpp"
|
||||
|
@ -74,12 +72,12 @@ void plugins_context::set_accessor(const std::string & name, accessor_function f
|
|||
|
||||
void plugins_context::set_accessor_string(const std::string & name, std::function<std::string(config)> func)
|
||||
{
|
||||
set_accessor(name, [func, name](const config& cfg) { return config_of(name, func(cfg)); });
|
||||
set_accessor(name, [func, name](const config& cfg) { return config {name, func(cfg)}; });
|
||||
}
|
||||
|
||||
void plugins_context::set_accessor_int(const std::string & name, std::function<int(config)> func)
|
||||
{
|
||||
set_accessor(name, [func, name](const config& cfg) { return config_of(name, func(cfg)); });
|
||||
set_accessor(name, [func, name](const config& cfg) { return config {name, func(cfg)}; });
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "actions/undo.hpp"
|
||||
#include "ai/manager.hpp"
|
||||
#include "config.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "game_classification.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "random.hpp"
|
||||
|
@ -185,7 +184,7 @@ namespace
|
|||
/// We are in a game with no mp server and need to do this choice locally
|
||||
virtual config local_choice() const
|
||||
{
|
||||
return config_of("new_seed", seed_rng::next_seed_str());
|
||||
return config {"new_seed", seed_rng::next_seed_str()};
|
||||
}
|
||||
/// the request which is sended to the mp server.
|
||||
virtual config request() const
|
||||
|
@ -268,12 +267,12 @@ std::shared_ptr<randomness::rng> synced_context::get_rng_for_action()
|
|||
|
||||
void synced_context::server_choice::send_request() const
|
||||
{
|
||||
resources::controller->send_to_wesnothd(config_of
|
||||
("request_choice", config_of
|
||||
("request_id", resources::controller->get_server_request_number())
|
||||
(name(), request())
|
||||
)
|
||||
);
|
||||
resources::controller->send_to_wesnothd(config {
|
||||
"request_choice", config {
|
||||
"request_id", resources::controller->get_server_request_number(),
|
||||
name(), request(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,9 +438,10 @@ void set_scontext_synced::do_final_checkup(bool dont_throw)
|
|||
assert(!did_final_checkup_);
|
||||
std::stringstream msg;
|
||||
config co;
|
||||
config cn = config_of
|
||||
("random_calls", new_rng_->get_random_calls())
|
||||
("next_unit_id", resources::gameboard->unit_id_manager().get_save_id() + 1);
|
||||
config cn {
|
||||
"random_calls", new_rng_->get_random_calls(),
|
||||
"next_unit_id", resources::gameboard->unit_id_manager().get_save_id() + 1,
|
||||
};
|
||||
if(checkup_instance->local_checkup(cn, co))
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "synced_user_choice.hpp"
|
||||
|
||||
#include "actions/undo.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "floating_label.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "game_data.hpp"
|
||||
|
@ -201,7 +200,7 @@ config mp_sync::get_user_choice(const std::string &name, const mp_sync::user_cho
|
|||
//most likely we are in a start event with an empty side 1
|
||||
//but calling [set_global_variable] to an empty side might also cause this.
|
||||
//i think in that case we should better use uch.random_choice(),
|
||||
//which could return something like config_of("invalid", true);
|
||||
//which could return something like config {"invalid", true};
|
||||
side = 1;
|
||||
while ( side <= max_side && resources::gameboard->get_team(side).is_empty() )
|
||||
side++;
|
||||
|
|
12
src/team.cpp
12
src/team.cpp
|
@ -32,7 +32,6 @@
|
|||
#include "units/types.hpp"
|
||||
#include "synced_context.hpp"
|
||||
#include "whiteboard/side_actions.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
|
||||
|
@ -488,15 +487,16 @@ namespace
|
|||
/// We are in a game with no mp server and need to do this choice locally
|
||||
virtual config local_choice() const
|
||||
{
|
||||
return config_of("controller", new_controller_)("is_local", true);
|
||||
return config {"controller", new_controller_, "is_local", true};
|
||||
}
|
||||
/// the request which is sended to the mp server.
|
||||
virtual config request() const
|
||||
{
|
||||
return config_of
|
||||
("new_controller", new_controller_)
|
||||
("old_controller", team_.controller())
|
||||
("side", team_.side());
|
||||
return config {
|
||||
"new_controller", new_controller_,
|
||||
"old_controller", team_.controller(),
|
||||
"side", team_.side(),
|
||||
};
|
||||
}
|
||||
virtual const char* name() const
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "addon/client.hpp"
|
||||
#include "addon/info.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "config_cache.hpp"
|
||||
#include "editor/editor_display.hpp" // for dummy display context
|
||||
#include "filesystem.hpp"
|
||||
|
@ -588,7 +587,7 @@ struct dialog_tester<campaign_selection>
|
|||
{
|
||||
saved_game state;
|
||||
ng::create_engine ng;
|
||||
dialog_tester() : state(config_of("campaign_type", "scenario")), ng(test_utils::get_fake_display(-1, -1).video(), state)
|
||||
dialog_tester() : state(config {"campaign_type", "scenario"}), ng(test_utils::get_fake_display(-1, -1).video(), state)
|
||||
{
|
||||
}
|
||||
campaign_selection* create()
|
||||
|
@ -902,7 +901,7 @@ struct dialog_tester<mp_create_game>
|
|||
{
|
||||
saved_game state;
|
||||
ng::create_engine engine;
|
||||
dialog_tester() : state(config_of("campaign_type", "multiplayer")), engine(test_utils::get_fake_display(-1, -1).video(), state)
|
||||
dialog_tester() : state(config {"campaign_type", "multiplayer"}), engine(test_utils::get_fake_display(-1, -1).video(), state)
|
||||
{
|
||||
}
|
||||
mp_create_game* create()
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <cmath>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "variable_info.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE ( test_config )
|
||||
|
@ -227,17 +226,18 @@ BOOST_AUTO_TEST_CASE ( test_variable_info )
|
|||
BOOST_CHECK_THROW(access.as_scalar(), invalid_variablename_exception);
|
||||
}
|
||||
{
|
||||
const config nonempty = config_of
|
||||
("tag1", config())
|
||||
("tag1", config_of
|
||||
("tag2", config())
|
||||
("tag2", config())
|
||||
("tag2", config_of
|
||||
("atribute1", 88)
|
||||
("atribute2", "value")
|
||||
)
|
||||
)
|
||||
("tag1", config());
|
||||
const config nonempty {
|
||||
"tag1", config(),
|
||||
"tag1", config {
|
||||
"tag2", config(),
|
||||
"tag2", config(),
|
||||
"tag2", config {
|
||||
"atribute1", 88,
|
||||
"atribute2", "value",
|
||||
},
|
||||
},
|
||||
"tag1", config(),
|
||||
};
|
||||
/** This is the config:
|
||||
[tag1]
|
||||
[/tag1]
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "config_assign.hpp"
|
||||
#include "recall_list_manager.hpp"
|
||||
#include "tests/utils/game_config_manager.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
@ -26,10 +25,11 @@ BOOST_AUTO_TEST_SUITE( recall_list_suite )
|
|||
BOOST_AUTO_TEST_CASE( test_1 ) {
|
||||
config game_config(test_utils::get_test_config());
|
||||
|
||||
config orc_config = config_of
|
||||
("id", "Orcish Grunt")
|
||||
("random_traits", false)
|
||||
("animate", false);
|
||||
config orc_config {
|
||||
"id", "Orcish Grunt",
|
||||
"random_traits", false,
|
||||
"animate", false,
|
||||
};
|
||||
|
||||
unit_type orc_type(orc_config);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "theme.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "font/sdl_ttf.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "hotkey/hotkey_command.hpp"
|
||||
|
@ -504,7 +503,7 @@ theme::menu::menu(const config& cfg)
|
|||
, items_()
|
||||
{
|
||||
for(const auto& item : utils::split(cfg["items"])) {
|
||||
items_.emplace_back(config_of("id", item));
|
||||
items_.emplace_back(config {"id", item});
|
||||
}
|
||||
|
||||
if(cfg["auto_tooltip"].to_bool() && tooltip_.empty() && items_.size() == 1) {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "units/abilities.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
@ -415,12 +414,12 @@ void tod_manager::update_server_information() const
|
|||
//NOTE: The current implementation does not guarnateee that the server gets informed
|
||||
// about those changes in 100% of cases. But that is ok because the information is only
|
||||
// used to display the turn limit in the lobby (as opposed to things that cause OOS).
|
||||
resources::controller->send_to_wesnothd(config_of
|
||||
("change_turns_wml", config_of
|
||||
("current", turn_)
|
||||
("max", num_turns_)
|
||||
)
|
||||
);
|
||||
resources::controller->send_to_wesnothd(config {
|
||||
"change_turns_wml", config {
|
||||
"current", turn_,
|
||||
"max", num_turns_,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
void tod_manager::modify_turns_by_wml(const std::string& mod)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "variable.hpp"
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_data.hpp"
|
||||
|
@ -39,7 +38,7 @@ static lg::log_domain log_engine("engine");
|
|||
#define ERR_NG LOG_STREAM(err, log_engine)
|
||||
namespace
|
||||
{
|
||||
const config as_nonempty_range_default = config_of("_", config());
|
||||
const config as_nonempty_range_default("_");
|
||||
config::const_child_itors as_nonempty_range(const std::string& varname)
|
||||
{
|
||||
config::const_child_itors range = as_nonempty_range_default.child_range("_");
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "config_assign.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
@ -47,7 +46,7 @@ void resolve_negative_value(int size, int& val)
|
|||
}
|
||||
}
|
||||
|
||||
const config non_empty_const_cfg = config_of("_", config());
|
||||
const config non_empty_const_cfg("_");
|
||||
|
||||
/**
|
||||
* Parses a ']' terminated string.
|
||||
|
|
Loading…
Add table
Reference in a new issue