diff --git a/changelog.md b/changelog.md index 059300a4152ca..575ad3126aef0 100644 --- a/changelog.md +++ b/changelog.md @@ -21,6 +21,7 @@ * This tag is supported both in `[unit]` and in `[unit_type]`. If used in `[unit]`, it will override the type's notes. * Standard special notes should now be added with `{NOTE_*}` instead of `{SPECIAL_NOTES_*}`. * In `[effect]apply_to=profile`, `[add_special_note]` and `[remove_special_note]` are supported. + * Support for the deprecated "&image.png=text" syntax has been removed in all contexts - use the DescriptionWML attributes instead. ### Miscellaneous and bug fixes * Fixed :droid's arguments not all being optional (Issue#4308) * Chat is now enable in single-player and hotseat multiplayer. (Issue#1111) diff --git a/projectfiles/CodeBlocks-SCons/wesnoth.cbp b/projectfiles/CodeBlocks-SCons/wesnoth.cbp index 3d4a78a6b16c2..c5a16023cf64b 100644 --- a/projectfiles/CodeBlocks-SCons/wesnoth.cbp +++ b/projectfiles/CodeBlocks-SCons/wesnoth.cbp @@ -445,8 +445,6 @@ - - diff --git a/projectfiles/CodeBlocks/tests.cbp b/projectfiles/CodeBlocks/tests.cbp new file mode 100644 index 0000000000000..28945894a97d8 --- /dev/null +++ b/projectfiles/CodeBlocks/tests.cbp @@ -0,0 +1,1222 @@ + + + + + + diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 758162c63ab09..8561a0342fa89 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -494,8 +494,6 @@ - - diff --git a/projectfiles/VC14/wesnoth.vcxproj b/projectfiles/VC14/wesnoth.vcxproj index aeea0f1dae9d9..1fcabbbe1818c 100644 --- a/projectfiles/VC14/wesnoth.vcxproj +++ b/projectfiles/VC14/wesnoth.vcxproj @@ -1351,13 +1351,6 @@ $(IntDir)Gui\Auxiliary\Iterator\ $(IntDir)Gui\Auxiliary\Iterator\ - - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ $(IntDir)Gui\Auxiliary\ @@ -3724,7 +3717,6 @@ - diff --git a/projectfiles/VC14/wesnoth.vcxproj.filters b/projectfiles/VC14/wesnoth.vcxproj.filters index 0772d4a22f8df..c754e80446399 100644 --- a/projectfiles/VC14/wesnoth.vcxproj.filters +++ b/projectfiles/VC14/wesnoth.vcxproj.filters @@ -782,9 +782,6 @@ Gui\Dialogs\Multiplayer - - Gui\Auxiliary - Gui\Auxiliary @@ -2225,9 +2222,6 @@ Gui\Auxiliary - - Gui\Auxiliary - Gui\Auxiliary diff --git a/projectfiles/VC16/wesnoth.vcxproj b/projectfiles/VC16/wesnoth.vcxproj index a191736ce9893..63e75bf9ffe35 100644 --- a/projectfiles/VC16/wesnoth.vcxproj +++ b/projectfiles/VC16/wesnoth.vcxproj @@ -1358,13 +1358,6 @@ $(IntDir)Gui\Auxiliary\Iterator\ $(IntDir)Gui\Auxiliary\Iterator\ - - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ - $(IntDir)Gui\Auxiliary\ $(IntDir)Gui\Auxiliary\ @@ -3751,7 +3744,6 @@ - diff --git a/projectfiles/VC16/wesnoth.vcxproj.filters b/projectfiles/VC16/wesnoth.vcxproj.filters index 786fa25bd868b..31e4d2af1265a 100644 --- a/projectfiles/VC16/wesnoth.vcxproj.filters +++ b/projectfiles/VC16/wesnoth.vcxproj.filters @@ -785,9 +785,6 @@ Gui\Dialogs\Multiplayer - - Gui\Auxiliary - Gui\Auxiliary @@ -2231,9 +2228,6 @@ Gui\Auxiliary - - Gui\Auxiliary - Gui\Auxiliary diff --git a/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj b/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj index dd33c4e1df368..c03651d951600 100644 --- a/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj +++ b/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj @@ -344,8 +344,6 @@ 46F92E402174F6A400602C1C /* generate_map.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CF32174F6A300602C1C /* generate_map.cpp */; }; 46F92E412174F6A400602C1C /* chat_log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CF92174F6A300602C1C /* chat_log.cpp */; }; 46F92E422174F6A400602C1C /* chat_log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CF92174F6A300602C1C /* chat_log.cpp */; }; - 46F92E432174F6A400602C1C /* old_markup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFB2174F6A300602C1C /* old_markup.cpp */; }; - 46F92E442174F6A400602C1C /* old_markup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFB2174F6A300602C1C /* old_markup.cpp */; }; 46F92E452174F6A400602C1C /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFC2174F6A300602C1C /* tips.cpp */; }; 46F92E462174F6A400602C1C /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFC2174F6A300602C1C /* tips.cpp */; }; 46F92E472174F6A400602C1C /* walker_tree_node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92D012174F6A300602C1C /* walker_tree_node.cpp */; }; @@ -1760,10 +1758,8 @@ 46F92CF72174F6A300602C1C /* core_selection.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = core_selection.hpp; sourceTree = ""; }; 46F92CF82174F6A300602C1C /* help_browser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = help_browser.hpp; sourceTree = ""; }; 46F92CF92174F6A300602C1C /* chat_log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chat_log.cpp; sourceTree = ""; }; - 46F92CFB2174F6A300602C1C /* old_markup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = old_markup.cpp; sourceTree = ""; }; 46F92CFC2174F6A300602C1C /* tips.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tips.cpp; sourceTree = ""; }; 46F92CFD2174F6A300602C1C /* field.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = field.hpp; sourceTree = ""; }; - 46F92CFE2174F6A300602C1C /* old_markup.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = old_markup.hpp; sourceTree = ""; }; 46F92CFF2174F6A300602C1C /* typed_formula.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = typed_formula.hpp; sourceTree = ""; }; 46F92D012174F6A300602C1C /* walker_tree_node.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = walker_tree_node.cpp; sourceTree = ""; }; 46F92D022174F6A300602C1C /* walker_widget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = walker_widget.hpp; sourceTree = ""; }; @@ -3626,10 +3622,8 @@ 46F92CFA2174F6A300602C1C /* auxiliary */ = { isa = PBXGroup; children = ( - 46F92CFB2174F6A300602C1C /* old_markup.cpp */, 46F92CFC2174F6A300602C1C /* tips.cpp */, 46F92CFD2174F6A300602C1C /* field.hpp */, - 46F92CFE2174F6A300602C1C /* old_markup.hpp */, 46F92CFF2174F6A300602C1C /* typed_formula.hpp */, 46F92D002174F6A300602C1C /* iterator */, 46F92D0D2174F6A300602C1C /* find_widget.hpp */, @@ -5297,7 +5291,6 @@ B5599B230EC62181008DD061 /* mouse_handler_base.cpp in Sources */, 46F92E2B2174F6A400602C1C /* synced_choice_wait.cpp in Sources */, B52EE91A12135AC300CFBDAB /* move.cpp in Sources */, - 46F92E432174F6A400602C1C /* old_markup.cpp in Sources */, 620A387115E9364F00A4F513 /* move.cpp in Sources */, 46F92E132174F6A400602C1C /* player_list_helper.cpp in Sources */, F468E6AD16DF872200A31A5A /* movetype.cpp in Sources */, @@ -5794,7 +5787,6 @@ 91E356BD1CACC8A100774252 /* engine_cpp.cpp in Sources */, 46F92DB62174F6A300602C1C /* message.cpp in Sources */, 91E356BE1CACC8A100774252 /* recruitment.cpp in Sources */, - 46F92E442174F6A400602C1C /* old_markup.cpp in Sources */, 46F92E562174F6A400602C1C /* vertical_scrollbar.cpp in Sources */, 91E356BF1CACC8A100774252 /* ca_move_to_targets.cpp in Sources */, 91E356C01CACC8A100774252 /* stage_rca.cpp in Sources */, diff --git a/source_lists/wesnoth b/source_lists/wesnoth index e5c5dc671bf25..6b6cd1f81192f 100644 --- a/source_lists/wesnoth +++ b/source_lists/wesnoth @@ -145,7 +145,6 @@ gui/auxiliary/iterator/iterator.cpp gui/auxiliary/iterator/walker_grid.cpp gui/auxiliary/iterator/walker_tree_node.cpp gui/auxiliary/iterator/walker_widget.cpp -gui/auxiliary/old_markup.cpp gui/auxiliary/tips.cpp gui/core/canvas.cpp gui/core/event/dispatcher.cpp diff --git a/src/game_events/menu_item.cpp b/src/game_events/menu_item.cpp index d5197690dda60..2aa71edfef8b4 100644 --- a/src/game_events/menu_item.cpp +++ b/src/game_events/menu_item.cpp @@ -31,7 +31,6 @@ #include "synced_context.hpp" #include "terrain/filter.hpp" #include "deprecation.hpp" -#include "gui/auxiliary/old_markup.hpp" static lg::log_domain log_engine("engine"); #define ERR_NG LOG_STREAM(err, log_engine) @@ -85,13 +84,6 @@ wml_menu_item::wml_menu_item(const std::string& id, const config& cfg) if(cfg.has_attribute("needs_select")) { deprecated_message("needs_select", DEP_LEVEL::INDEFINITE, {1, 15, 0}); } - gui2::legacy_menu_item parsed(cfg["description"].str(), "Multiple columns in [set_menu_item] are no longer supported; the image is specified by image=."); - if(parsed.contained_markup()) { - description_ = parsed.label(); - if(!parsed.description().empty()) { - description_ += " " + parsed.description(); - } - } } // Constructor for items defined in an event. @@ -277,15 +269,7 @@ void wml_menu_item::update(const vconfig& vcfg) } if(vcfg.has_attribute("description")) { - gui2::legacy_menu_item parsed(vcfg["description"].str(), "Multiple columns in [set_menu_item] are no longer supported; the image is specified by image=."); - if(parsed.contained_markup()) { - description_ = parsed.label(); - if(!parsed.description().empty()) { - description_ += " " + parsed.description(); - } - } else { - description_ = vcfg["description"].t_str(); - } + description_ = vcfg["description"].t_str(); hotkey_updated = true; } diff --git a/src/gui/auxiliary/old_markup.cpp b/src/gui/auxiliary/old_markup.cpp deleted file mode 100644 index de4eb2cdbead7..0000000000000 --- a/src/gui/auxiliary/old_markup.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2008 - 2018 by Mark de Wever - Part of the Battle for Wesnoth Project https://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. -*/ - -#include "gui/auxiliary/old_markup.hpp" -#include "deprecation.hpp" -#include "game_version.hpp" - -namespace gui2 -{ - -legacy_menu_item::legacy_menu_item(const std::string& str, const std::string deprecation_msg) - : icon_(), label_(str), desc_(), default_(false), contained_markup_(false) -{ - if(label_.empty()) { - return; - } - - // Handle selection. - if(label_[0] == '*') { - default_ = true; - label_.erase(0, 1); - contained_markup_ = true; - } - - // Handle the special case with an image. - // 99.9% of uses put the image in the first column, so we ignore the slim possibility of it going in a different column - std::string::size_type pos = label_.find('='); - if(pos != std::string::npos && (label_[0] == '&' || pos == 0)) { - if(pos) - icon_ = label_.substr(1, pos - 1); - label_.erase(0, pos + 1); - contained_markup_ = true; - } - - // Search for an '=' symbol that is not inside markup. - std::string::size_type prev = 0; - bool open = false; - while((pos = label_.find('=', prev)) != std::string::npos) { - for(std::string::size_type i = prev; i != pos; ++i) { - switch(label_[i]) { - case '<': - open = true; - break; - case '>': - open = false; - break; - } - } - if(!open) - break; - prev = pos + 1; - } - if(pos != std::string::npos) { - desc_ = label_.substr(pos + 1); - label_.erase(pos); - contained_markup_ = true; - } - - if(contained_markup_) { - deprecated_message("Legacy DescriptionWML markup (&img=col1=col2)", DEP_LEVEL::FOR_REMOVAL, {1, 15, 0}, deprecation_msg); - } -} -} diff --git a/src/gui/auxiliary/old_markup.hpp b/src/gui/auxiliary/old_markup.hpp deleted file mode 100644 index 545b360f032a2..0000000000000 --- a/src/gui/auxiliary/old_markup.hpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2008 - 2018 by Mark de Wever - Part of the Battle for Wesnoth Project https://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 - -namespace gui2 -{ - -/** - * Implements simple parsing of legacy GUI1 item markup. - */ -class legacy_menu_item -{ - /* - * Legacy options/menu items have some special markup: - * A line starting with a * is selected by default. - * A line starting with a & enables the following markup: - * - The part until the = is the name of an image. - * - The part until the second = is the first column. - * - The rest is the third column (the wiki only specifies two columns - * so only two of them are implemented). - */ - /** - * @todo This syntax looks like a bad hack, it would be nice to write - * a new syntax which doesn't use those hacks (also avoids the problem - * with special meanings for certain characters. - */ -public: - explicit legacy_menu_item(const std::string& str = "", const std::string deprecation_msg = ""); - - const std::string& icon() const - { - return icon_; - } - - const std::string& label() const - { - return label_; - } - - const std::string& description() const - { - return desc_; - } - - bool is_default() const - { - return default_; - } - - bool contained_markup() const - { - return contained_markup_; - } - - legacy_menu_item& operator=(const legacy_menu_item& rhs) - { - if(&rhs != this) { - icon_ = rhs.icon_; - label_ = rhs.label_; - desc_ = rhs.desc_; - default_ = rhs.default_; - contained_markup_ = rhs.contained_markup_; - } - return *this; - } - -private: - /** The icon for the menu item. */ - std::string icon_; - - /** The first text item of the menu item, normally a short string. */ - std::string label_; - - /** The second text item of the menu item, normally a longer string. */ - std::string desc_; - - /** - * Is the item the default item and thus initially selected. - * - * It's unspecified what happens if multiple items in a menu are selected. - */ - bool default_; - - /** - * Was any old markup actually parsed? - */ - bool contained_markup_; -}; -} diff --git a/src/gui/dialogs/campaign_difficulty.cpp b/src/gui/dialogs/campaign_difficulty.cpp index 0454c190d72cc..02e32f22740fc 100644 --- a/src/gui/dialogs/campaign_difficulty.cpp +++ b/src/gui/dialogs/campaign_difficulty.cpp @@ -20,7 +20,6 @@ #include "font/text_formatting.hpp" #include "formatter.hpp" #include "gui/auxiliary/find_widget.hpp" -#include "gui/auxiliary/old_markup.hpp" #include "preferences/game.hpp" #include "gui/widgets/listbox.hpp" #include "gui/widgets/window.hpp" @@ -77,35 +76,6 @@ config generate_difficulty_config(const config& source) // Populate local config with difficulty children result.append_children(source, "difficulty"); - // Convert legacy format to new-style config if latter not present - if(result.empty() && source.has_attribute("difficulties")) { - deprecated_message("[campaign]difficulties", DEP_LEVEL::FOR_REMOVAL, {1, 15, 0}, "Use [difficulty] instead."); - if(source.has_attribute("difficulty_descriptions")) { - deprecated_message("[campaign]difficulty_descriptions", DEP_LEVEL::FOR_REMOVAL, {1, 15, 0}, "Use [difficulty] instead."); - } - - std::vector difficulty_list = utils::split(source["difficulties"]); - std::vector difficulty_opts = utils::split(source["difficulty_descriptions"], ';'); - - if(difficulty_opts.size() != difficulty_list.size()) { - difficulty_opts = difficulty_list; - } - - for(std::size_t i = 0; i < difficulty_opts.size(); ++i) { - config temp; - gui2::legacy_menu_item parsed(difficulty_opts[i], "Use [difficulty] instead."); - - temp["define"] = difficulty_list[i]; - temp["image"] = parsed.icon(); - temp["label"] = parsed.label(); - temp["description"] = parsed.description(); - temp["default"] = parsed.is_default(); - temp["old_markup"] = true; // To prevent double parentheses in the dialog - - result.add_child("difficulty", std::move(temp)); - } - } - return result; } diff --git a/src/gui/dialogs/multiplayer/faction_select.cpp b/src/gui/dialogs/multiplayer/faction_select.cpp index b2f093bc871a1..3860f79671d95 100644 --- a/src/gui/dialogs/multiplayer/faction_select.cpp +++ b/src/gui/dialogs/multiplayer/faction_select.cpp @@ -17,7 +17,6 @@ #include "game_config_manager.hpp" #include "gui/auxiliary/find_widget.hpp" -#include "gui/auxiliary/old_markup.hpp" #include "gui/core/log.hpp" #include "gui/widgets/listbox.hpp" #include "gui/widgets/settings.hpp" @@ -102,27 +101,11 @@ void faction_select::pre_show(window& window) // flag_rgb here is unrelated to any handling in the unit class const std::string flag_rgb = !side["flag_rgb"].empty() ? side["flag_rgb"].str() : "magenta"; - // Handle legacy DescriptionWML format. - if(name.find_first_of("=") != std::string::npos) { - gui2::legacy_menu_item parsed(name, "Use separate name= and image= keys. Multiple text columns are no longer supported."); + item["label"] = (formatter() << side["image"] << "~RC(" << flag_rgb << ">" << tc_color_ << ")").str(); + data.emplace("faction_image", item); - if(!side.has_attribute("image")) { - item["label"] = (formatter() << parsed.icon() << "~RC(" << flag_rgb << ">" << tc_color_ << ")").str(); - data.emplace("faction_image", item); - } - - item["label"] = parsed.label(); - if(!parsed.description().empty()) { - item["label"] += " " + parsed.description(); - } - data.emplace("faction_name", item); - } else { - item["label"] = (formatter() << side["image"] << "~RC(" << flag_rgb << ">" << tc_color_ << ")").str(); - data.emplace("faction_image", item); - - item["label"] = name; - data.emplace("faction_name", item); - } + item["label"] = name; + data.emplace("faction_name", item); list.add_row(data); } diff --git a/src/scripting/lua_gui2.cpp b/src/scripting/lua_gui2.cpp index 2b3b52391b381..425d1687e0086 100644 --- a/src/scripting/lua_gui2.cpp +++ b/src/scripting/lua_gui2.cpp @@ -14,7 +14,6 @@ #include "scripting/lua_gui2.hpp" -#include "gui/auxiliary/old_markup.hpp" #include "gui/core/canvas.hpp" #include "gui/core/gui_definition.hpp" #include "gui/core/window_builder.hpp" @@ -282,16 +281,7 @@ int show_message_dialog(lua_State* L) t_string short_opt; config opt; if(luaW_totstring(L, -1, short_opt)) { - // Note: Although this currently uses the legacy_menu_item class - // for the deprecated syntax, this branch should still be retained - // when the deprecated syntax is removed, as a simpler method - // of specifying options when only a single string is needed. - const std::string& opt_str = short_opt; - gui2::legacy_menu_item item(opt_str, "Use image=, label=, description=, default= instead."); - opt["image"] = item.icon(); - opt["label"] = item.label(); - opt["description"] = item.description(); - opt["default"] = item.is_default(); + opt["description"] = short_opt; } else if(!luaW_toconfig(L, -1, opt)) { std::ostringstream error; error << "expected array of config and/or translatable strings, but index ";