remove redirection feature

This commit is contained in:
Martin Michelsen
2023-10-30 15:18:08 -07:00
parent add46095c3
commit 14e6111448
6 changed files with 6 additions and 150 deletions
-60
View File
@@ -355,21 +355,6 @@ shared_ptr<const Menu> ServerState::proxy_destinations_menu_for_version(GameVers
}
}
shared_ptr<const Menu> ServerState::redirect_destinations_menu_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
return this->redirect_destinations_menu_dc;
case GameVersion::PC:
return this->redirect_destinations_menu_pc;
case GameVersion::GC:
return this->redirect_destinations_menu_gc;
case GameVersion::XB:
return this->redirect_destinations_menu_xb;
default:
throw out_of_range("no redirect destinations menu exists for this version");
}
}
const vector<pair<string, uint16_t>>& ServerState::proxy_destinations_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
@@ -385,21 +370,6 @@ const vector<pair<string, uint16_t>>& ServerState::proxy_destinations_for_versio
}
}
const vector<pair<string, uint16_t>>& ServerState::redirect_destinations_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
return this->redirect_destinations_dc;
case GameVersion::PC:
return this->redirect_destinations_pc;
case GameVersion::GC:
return this->redirect_destinations_gc;
case GameVersion::XB:
return this->redirect_destinations_xb;
default:
throw out_of_range("no redirect destinations menu exists for this version");
}
}
std::shared_ptr<const ItemParameterTable> ServerState::item_parameter_table_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
@@ -811,36 +781,6 @@ void ServerState::parse_config(const JSON& json, bool is_reload) {
this->information_contents_v2 = information_contents_v2;
this->information_contents_v3 = information_contents_v3;
auto generate_redirect_destinations_menu = [&](vector<pair<string, uint16_t>>& ret_pds, const char* key) -> shared_ptr<const Menu> {
shared_ptr<Menu> ret(new Menu(MenuID::REDIRECT_DESTINATIONS, "Other servers"));
ret_pds.clear();
try {
map<string, const JSON&> sorted_jsons;
for (const auto& it : json.at(key).as_dict()) {
sorted_jsons.emplace(it.first, *it.second);
}
ret->items.emplace_back(RedirectDestinationsMenuItemID::GO_BACK, "Go back", "Return to the\nmain menu", 0);
uint32_t item_id = 0;
for (const auto& item : sorted_jsons) {
const string& netloc_str = item.second.as_string();
const string& description = "$C7Remote server:\n$C6" + netloc_str;
ret->items.emplace_back(item_id, item.first, description, 0);
ret_pds.emplace_back(parse_netloc(netloc_str));
item_id++;
}
} catch (const out_of_range&) {
}
return ret;
};
this->redirect_destinations_menu_dc = generate_redirect_destinations_menu(this->redirect_destinations_dc, "RedirectDestinations-DC");
this->redirect_destinations_menu_pc = generate_redirect_destinations_menu(this->redirect_destinations_pc, "RedirectDestinations-PC");
this->redirect_destinations_menu_gc = generate_redirect_destinations_menu(this->redirect_destinations_gc, "RedirectDestinations-GC");
this->redirect_destinations_menu_xb = generate_redirect_destinations_menu(this->redirect_destinations_xb, "RedirectDestinations-XB");
auto generate_proxy_destinations_menu = [&](vector<pair<string, uint16_t>>& ret_pds, const char* key) -> shared_ptr<const Menu> {
shared_ptr<Menu> ret(new Menu(MenuID::PROXY_DESTINATIONS, "Proxy server"));
ret_pds.clear();