summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-04-20 16:51:15 +0200
committerPatric Stout <github@truebrain.nl>2021-04-20 17:24:38 +0200
commit05612d60ae0af94b9313d5a8b78ebf58a3eeab66 (patch)
tree6f84698665d5931520d41ef23117e4013c575e10 /src
parentf4bd3fff5ebfdd7c58ccaf23977b8447c740b48a (diff)
downloadopenttd-05612d60ae0af94b9313d5a8b78ebf58a3eeab66.tar.xz
Remove: "language" field from server/client
The original idea was that people could find a server they could talk in their native language on. This isn't really used in that way. There are several reasons for removing this: - the client also sends his "language" to the server, but nothing is doing anything with this. - flags are a bad way to represent languages, and over the years we had several (rightfully) complaints about this. - most servers have their language set to "All", and prefix the servername with the language it is about. This is a much more efficient way to do the same. All in all, this feature should go back to the drawing board. Maybe it could work in another form, but this form is not it.
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt40
-rw-r--r--src/network/core/config.h2
-rw-r--r--src/network/core/game.h1
-rw-r--r--src/network/core/udp.cpp7
-rw-r--r--src/network/network_admin.cpp2
-rw-r--r--src/network/network_base.h1
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_gui.cpp44
-rw-r--r--src/network/network_internal.h41
-rw-r--r--src/network/network_server.cpp3
-rw-r--r--src/network/network_udp.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/strings.cpp3
-rw-r--r--src/table/gameopt_settings.ini1
-rw-r--r--src/table/settings.ini10
-rw-r--r--src/widgets/network_widget.h3
16 files changed, 5 insertions, 157 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 9bccd86df..125273ed9 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2070,46 +2070,6 @@ STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP :{BLACK}Other pl
STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE :{BLACK}Enter a name for the network game
-# Network game languages
-############ Leave those lines in this order!!
-STR_NETWORK_LANG_ANY :Any
-STR_NETWORK_LANG_ENGLISH :English
-STR_NETWORK_LANG_GERMAN :German
-STR_NETWORK_LANG_FRENCH :French
-STR_NETWORK_LANG_BRAZILIAN :Brazilian
-STR_NETWORK_LANG_BULGARIAN :Bulgarian
-STR_NETWORK_LANG_CHINESE :Chinese
-STR_NETWORK_LANG_CZECH :Czech
-STR_NETWORK_LANG_DANISH :Danish
-STR_NETWORK_LANG_DUTCH :Dutch
-STR_NETWORK_LANG_ESPERANTO :Esperanto
-STR_NETWORK_LANG_FINNISH :Finnish
-STR_NETWORK_LANG_HUNGARIAN :Hungarian
-STR_NETWORK_LANG_ICELANDIC :Icelandic
-STR_NETWORK_LANG_ITALIAN :Italian
-STR_NETWORK_LANG_JAPANESE :Japanese
-STR_NETWORK_LANG_KOREAN :Korean
-STR_NETWORK_LANG_LITHUANIAN :Lithuanian
-STR_NETWORK_LANG_NORWEGIAN :Norwegian
-STR_NETWORK_LANG_POLISH :Polish
-STR_NETWORK_LANG_PORTUGUESE :Portuguese
-STR_NETWORK_LANG_ROMANIAN :Romanian
-STR_NETWORK_LANG_RUSSIAN :Russian
-STR_NETWORK_LANG_SLOVAK :Slovak
-STR_NETWORK_LANG_SLOVENIAN :Slovenian
-STR_NETWORK_LANG_SPANISH :Spanish
-STR_NETWORK_LANG_SWEDISH :Swedish
-STR_NETWORK_LANG_TURKISH :Turkish
-STR_NETWORK_LANG_UKRAINIAN :Ukrainian
-STR_NETWORK_LANG_AFRIKAANS :Afrikaans
-STR_NETWORK_LANG_CROATIAN :Croatian
-STR_NETWORK_LANG_CATALAN :Catalan
-STR_NETWORK_LANG_ESTONIAN :Estonian
-STR_NETWORK_LANG_GALICIAN :Galician
-STR_NETWORK_LANG_GREEK :Greek
-STR_NETWORK_LANG_LATVIAN :Latvian
-############ End of leave-in-this-order
-
# Network game lobby
STR_NETWORK_GAME_LOBBY_CAPTION :{WHITE}Multiplayer game lobby
diff --git a/src/network/core/config.h b/src/network/core/config.h
index 3488b1ff2..1483419ea 100644
--- a/src/network/core/config.h
+++ b/src/network/core/config.h
@@ -57,8 +57,6 @@ static const uint NETWORK_GRF_NAME_LENGTH = 80; ///< Maximum l
*/
static const uint NETWORK_MAX_GRF_COUNT = 62;
-static const uint NETWORK_NUM_LANGUAGES = 36; ///< Number of known languages (to the network protocol) + 1 for 'any'.
-
/**
* The number of landscapes in OpenTTD.
* This number must be equal to NUM_LANDSCAPE, but as this number is used
diff --git a/src/network/core/game.h b/src/network/core/game.h
index 0a10cfb1f..29eca418f 100644
--- a/src/network/core/game.h
+++ b/src/network/core/game.h
@@ -42,7 +42,6 @@ struct NetworkGameInfo : NetworkServerGameInfo {
bool compatible; ///< Can we connect to this server or not? (based on server_revision _and_ grf_match
bool use_password; ///< Is this server passworded?
byte game_info_version; ///< Version of the game info
- byte server_lang; ///< Language of the server (we should make a nice table for this)
byte clients_max; ///< Max clients allowed on server
byte companies_on; ///< How many started companies do we have
byte companies_max; ///< Max companies allowed on server
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 985c8fa72..72fec49e1 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -200,7 +200,7 @@ void NetworkUDPSocketHandler::SendNetworkGameInfo(Packet *p, const NetworkGameIn
/* NETWORK_GAME_INFO_VERSION = 1 */
p->Send_string(info->server_name);
p->Send_string(info->server_revision);
- p->Send_uint8 (info->server_lang);
+ p->Send_uint8 (0); // Used to be server-lang.
p->Send_bool (info->use_password);
p->Send_uint8 (info->clients_max);
p->Send_uint8 (info->clients_on);
@@ -266,7 +266,7 @@ void NetworkUDPSocketHandler::ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo
case 1:
p->Recv_string(info->server_name, sizeof(info->server_name));
p->Recv_string(info->server_revision, sizeof(info->server_revision));
- info->server_lang = p->Recv_uint8 ();
+ p->Recv_uint8 (); // Used to contain server-lang.
info->use_password = p->Recv_bool ();
info->clients_max = p->Recv_uint8 ();
info->clients_on = p->Recv_uint8 ();
@@ -281,8 +281,7 @@ void NetworkUDPSocketHandler::ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo
info->map_set = p->Recv_uint8 ();
info->dedicated = p->Recv_bool ();
- if (info->server_lang >= NETWORK_NUM_LANGUAGES) info->server_lang = 0;
- if (info->map_set >= NETWORK_NUM_LANDSCAPES) info->map_set = 0;
+ if (info->map_set >= NETWORK_NUM_LANDSCAPES) info->map_set = 0;
}
}
diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp
index 825acfed1..fa97b7e57 100644
--- a/src/network/network_admin.cpp
+++ b/src/network/network_admin.cpp
@@ -238,7 +238,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkC
p->Send_uint32(ci->client_id);
p->Send_string(cs == nullptr ? "" : const_cast<NetworkAddress &>(cs->client_address).GetHostname());
p->Send_string(ci->client_name);
- p->Send_uint8 (ci->client_lang);
+ p->Send_uint8 (0); // Used to be language
p->Send_uint32(ci->join_date);
p->Send_uint8 (ci->client_playas);
diff --git a/src/network/network_base.h b/src/network/network_base.h
index cbb7e88f2..15f410dbc 100644
--- a/src/network/network_base.h
+++ b/src/network/network_base.h
@@ -23,7 +23,6 @@ extern NetworkClientInfoPool _networkclientinfo_pool;
struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_pool> {
ClientID client_id; ///< Client identifier (same as ClientState->client_id)
char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< Name of the client
- byte client_lang; ///< The language of the client
CompanyID client_playas; ///< As which company is this client playing (CompanyID)
Date join_date; ///< Gamedate the client has joined
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index cd1904269..5858859cb 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -362,7 +362,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin()
p->Send_uint32(_openttd_newgrf_version);
p->Send_string(_settings_client.network.client_name); // Client name
p->Send_uint8 (_network_join_as); // PlayAs
- p->Send_uint8 (NETLANG_ANY); // Language
+ p->Send_uint8 (0); // Used to be language
my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY;
}
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 591a45ae9..78b0d9dfc 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -56,20 +56,6 @@ static const StringID _connection_types_dropdown[] = {
INVALID_STRING_ID
};
-static std::vector<StringID> _language_dropdown;
-
-void SortNetworkLanguages()
-{
- /* Init the strings */
- if (_language_dropdown.empty()) {
- for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown.emplace_back(STR_NETWORK_LANG_ANY + i);
- _language_dropdown.emplace_back(INVALID_STRING_ID);
- }
-
- /* Sort the strings (we don't move 'any' and the 'invalid' one) */
- std::sort(_language_dropdown.begin() + 1, _language_dropdown.end() - 1, StringIDSorter);
-}
-
/**
* Update the network new window because a new server is
* found on the network.
@@ -430,9 +416,6 @@ protected:
/* draw red or green icon, depending on compatibility with server */
DrawSprite(SPR_BLOT, (cur_item->info.compatible ? PALETTE_TO_GREEN : (cur_item->info.version_compatible ? PALETTE_TO_YELLOW : PALETTE_TO_RED)), nwi_info->pos_x + this->blot_offset, y + icon_y_offset + 1);
-
- /* draw flag according to server language */
- DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, nwi_info->pos_x + this->flag_offset, y + (this->resize.step_height - GetSpriteSize(SPR_FLAGS_BASE + cur_item->info.server_lang).height) / 2);
}
}
@@ -638,10 +621,6 @@ public:
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_CLIENTS);
y += FONT_HEIGHT_NORMAL;
- SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_LANGUAGE); // server language
- y += FONT_HEIGHT_NORMAL;
-
SetDParam(0, STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE + sel->info.map_set);
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_LANDSCAPE); // landscape
y += FONT_HEIGHT_NORMAL;
@@ -1054,10 +1033,6 @@ struct NetworkStartServerWindow : public Window {
case WID_NSS_SPECTATORS_TXT:
SetDParam(0, _settings_client.network.max_spectators);
break;
-
- case WID_NSS_LANGUAGE_BTN:
- SetDParam(0, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang);
- break;
}
}
@@ -1139,18 +1114,6 @@ struct NetworkStartServerWindow : public Window {
ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, 4, this, CS_NUMERAL, QSF_NONE);
break;
- case WID_NSS_LANGUAGE_BTN: { // Language
- uint sel = 0;
- for (uint i = 0; i < _language_dropdown.size() - 1; i++) {
- if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) {
- sel = i;
- break;
- }
- }
- ShowDropDownMenu(this, _language_dropdown.data(), sel, WID_NSS_LANGUAGE_BTN, 0, 0);
- break;
- }
-
case WID_NSS_GENERATE_GAME: // Start game
_is_network_server = true;
if (_ctrl_pressed) {
@@ -1183,9 +1146,6 @@ struct NetworkStartServerWindow : public Window {
case WID_NSS_CONNTYPE_BTN:
_settings_client.network.server_advertise = (index != 0);
break;
- case WID_NSS_LANGUAGE_BTN:
- _settings_client.network.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY;
- break;
default:
NOT_REACHED();
}
@@ -1253,10 +1213,6 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_CONNTYPE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_ADVERTISED_TOOLTIP),
EndContainer(),
NWidget(NWID_VERTICAL), SetPIP(0, 1, 0),
- NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN, STR_NULL),
- NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP),
- EndContainer(),
- NWidget(NWID_VERTICAL), SetPIP(0, 1, 0),
NWidget(NWID_SPACER), SetFill(1, 1),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_SETPWD), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP),
EndContainer(),
diff --git a/src/network/network_internal.h b/src/network/network_internal.h
index 290922f38..352416320 100644
--- a/src/network/network_internal.h
+++ b/src/network/network_internal.h
@@ -62,47 +62,6 @@ enum NetworkJoinStatus {
NETWORK_JOIN_STATUS_END,
};
-/** Language ids for server_lang and client_lang. Do NOT modify the order. */
-enum NetworkLanguage {
- NETLANG_ANY = 0,
- NETLANG_ENGLISH,
- NETLANG_GERMAN,
- NETLANG_FRENCH,
- NETLANG_BRAZILIAN,
- NETLANG_BULGARIAN,
- NETLANG_CHINESE,
- NETLANG_CZECH,
- NETLANG_DANISH,
- NETLANG_DUTCH,
- NETLANG_ESPERANTO,
- NETLANG_FINNISH,
- NETLANG_HUNGARIAN,
- NETLANG_ICELANDIC,
- NETLANG_ITALIAN,
- NETLANG_JAPANESE,
- NETLANG_KOREAN,
- NETLANG_LITHUANIAN,
- NETLANG_NORWEGIAN,
- NETLANG_POLISH,
- NETLANG_PORTUGUESE,
- NETLANG_ROMANIAN,
- NETLANG_RUSSIAN,
- NETLANG_SLOVAK,
- NETLANG_SLOVENIAN,
- NETLANG_SPANISH,
- NETLANG_SWEDISH,
- NETLANG_TURKISH,
- NETLANG_UKRAINIAN,
- NETLANG_AFRIKAANS,
- NETLANG_CROATIAN,
- NETLANG_CATALAN,
- NETLANG_ESTONIAN,
- NETLANG_GALICIAN,
- NETLANG_GREEK,
- NETLANG_LATVIAN,
- NETLANG_COUNT
-};
-
extern uint32 _frame_counter_server; // The frame_counter of the server, if in network-mode
extern uint32 _frame_counter_max; // To where we may go with our clients
extern uint32 _frame_counter;
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 86885d598..552171027 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -910,7 +910,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
char name[NETWORK_CLIENT_NAME_LENGTH];
CompanyID playas;
- NetworkLanguage client_lang;
char client_revision[NETWORK_REVISION_LENGTH];
p->Recv_string(client_revision, sizeof(client_revision));
@@ -924,7 +923,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
p->Recv_string(name, sizeof(name));
playas = (Owner)p->Recv_uint8();
- client_lang = (NetworkLanguage)p->Recv_uint8();
if (this->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;
@@ -961,7 +959,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
ci->join_date = _date;
strecpy(ci->client_name, name, lastof(ci->client_name));
ci->client_playas = playas;
- ci->client_lang = client_lang;
DEBUG(desync, 1, "client: %08x; %02x; %02x; %02x", _date, _date_fract, (int)ci->client_playas, (int)ci->index);
/* Make sure companies to which people try to join are not autocleaned */
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 5b150c45a..46a21fc87 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -176,7 +176,6 @@ void ServerNetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *p, Networ
ngi.clients_on = _network_game_info.clients_on;
ngi.start_date = ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
- ngi.server_lang = _settings_client.network.server_lang;
ngi.use_password = !StrEmpty(_settings_client.network.server_password);
ngi.clients_max = _settings_client.network.max_clients;
ngi.companies_on = (byte)Company::GetNumItems();
diff --git a/src/settings_type.h b/src/settings_type.h
index 42bdc27d4..bb078205b 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -280,7 +280,6 @@ struct NetworkSettings {
uint8 max_spectators; ///< maximum amount of spectators
Year restart_game_year; ///< year the server restarts
uint8 min_active_clients; ///< minimum amount of active clients to unpause the game
- uint8 server_lang; ///< language of the server
bool reload_cfg; ///< reload the config file before restarting
char last_host[NETWORK_HOSTNAME_LENGTH]; ///< IP address of the last joined server
uint16 last_port; ///< port of the last joined server
diff --git a/src/strings.cpp b/src/strings.cpp
index 33724158c..aeea7c071 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1695,8 +1695,6 @@ static char *GetSpecialNameString(char *buff, int ind, StringParameters *args, c
NOT_REACHED();
}
-extern void SortNetworkLanguages();
-
/**
* Check whether the header is a valid header for OpenTTD.
* @return true iff the header is deemed valid.
@@ -1813,7 +1811,6 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
InitializeSortedCargoSpecs();
SortIndustryTypes();
BuildIndustriesLegend();
- SortNetworkLanguages();
BuildContentTypeStringList();
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // Build vehicle window.
InvalidateWindowClassesData(WC_TRAINS_LIST); // Train group window.
diff --git a/src/table/gameopt_settings.ini b/src/table/gameopt_settings.ini
index c4140f428..b0b1798ab 100644
--- a/src/table/gameopt_settings.ini
+++ b/src/table/gameopt_settings.ini
@@ -19,7 +19,6 @@ static const char *_climates = "temperate|arctic|tropic|toyland";
static const char *_autosave_interval = "off|monthly|quarterly|half year|yearly";
static const char *_roadsides = "left|right";
static const char *_savegame_date = "long|short|iso";
-static const char *_server_langs = "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN";
static const char *_osk_activation = "disabled|double|single|immediately";
static const char *_settings_profiles = "easy|medium|hard";
static const char *_news_display = "off|summarized|full";
diff --git a/src/table/settings.ini b/src/table/settings.ini
index efbb3e0c7..391a5b427 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -4061,16 +4061,6 @@ def = 0
min = 0
max = MAX_CLIENTS
-[SDTC_OMANY]
-var = network.server_lang
-type = SLE_UINT8
-flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
-guiflags = SGF_NETWORK_ONLY
-def = 0
-max = 35
-full = _server_langs
-cat = SC_BASIC
-
[SDTC_BOOL]
var = network.reload_cfg
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
diff --git a/src/widgets/network_widget.h b/src/widgets/network_widget.h
index 8372b6360..79d33fb06 100644
--- a/src/widgets/network_widget.h
+++ b/src/widgets/network_widget.h
@@ -71,9 +71,6 @@ enum NetworkStartServerWidgets {
WID_NSS_SPECTATORS_TXT, ///< 'Max spectators' text.
WID_NSS_SPECTATORS_BTNU, ///< 'Max spectators' uparrow.
- WID_NSS_LANGUAGE_LABEL, ///< Label for 'language spoken'.
- WID_NSS_LANGUAGE_BTN, ///< 'Language spoken' droplist button.
-
WID_NSS_GENERATE_GAME, ///< New game button.
WID_NSS_LOAD_GAME, ///< Load game button.
WID_NSS_PLAY_SCENARIO, ///< Play scenario button.