bool persist_file_context::set_var(const std::string &global,const config &val, bool immediate) { config bak; config bactive; if (immediate) { bak = cfg_; bactive = get_node(bak, namespace_, true)->child_or_add("variables"); load(); } config *active = get_node(cfg_, namespace_, true); config &cfg = active->child_or_add("variables"); if (val.has_attribute(global)) { if (val[global].empty()) { clear_var(global,immediate); } else { cfg[global] = val[global]; if (immediate) bactive[global] = val[global]; } } else { cfg.clear_children(global); cfg.append(val); if (immediate) { bactive.clear_children(global); bactive.append(val); } } // dirty_ = true; if (!in_transaction_) return save_context(); else if (immediate) { bool ret = save_context(); cfg_ = bak; active = get_node(cfg_, namespace_, true); active->clear_children("variables"); active->remove_attribute("variables"); active->add_child("variables",bactive); return ret; } else return true; }
tcontrol_definition::tcontrol_definition(const config& cfg) : id(cfg["id"]) , description(cfg["description"].t_str()) , resolutions() { /*WIKI * @page = GUIWidgetDefinitionWML * @order = 1 * * {{Autogenerated}} * * = Widget definition = * * This page describes the definition of all widgets in the toolkit. Every * widget has some parts in common, first of all; every definition has the * following fields. * @begin{parent}{name="generic/"} * @begin{tag}{name=widget_definition}{min=0}{max=1} * @begin{table}{config} * id & string & & Unique id for this gui (theme). $ * description & t_string & & Unique translatable name for this gui. $ * * resolution & section & & The definitions of the widget in various * resolutions. $ * @end{table} * @end{tag}{name=widget_definition} * @end{parent}{name="generic/"} */ VALIDATE(!id.empty(), missing_mandatory_wml_key("control", "id")); VALIDATE(!description.empty() , missing_mandatory_wml_key("control", "description")); /* * Do this validation here instead of in load_resolutions so the * translatable string is not in the header and we don't need to pull in * extra header dependencies. */ config::const_child_itors itors = cfg.child_range("resolution"); VALIDATE(itors.first != itors.second, _("No resolution defined.")); }
/* * Set the initial 'alive' cells. * * INPUT: &cnfg Config file to store initial 'alive' cells */ void reader::set_living(config &cnfg) { int start, end; // Check if the keyword exists start = data.find("Initial"); if (start == string::npos || start >= data.size()) return; // Find the start and end index of the "Initial" statement start = data.find("{", start+7); end = data.find("}", start+1); // Make sure a complete statement exists if (start == string::npos || start >= data.size() || end == string::npos || end >= data.size()) return; int x, y; bool done = false; istringstream stream(data.substr(start, end-start+1)); while (stream.good()) { // Find the next 'Y' char if (stream.peek() == 'Y') { done = false; // Process the column of alive cells (current row in .aut file) while (!done) { // Grab the y coordinate if (isdigit(stream.peek()) || stream.peek() == '-') { stream >> y; // Grab the x coordinates while (1) { if (isdigit(stream.peek()) || stream.peek() == '-') { stream >> x; cnfg.add(x, y); } else if (stream.peek() == ';') break; else stream.get(); } // End x coordinates done = true; }
static void enter_connect_mode(game_display& disp, const config& game_config, mp::chat& chat, config& gamelist, const mp_game_settings& params, const int num_turns, mp::controller default_controller, bool local_players_only = false) { mp::ui::result res; game_state state; const network::manager net_manager(1,1); network_game_manager m; gamelist.clear(); statistics::fresh_stats(); { mp::connect ui(disp, game_config, chat, gamelist, params, num_turns, default_controller, local_players_only); run_lobby_loop(disp, ui); res = ui.get_result(); // start_game() updates the parameters to reflect game start, // so it must be called before get_level() if (res == mp::ui::PLAY) { ui.start_game(); state = ui.get_state(); } } switch (res) { case mp::ui::PLAY: play_game(disp, state, game_config, IO_SERVER); recorder.clear(); break; case mp::ui::CREATE: enter_create_mode(disp, game_config, chat, gamelist, default_controller, local_players_only); break; case mp::ui::QUIT: default: network::send_data(config("refresh_lobby"), 0); break; } }
void editor_toolkit::init_mouse_actions(const config& game_config, context_manager& cmanager) { mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_PAINT, new mouse_action_paint(&brush_, key_, *palette_manager_->terrain_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_FILL, new mouse_action_fill(key_, *palette_manager_->terrain_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_SELECT, new mouse_action_select(&brush_, key_, *palette_manager_->empty_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_STARTING_POSITION, new mouse_action_starting_position(key_, *palette_manager_->empty_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_LABEL, new mouse_action_map_label(key_, *palette_manager_->empty_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_UNIT, new mouse_action_unit(key_, *palette_manager_->unit_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_VILLAGE, new mouse_action_village(key_, *palette_manager_->empty_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_PASTE, new mouse_action_paste(cmanager.get_clipboard(), key_, *palette_manager_->empty_palette_.get()))); mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_ITEM, new mouse_action_item(key_, *palette_manager_->item_palette_.get()))); BOOST_FOREACH(const theme::menu& menu, gui_.get_theme().menus()) { if (menu.items().size() == 1) { hotkey::HOTKEY_COMMAND hk = hotkey::get_id(menu.items().front()); mouse_action_map::iterator i = mouse_actions_.find(hk); if (i != mouse_actions_.end()) { i->second->set_toolbar_button(&menu); } } } BOOST_FOREACH(const config &c, game_config.child_range("editor_tool_hint")) { mouse_action_map::iterator i = mouse_actions_.find(hotkey::get_id(c["id"])); if (i != mouse_actions_.end()) { mouse_action_hints_.insert(std::make_pair(i->first, c["text"])); } } mouse_action_ = (mouse_actions_.find(hotkey::HOTKEY_EDITOR_TOOL_PAINT))->second; set_mouseover_overlay(); }
builder_slider::builder_slider(const config& cfg) : implementation::builder_styled_widget(cfg) , best_slider_length_(cfg["best_slider_length"]) , minimum_value_(cfg["minimum_value"]) , maximum_value_(cfg["maximum_value"]) , step_size_(cfg["step_size"]) , value_(cfg["value"]) , minimum_value_label_(cfg["minimum_value_label"].t_str()) , maximum_value_label_(cfg["maximum_value_label"].t_str()) , value_labels_() { const config& labels = cfg.child("value_labels"); if(!labels) { return; } for(const auto & label : labels.child_range("value")) { value_labels_.push_back(label["label"]); } }
timage_definition::tresolution::tresolution(const config& cfg) : tresolution_definition_(cfg) { /*WIKI * @page = GUIWidgetDefinitionWML * @order = 1_image * * == Image == * * @macro = image_description * * The definition of an image. The label field of the widget is used as the * name of file to show. The widget normally has no event interaction so only * one state is defined. * * The following states exist: * * state_enabled, the image is enabled. */ // Note the order should be the same as the enum tstate in image.hpp. state.push_back(tstate_definition(cfg.child("state_enabled"))); }
//changes done during 1.11.0-dev static void convert_old_saves_1_11_0(config& cfg) { if(!cfg.has_child("snapshot")){ return; } const config& snapshot = cfg.child("snapshot"); const config& replay_start = cfg.child("replay_start"); const config& replay = cfg.child("replay"); if(!cfg.has_child("carryover_sides") && !cfg.has_child("carryover_sides_start")){ config carryover; //copy rng and menu items from toplevel to new carryover_sides carryover["random_seed"] = cfg["random_seed"]; carryover["random_calls"] = cfg["random_calls"]; BOOST_FOREACH(const config& menu_item, cfg.child_range("menu_item")){ carryover.add_child("menu_item", menu_item); } carryover["difficulty"] = cfg["difficulty"]; carryover["random_mode"] = cfg["random_mode"]; //the scenario to be played is always stored as next_scenario in carryover_sides_start carryover["next_scenario"] = cfg["scenario"]; config carryover_start = carryover; //copy sides from either snapshot or replay_start to new carryover_sides if(!snapshot.empty()){ BOOST_FOREACH(const config& side, snapshot.child_range("side")){ carryover.add_child("side", side); } //for compatibility with old savegames that use player instead of side BOOST_FOREACH(const config& side, snapshot.child_range("player")){ carryover.add_child("side", side); } //save the sides from replay_start in carryover_sides_start BOOST_FOREACH(const config& side, replay_start.child_range("side")){ carryover_start.add_child("side", side); } //for compatibility with old savegames that use player instead of side BOOST_FOREACH(const config& side, replay_start.child_range("player")){ carryover_start.add_child("side", side); } } else if (!replay_start.empty()){
game_state::game_state(const config & level, play_controller & pc, game_board& board) : gamedata_(level), board_(board), tod_manager_(level), pathfind_manager_(new pathfind::manager(level)), reports_(new reports()), lua_kernel_(new game_lua_kernel(NULL, *this, pc, *reports_)), events_manager_(new game_events::manager()), player_number_(level["playing_team"].to_int() + 1), end_level_data_(), init_side_done_(level["init_side_done"].to_bool(false)), first_human_team_(-1) { events_manager_->read_scenario(level); if(const config& endlevel_cfg = level.child("end_level_data")) { end_level_data el_data; el_data.read(endlevel_cfg); el_data.transient.carryover_report = false; end_level_data_ = el_data; } }
matrix<math::real, 3> angular(const rigid::skeleton& skel, const config& at) { const natural n = skel.size(); assert( at.rows() == n ); mat res = mat::Zero(3, 6*n); const vec3 c = com(skel) ( at ); skel.each( [&](math::natural i) { res.block<3, 3>(0, 6*i) = at(i).rotation().matrix() * skel.topology[i].inertia.asDiagonal(); const vec3 ri = at(i).translation() - c; res.block<3, 3>(0, 6*i + 3) = skel.topology[i].mass * math::hat( ri ) * at(i).rotation().matrix(); }); return std::move(res); }
std::vector<std::string> get_text(const std::string &campaign, bool split_multiline_headers) { std::vector< std::string > res; config::child_itors about_entries = about_list.child_range("about"); if (!campaign.empty()) { for (const config &about : about_entries) { // just finished a particular campaign if (campaign == about["id"]) { add_lines(res, about, split_multiline_headers); } } } for (const config &about : about_entries) { add_lines(res, about, split_multiline_headers); } return res; }
theme::status_item::status_item(const config& cfg) : object(cfg), prefix_(cfg["prefix"] + cfg["prefix_literal"]), postfix_(cfg["postfix_literal"] + cfg["postfix"]), label_(), font_(atoi(cfg["font_size"].c_str())), font_rgb_set_(false), font_rgb_(DefaultFontRGB) { if(font_ == 0) font_ = DefaultFontSize; const config* const label_child = cfg.child("label"); if(label_child != NULL) { label_ = label(*label_child); } if(cfg["font_rgb"].size()){ std::vector<std::string> rgb_vec = utils::split(cfg["font_rgb"]); if(3 <= rgb_vec.size()){ std::vector<std::string>::iterator c=rgb_vec.begin(); int r,g,b; r = (atoi(c->c_str())); c++; if(c != rgb_vec.end()){ g = (atoi(c->c_str())); }else{ g=0; } c++; if(c != rgb_vec.end()){ b=(atoi(c->c_str())); }else{ b=0; } font_rgb_ = (((r<<16) & 0x00FF0000) + ((g<<8) & 0x0000FF00) + ((b) & 0x000000FF)); font_rgb_set_=true; } } }
tcontrol_definition::tcontrol_definition(const config& cfg) : id(cfg["id"]), description(cfg["description"]), resolutions() { /*WIKI * @page = GUIWidgetDefinitionWML * @order = 1 * * THIS PAGE IS AUTOMATICALLY GENERATED, DO NOT MODIFY DIRECTLY !!! * * = Widget definition = * * This page describes the definition of all widgets in the toolkit. Every * widget has some parts in common, first of all every definition has the * following fields. * * @start_table = config * id (string) Unique id for this gui (theme). * description (t_string) Unique translatable name for this gui. * * resolution (section) The definitions of the widget in various * resolutions. * @end_table * */ VALIDATE(!id.empty(), missing_mandatory_wml_key("gui", "id")); VALIDATE(!description.empty() , missing_mandatory_wml_key("gui", "description")); /* * Do this validation here instead of in load_resolutions so the * translatable string is not in the header and we don't need to pull in * extra header dependencies. */ config::const_child_itors itors = cfg.child_range("resolution"); VALIDATE(itors.first != itors.second, _("No resolution defined.")); }
void level_to_gamestate(const config& level, saved_game& state) { game_classification::CAMPAIGN_TYPE type = state.classification().campaign_type; bool show_connect = state.mp_settings().show_connect; state = saved_game(level); state.classification().campaign_type = type; state.mp_settings().show_connect = show_connect; // Any replay data is only temporary and should be removed from // the level data in case we want to save the game later. if (const config& replay_data = level.child("replay")) { LOG_NW << "setting replay\n"; recorder = replay(replay_data); if (!recorder.empty()) { recorder.set_skip(false); recorder.set_to_end(); } } //save id setting was moved to play_controller. }
tstacked_widget_definition::tresolution::tresolution(const config& cfg) : tresolution_definition_(cfg) , grid(NULL) { /*WIKI * @page = GUIWidgetDefinitionWML * @order = 1_stacked_widget * * == Multi page == * * The documentation is not written yet. */ // Add a dummy state since every widget needs a state. static config dummy ("draw"); state.push_back(tstate_definition(dummy)); const config &child = cfg.child("grid"); VALIDATE(child, _("No grid defined.")); grid = new tbuilder_grid(child); }
void init_textdomains(const config& cfg) { foreach (const config &t, cfg.child_range("textdomain")) { const std::string &name = t["name"]; const std::string &path = t["path"]; if(path.empty()) { t_string::add_textdomain(name, get_intl_dir()); } else { std::string location = get_binary_dir_location("", path); if (location.empty()) { //if location is empty, this causes a crash on Windows, so we //disallow adding empty domains ERR_G << "no location found for '" << path << "', skipping textdomain\n"; } else { t_string::add_textdomain(name, location); } } } }
// main thread bool wesnothd_connection::receive_data(config& result) { MPTEST_LOG; { std::lock_guard<std::mutex> lock(recv_queue_mutex_); if(!recv_queue_.empty()) { result.swap(recv_queue_.front()); recv_queue_.pop_front(); return true; } } { std::lock_guard<std::mutex> lock(last_error_mutex_); if(last_error_) { throw error(last_error_); } } return false; }
void output_test() { if(!validate_configuration(cfg) ) ERROR( "Invalid configuration" ); if(!read_input_file(initial_ens, cfg) ) { ERROR("you should have a tested input file"); } DEBUG_OUTPUT(2, "Make a copy of ensemble for energy conservation test" ); current_ens = initial_ens.clone(); prepare_integrator(); double integration_time = watch_time ( cfg.valid("interval") ? stability_test : generic_integrate ); if(read_output_file(reference_ens,cfg)){ // Compare with reneference ensemble for integrator verification double pos_diff = 0, vel_diff = 0, time_diff = 0; bool comparison = compare_ensembles( current_ens, reference_ens , pos_diff, vel_diff, time_diff ); INFO_OUTPUT(1,"\tPosition difference: " << pos_diff << endl << "\tVelocity difference: " << vel_diff << endl << "\tTime difference: " << time_diff << endl ); if( !comparison || pos_diff > pos_threshold || vel_diff > vel_threshold || time_diff > time_threshold ){ INFO_OUTPUT(0, "Test failed" << endl); exit(1); }else { INFO_OUTPUT(0, "Test success" << endl); } }else{ ERROR("You should provide a test output file"); } INFO_OUTPUT( 1, "Integration time: " << integration_time << " ms " << std::endl); }
void tgui_definition::load_definitions( const std::string &definition_type, const config &cfg, const char *key) { foreach (const config &d, cfg.child_range(key ? key : definition_type + "_definition")) { T* def = new T(d); // We assume all definitions are unique if not we would leak memory. assert(control_definition[definition_type].find(def->id) == control_definition[definition_type].end()); control_definition[definition_type].insert(std::make_pair(def->id, def)); } utils::string_map symbols; symbols["definition"] = definition_type; symbols["id"] = "default"; t_string msg(vgettext( "Widget definition '$definition' doesn't contain the definition for '$id'.", symbols)); VALIDATE(control_definition[definition_type].find("default") != control_definition[definition_type].end(), msg); }
void utype_anim_create_cfg(const std::string& anim_renamed_key, const std::string& tpl_id, config& dst, const utils::string_map& symbols) { typedef std::multimap<std::string, const config>::const_iterator Itor; std::pair<Itor, Itor> its = instance->utype_anim_tpls().equal_range(tpl_id); while (its.first != its.second) { // tpl animation instance // [anim] ----> [anim_renamed_key] config& sub_cfg = dst.add_child(anim_renamed_key); if (symbols.count("offset_x")) { sub_cfg["offset_x"] = symbols.find("offset_x")->second; } if (symbols.count("offset_y")) { sub_cfg["offset_y"] = symbols.find("offset_y")->second; } const config& anim_cfg = its.first->second; // replace BOOST_FOREACH (const config::attribute &i, anim_cfg.attribute_range()) { sub_cfg[i.first] = utils::interpolate_variables_into_string(i.second, &symbols); } utype_anim_replace_cfg_inernal(anim_cfg, sub_cfg, symbols); ++ its.first; } }
void unit2::generate_window(config& cfg) const { cfg["name"] = cell_.id; cfg["description"] = t_string(cell_.window.description, cell_.window.textdomain); if (cell_.window.orientation != gui2::twidget::auto_orientation) { cfg["orientation"] = gui2::orientations.find(cell_.window.orientation)->second.id; } config& res_cfg = cfg.add_child("resolution"); res_cfg["id"] = "1024x768"; res_cfg["width"] = "1024"; res_cfg["height"] = "768"; config& screen_cfg = res_cfg.add_child("screen"); screen_cfg["id"] = "screen"; screen_cfg["rect"] = "0,0,1024,768"; config& border_cfg = res_cfg.add_child("main_map_border"); generate_main_map_border(border_cfg); controller_.generate_linked_groups(res_cfg); controller_.generate_context_menus(res_cfg); }
brush::brush(const config& cfg) : relative_tiles_() , name_(cfg["name"]) , id_(cfg["id"]) { int radius = cfg["radius"]; if (radius > 0) { std::vector<map_location> in_radius; get_tiles_in_radius(map_location(0, 0), radius, in_radius); for (map_location& loc : in_radius) { add_relative_location(loc.x, loc.y); } } for (const config &relative : cfg.child_range("relative")) { int x = relative["x"]; int y = relative["y"]; add_relative_location(x, y); } if (relative_tiles_.empty()) { WRN_ED << "Empty brush definition, name=" << name_ << std::endl; } }
/** * Returns whether or not *this matches the given @a filter. */ bool attack_type::matches_filter(const config& filter) const { // Handle the basic filter. bool matches = matches_simple_filter(*this, filter); // Handle [and], [or], and [not] with in-order precedence BOOST_FOREACH( const config::any_child &condition, filter.all_children_range() ) { // Handle [and] if ( condition.key == "and" ) matches = matches && matches_filter(condition.cfg); // Handle [or] else if ( condition.key == "or" ) matches = matches || matches_filter(condition.cfg); // Handle [not] else if ( condition.key == "not" ) matches = matches && !matches_filter(condition.cfg); } return matches; }
unit_race::unit_race(const config& cfg) : cfg_(cfg), id_(cfg["id"]), plural_name_(cfg["plural_name"].t_str()), description_(cfg["description"].t_str()), ntraits_(cfg["num_traits"]), chain_size_(cfg["markov_chain_size"]), traits_(cfg.child_range("trait")), topics_(cfg.child_range("topic")), global_traits_(!cfg["ignore_global_traits"].to_bool()), undead_variation_(cfg["undead_variation"]) { if (id_.empty()) { lg::wml_error << "[race] '" << cfg["name"] << "' is missing an id field."; } if (plural_name_.empty()) { lg::wml_error << "[race] '" << cfg["name"] << "' is missing a plural_name field."; plural_name_ = (cfg["name"]); } // use "name" if "male_name" or "female_name" aren't available name_[MALE] = cfg["male_name"]; if(name_[MALE].empty()) { name_[MALE] = (cfg["name"]); } name_[FEMALE] = cfg["female_name"]; if(name_[FEMALE].empty()) { name_[FEMALE] = (cfg["name"]); } if(chain_size_ <= 0) chain_size_ = 2; //std::vector<std::string> names = ; next_[MALE] = markov_prefixes(utils::split(cfg["male_names"]), chain_size_); next_[FEMALE] = markov_prefixes(utils::split(cfg["female_names"]), chain_size_); }
tbuilder_menubar::tbuilder_menubar(const config& cfg) : tbuilder_control(cfg), must_have_one_item_selected_(utils::string_bool(cfg["must_have_one_item_selected"])), direction_(read_direction(cfg["direction"])), selected_item_(lexical_cast_default<int>( cfg["selected_item"], must_have_one_item_selected_ ? 0 : -1)), cells_() { /*WIKI * @page = GUIWidgetInstanceWML * @order = 2_menubar * * == Menubar == * * A menu bar used for menus and tab controls. * * List with the listbox specific variables: * @start_table = config * must_have_one_item_selected (bool = false) * Does the menu always have one item * selected. This makes sense for tabsheets * but not for menus. * direction (direction = "") The direction of the menubar. * selected_item(int = -1) The item to select upon creation, when * 'must_have_one_item_selected' is true the * default value is 0 instead of -1. -1 * means no item selected. * @end_table */ const config* data = cfg.child("data"); if(data) { foreach(const config* cell, data->get_children("cell")) { cells_.push_back(tbuilder_gridcell(*cell)); } } }
void benchmark_item(const string& param, const string& value) { //outputConfigSummary(std::cout,cfg); if(!validate_configuration(cfg) ) ERROR( "Invalid configuration" ); if(param == "input" || param == "nsys" || param == "nbod" || cfg.count("reinitialize")) load_generate_ensemble(); DEBUG_OUTPUT(2, "Make a copy of ensemble for energy conservation test" ); current_ens = initial_ens.clone(); double init_time = watch_time( prepare_integrator ); double integration_time = watch_time( generic_integrate ); double max_deltaE = find_max_energy_conservation_error(current_ens, initial_ens ); // Compare with reneference ensemble for integrator verification double pos_diff = 0, vel_diff = 0, time_diff = 0; bool comparison = compare_ensembles( current_ens, reference_ens , pos_diff, vel_diff, time_diff ); /// CSV output for use in spreadsheet software std::cout << param << ", " << value << ", " << current_ens.time_ranges() << ", " << max_deltaE << ", " << pos_diff << ", " << vel_diff << ", " << time_diff << ", " << integration_time << ", " << init_time << std::endl; if( !comparison || pos_diff > pos_threshold || vel_diff > vel_threshold || time_diff > time_threshold ){ fail_verify(); } }
void item_palette::setup(const config& cfg) { for(const config& group : cfg.child_range("item_group")) { groups_.emplace_back(group); for(const config& item : group.child_range("item")) { item_map_.emplace(item["id"], overlay(item)); group_map_[group["id"]].push_back(item["id"]); if(!group["core"].to_bool(false)) non_core_items_.insert(item["id"]); } nmax_items_ = std::max<int>(nmax_items_, group_map_[group["id"]].size()); } select_fg_item("anvil"); select_bg_item("altar"); // Set the default group set_group("items"); if(active_group().empty()) { ERR_ED << "No items found." << std::endl; } }
void init_textdomains(const config& cfg) { config::const_child_itors t = cfg.child_range("textdomain"); for(;t.first != t.second; ++t.first) { const std::string name = (**t.first)["name"]; const std::string path = (**t.first)["path"]; if(path.empty()) { // t_string::add_textdomain(name, get_intl_dir()); } else { std::string location = get_binary_dir_location("", path); if (location.empty()) { //if location is empty, this causes a crash on Windows, so we //disallow adding empty domains LOG_STREAM(err, general) << "no location found for '" << path << "', not adding textdomain\n"; } else { // t_string::add_textdomain(name, location); } } } }
gamemap::gamemap(const tdata_cache& tdata, const config& level): tiles_(1), tdata_(tdata), villages_(), borderCache_(), terrainFrequencyCache_(), w_(-1), h_(-1), total_width_(0), total_height_(0), border_size_(default_border) { DBG_G << "loading map: '" << level.debug() << "'\n"; const std::string& map_data = level["map_data"]; if (!map_data.empty()) { read(map_data); } else { w_ = 0; h_ = 0; total_width_ = 0; total_height_ = 0; } }
void addon_info::write(config& cfg) const { cfg["id"] = this->id; cfg["title"] = this->title; cfg["description"] = this->description; cfg["icon"] = this->icon; cfg["version"] = this->version.str(); cfg["author"] = this->author; cfg["size"] = this->size; cfg["downloads"] = this->downloads; cfg["uploads"] = this->uploads; cfg["type"] = get_addon_type_string(this->type); for (const std::string& locale_id : this->locales) { cfg.add_child("translation")["language"] = locale_id; } cfg["core"] = this->core; cfg["dependencies"] = utils::join(this->depends); cfg["feedback_url"] = this->feedback_url; cfg["timestamp"] = this->updated; cfg["original_timestamp"] = this->created; }