mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #4301: Remove leading/trailing space from playername
This commit is contained in:
parent
3b12ab7795
commit
ea87e87750
|
@ -357,6 +357,10 @@ namespace Config
|
|||
}
|
||||
}
|
||||
|
||||
// Trim any whitespace before or after the player's name,
|
||||
// to avoid people pretending to be someone else
|
||||
playerName = String::Trim(playerName);
|
||||
|
||||
auto model = &gConfigNetwork;
|
||||
model->player_name = playerName;
|
||||
model->default_port = reader->GetSint32("default_port", NETWORK_DEFAULT_PORT);
|
||||
|
|
|
@ -1478,7 +1478,7 @@ NetworkPlayer* Network::AddPlayer(const utf8 *name, const std::string &keyhash)
|
|||
if (networkUser == nullptr) {
|
||||
player->Group = GetDefaultGroup();
|
||||
if (!String::IsNullOrEmpty(name)) {
|
||||
player->SetName(MakePlayerNameUnique(std::string(name)));
|
||||
player->SetName(MakePlayerNameUnique(String::Trim(std::string(name))));
|
||||
}
|
||||
} else {
|
||||
player->Group = networkUser->GroupId.GetValueOrDefault(GetDefaultGroup());
|
||||
|
@ -1488,7 +1488,7 @@ NetworkPlayer* Network::AddPlayer(const utf8 *name, const std::string &keyhash)
|
|||
player = std::unique_ptr<NetworkPlayer>(new NetworkPlayer); // change to make_unique in c++14
|
||||
player->Id = newid;
|
||||
player->Group = GetDefaultGroup();
|
||||
player->SetName(name);
|
||||
player->SetName(String::Trim(std::string(name)));
|
||||
}
|
||||
|
||||
addedplayer = player.get();
|
||||
|
|
|
@ -55,7 +55,7 @@ extern "C" {
|
|||
// This define specifies which version of network stream current build uses.
|
||||
// It is used for making sure only compatible builds get connected, even within
|
||||
// single OpenRCT2 version.
|
||||
#define NETWORK_STREAM_VERSION "4"
|
||||
#define NETWORK_STREAM_VERSION "5"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue