diff options
author | rubidium42 <rubidium@openttd.org> | 2021-04-27 22:02:40 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-13 23:13:17 +0200 |
commit | 16437b7c0dc2cf8c0ab32e375df7b2712feff73d (patch) | |
tree | 6714beec528c999b11adfc9a4959abb79942ab3e /src/network/network_gui.cpp | |
parent | 02fdb5b210ede022cb921e869cdb34758ee5299e (diff) | |
download | openttd-16437b7c0dc2cf8c0ab32e375df7b2712feff73d.tar.xz |
Codechange: move client name in settings to std::string
Diffstat (limited to 'src/network/network_gui.cpp')
-rw-r--r-- | src/network/network_gui.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 6fdf73bc4..8dec56a6d 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -462,7 +462,7 @@ public: this->FinishInitNested(WN_NETWORK_WINDOW_GAME); this->querystrings[WID_NG_CLIENT] = &this->name_editbox; - this->name_editbox.text.Assign(_settings_client.network.client_name); + this->name_editbox.text.Assign(_settings_client.network.client_name.c_str()); this->querystrings[WID_NG_FILTER] = &this->filter_editbox; this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; @@ -820,7 +820,7 @@ public: case WID_NG_CLIENT: /* Validation of the name will happen once the user tries to join or start a game, as getting * error messages while typing (e.g. when you clear the name) defeats the purpose of the check. */ - strecpy(_settings_client.network.client_name, this->name_editbox.text.buf, lastof(_settings_client.network.client_name)); + _settings_client.network.client_name = this->name_editbox.text.buf; break; } } @@ -2207,11 +2207,12 @@ public: } case WID_CL_CLIENT_NAME_EDIT: { - if (!NetworkValidateClientName(str)) break; + std::string client_name(str); + if (!NetworkValidateClientName(client_name)) break; uint index; GetSettingFromName("network.client_name", &index); - SetSettingValue(index, str); + SetSettingValue(index, client_name.c_str()); this->InvalidateData(); break; } |