Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation of [advancefrom], mark as already removed #6482

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 12 additions & 16 deletions src/game_config_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cursor.hpp"
#include "events.hpp"
#include "formatter.hpp"
#include "formula/string_utils.hpp"
#include "game_classification.hpp"
#include "game_config.hpp"
#include "game_version.hpp"
Expand Down Expand Up @@ -512,23 +513,20 @@ void game_config_manager::load_addons_cfg()
}
}

config advancefroms;
for(auto& units : umc_cfg.child_range("units")) {
for(auto& unit_type : units.child_range("unit_type")) {
for(const auto& advancefrom : units.child_range("advancefrom")) {
config modify_unit_type {
"type", unit_type["id"],
"add_advancement", advancefrom["unit"],
"set_experience", advancefrom["experience"]
for(const auto& advancefrom : unit_type.child_range("advancefrom")) {
auto symbols = utils::string_map {
{"lower_level", advancefrom["unit"]},
{"higher_level", unit_type["id"]}
};
deprecated_message(
"[advancefrom]",
DEP_LEVEL::FOR_REMOVAL,
{1, 17, 0},
_("Use [modify_unit_type]\n") + modify_unit_type.debug() + "\n [/modify_unit_type] instead in [campaign]"
);

advancefroms.add_child("modify_unit_type", modify_unit_type);
auto message = VGETTEXT(
// TRANSLATORS: For example, 'Cuttle Fish' units will not be able to advance to 'Kraken'.
// The substituted strings are unit ids, not translated names; hopefully any add-ons
// that trigger this will be quickly fixed and stop triggering the warning.
"Error: [advancefrom] no longer works. ‘$lower_level’ units will not be able to advance to ‘$higher_level’; please ask the add-on author to use [modify_unit_type] instead.",
symbols);
deprecated_message("[advancefrom]", DEP_LEVEL::REMOVED, {1, 15, 4}, message);
}
unit_type.remove_children("advancefrom", [](const config&){return true;});
}
Expand All @@ -550,8 +548,6 @@ void game_config_manager::load_addons_cfg()
};

for(auto& campaign : umc_cfg.child_range("campaign")) {
campaign.append_children(std::move(advancefroms));

for(auto str : utils::split(campaign["extra_defines"])) {
if(deprecated_defines.count(str) > 0) {
//TODO: we could try to implement a compatibility path by
Expand Down