Skip to content

Commit 3007546

Browse files
committedMar 28, 2015
Change error_message from wstring to string
This removes a lot of narrow/wide conversions where a wide string was never used.
1 parent 3d53c90 commit 3007546

File tree

9 files changed

+129
-149
lines changed

9 files changed

+129
-149
lines changed
 

Diff for: ‎src/camera.cpp

+12-26
Original file line numberDiff line numberDiff line change
@@ -119,34 +119,20 @@ Camera::~Camera()
119119
m_wieldmgr->drop();
120120
}
121121

122-
bool Camera::successfullyCreated(std::wstring& error_message)
122+
bool Camera::successfullyCreated(std::string &error_message)
123123
{
124-
if (m_playernode == NULL)
125-
{
126-
error_message = L"Failed to create the player scene node";
127-
return false;
128-
}
129-
if (m_headnode == NULL)
130-
{
131-
error_message = L"Failed to create the head scene node";
132-
return false;
133-
}
134-
if (m_cameranode == NULL)
135-
{
136-
error_message = L"Failed to create the camera scene node";
137-
return false;
138-
}
139-
if (m_wieldmgr == NULL)
140-
{
141-
error_message = L"Failed to create the wielded item scene manager";
142-
return false;
143-
}
144-
if (m_wieldnode == NULL)
145-
{
146-
error_message = L"Failed to create the wielded item scene node";
147-
return false;
124+
if (!m_playernode) {
125+
error_message = "Failed to create the player scene node";
126+
} else if (!m_headnode) {
127+
error_message = "Failed to create the head scene node";
128+
} else if (!m_cameranode) {
129+
error_message = "Failed to create the camera scene node";
130+
} else if (!m_wieldmgr) {
131+
error_message = "Failed to create the wielded item scene manager";
132+
} else if (!m_wieldnode) {
133+
error_message = "Failed to create the wielded item scene node";
148134
}
149-
return true;
135+
return error_message.empty();
150136
}
151137

152138
// Returns the fractional part of x

Diff for: ‎src/camera.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Camera
110110
}
111111

112112
// Checks if the constructor was able to create the scene nodes
113-
bool successfullyCreated(std::wstring& error_message);
113+
bool successfullyCreated(std::string &error_message);
114114

115115
// Step the camera: updates the viewing range and view bobbing.
116116
void step(f32 dtime);

Diff for: ‎src/client.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
480480
bool accessDenied()
481481
{ return m_access_denied; }
482482

483-
std::wstring accessDeniedReason()
483+
std::string accessDeniedReason()
484484
{ return m_access_denied_reason; }
485485

486486
bool itemdefReceived()
@@ -589,7 +589,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
589589
u64 m_map_seed;
590590
std::string m_password;
591591
bool m_access_denied;
592-
std::wstring m_access_denied_reason;
592+
std::string m_access_denied_reason;
593593
std::queue<ClientEvent> m_client_event_queue;
594594
bool m_itemdef_received;
595595
bool m_nodedef_received;

Diff for: ‎src/client/clientlauncher.cpp

+27-29
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
156156

157157
// If an error occurs, this is set to something by menu().
158158
// It is then displayed before the menu shows on the next call to menu()
159-
std::wstring error_message = L"";
159+
std::string error_message;
160160

161161
bool first_loop = true;
162162

@@ -184,7 +184,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
184184
*/
185185
guiroot = guienv->addStaticText(L"", core::rect<s32>(0, 0, 10000, 10000));
186186

187-
bool game_has_run = launch_game(&error_message, game_params, cmd_args);
187+
bool game_has_run = launch_game(error_message, game_params, cmd_args);
188188

189189
// If skip_main_menu, we only want to startup once
190190
if (skip_main_menu && !first_loop)
@@ -207,7 +207,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
207207
}
208208

209209
if (current_playername.length() > PLAYERNAME_SIZE-1) {
210-
error_message = wgettext("Player name too long.");
210+
error_message = gettext("Player name too long.");
211211
playername = current_playername.substr(0, PLAYERNAME_SIZE-1);
212212
g_settings->set("name", playername);
213213
continue;
@@ -245,25 +245,24 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
245245

246246
} //try
247247
catch (con::PeerNotFoundException &e) {
248-
error_message = wgettext("Connection error (timed out?)");
249-
errorstream << wide_to_narrow(error_message) << std::endl;
248+
error_message = gettext("Connection error (timed out?)");
249+
errorstream << error_message << std::endl;
250250
}
251251

252252
#ifdef NDEBUG
253253
catch (std::exception &e) {
254-
std::string narrow_message = "Some exception: \"";
255-
narrow_message += e.what();
256-
narrow_message += "\"";
257-
errorstream << narrow_message << std::endl;
258-
error_message = narrow_to_wide(narrow_message);
254+
std::string error_message = "Some exception: \"";
255+
error_message += e.what();
256+
error_message += "\"";
257+
errorstream << error_message << std::endl;
259258
}
260259
#endif
261260

262261
// If no main menu, show error and exit
263262
if (skip_main_menu) {
264-
if (error_message != L"") {
263+
if (!error_message.empty()) {
265264
verbosestream << "error_message = "
266-
<< wide_to_narrow(error_message) << std::endl;
265+
<< error_message << std::endl;
267266
retval = false;
268267
}
269268
break;
@@ -312,17 +311,17 @@ bool ClientLauncher::init_engine(int log_level)
312311
return device != NULL;
313312
}
314313

315-
bool ClientLauncher::launch_game(std::wstring *error_message,
314+
bool ClientLauncher::launch_game(std::string &error_message,
316315
GameParams &game_params, const Settings &cmd_args)
317316
{
318317
// Initialize menu data
319318
MainMenuData menudata;
320319
menudata.address = address;
321320
menudata.name = playername;
322321
menudata.port = itos(game_params.socket_port);
323-
menudata.errormessage = wide_to_narrow(*error_message);
322+
menudata.errormessage = error_message;
324323

325-
*error_message = L"";
324+
error_message.clear();
326325

327326
if (cmd_args.exists("password"))
328327
menudata.password = cmd_args.get("password");
@@ -367,11 +366,11 @@ bool ClientLauncher::launch_game(std::wstring *error_message,
367366
}
368367
}
369368

370-
if (menudata.errormessage != "") {
369+
if (!menudata.errormessage.empty()) {
371370
/* The calling function will pass this back into this function upon the
372371
* next iteration (if any) causing it to be displayed by the GUI
373372
*/
374-
*error_message = narrow_to_wide(menudata.errormessage);
373+
error_message = menudata.errormessage;
375374
return false;
376375
}
377376

@@ -410,25 +409,25 @@ bool ClientLauncher::launch_game(std::wstring *error_message,
410409

411410
if (current_address == "") { // If local game
412411
if (worldspec.path == "") {
413-
*error_message = wgettext("No world selected and no address "
412+
error_message = gettext("No world selected and no address "
414413
"provided. Nothing to do.");
415-
errorstream << wide_to_narrow(*error_message) << std::endl;
414+
errorstream << error_message << std::endl;
416415
return false;
417416
}
418417

419418
if (!fs::PathExists(worldspec.path)) {
420-
*error_message = wgettext("Provided world path doesn't exist: ")
421-
+ narrow_to_wide(worldspec.path);
422-
errorstream << wide_to_narrow(*error_message) << std::endl;
419+
error_message = gettext("Provided world path doesn't exist: ")
420+
+ worldspec.path;
421+
errorstream << error_message << std::endl;
423422
return false;
424423
}
425424

426425
// Load gamespec for required game
427426
gamespec = findWorldSubgame(worldspec.path);
428427
if (!gamespec.isValid() && !game_params.game_spec.isValid()) {
429-
*error_message = wgettext("Could not find or load game \"")
430-
+ narrow_to_wide(worldspec.gameid) + L"\"";
431-
errorstream << wide_to_narrow(*error_message) << std::endl;
428+
error_message = gettext("Could not find or load game \"")
429+
+ worldspec.gameid + "\"";
430+
errorstream << error_message << std::endl;
432431
return false;
433432
}
434433

@@ -444,10 +443,9 @@ bool ClientLauncher::launch_game(std::wstring *error_message,
444443
}
445444

446445
if (!gamespec.isValid()) {
447-
*error_message = wgettext("Invalid gamespec.");
448-
*error_message += L" (world_gameid="
449-
+ narrow_to_wide(worldspec.gameid) + L")";
450-
errorstream << wide_to_narrow(*error_message) << std::endl;
446+
error_message = gettext("Invalid gamespec.");
447+
error_message += " (world.gameid=" + worldspec.gameid + ")";
448+
errorstream << error_message << std::endl;
451449
return false;
452450
}
453451
}

Diff for: ‎src/client/clientlauncher.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ClientLauncher
9292
void init_args(GameParams &game_params, const Settings &cmd_args);
9393
bool init_engine(int log_level);
9494

95-
bool launch_game(std::wstring *error_message, GameParams &game_params,
95+
bool launch_game(std::string &error_message, GameParams &game_params,
9696
const Settings &cmd_args);
9797

9898
void main_menu(MainMenuData *menudata);

Diff for: ‎src/game.cpp

+54-62
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ class Game
14231423
// If address is "", local server is used and address is updated
14241424
std::string *address,
14251425
u16 port,
1426-
std::wstring *error_message,
1426+
std::string &error_message,
14271427
ChatBackend *chat_backend,
14281428
const SubgameSpec &gamespec, // Used for local game
14291429
bool simple_singleplayer_mode);
@@ -1445,9 +1445,8 @@ class Game
14451445

14461446
// Client creation
14471447
bool createClient(const std::string &playername,
1448-
const std::string &password, std::string *address, u16 port,
1449-
std::wstring *error_message);
1450-
bool initGui(std::wstring *error_message);
1448+
const std::string &password, std::string *address, u16 port);
1449+
bool initGui();
14511450

14521451
// Client connection
14531452
bool connectToServer(const std::string &playername,
@@ -1575,7 +1574,7 @@ class Game
15751574
video::IVideoDriver *driver;
15761575
scene::ISceneManager *smgr;
15771576
bool *kill;
1578-
std::wstring *error_message;
1577+
std::string *error_message;
15791578
IGameDef *gamedef; // Convenience (same as *client)
15801579
scene::ISceneNode *skybox;
15811580

@@ -1692,15 +1691,15 @@ bool Game::startup(bool *kill,
16921691
const std::string &password,
16931692
std::string *address, // can change if simple_singleplayer_mode
16941693
u16 port,
1695-
std::wstring *error_message,
1694+
std::string &error_message,
16961695
ChatBackend *chat_backend,
16971696
const SubgameSpec &gamespec,
16981697
bool simple_singleplayer_mode)
16991698
{
17001699
// "cache"
17011700
this->device = device;
17021701
this->kill = kill;
1703-
this->error_message = error_message;
1702+
this->error_message = &error_message;
17041703
this->random_input = random_input;
17051704
this->input = input;
17061705
this->chat_backend = chat_backend;
@@ -1714,7 +1713,7 @@ bool Game::startup(bool *kill,
17141713
if (!init(map_dir, address, port, gamespec))
17151714
return false;
17161715

1717-
if (!createClient(playername, password, address, port, error_message))
1716+
if (!createClient(playername, password, address, port))
17181717
return false;
17191718

17201719
return true;
@@ -1934,10 +1933,10 @@ bool Game::createSingleplayerServer(const std::string map_dir,
19341933
}
19351934

19361935
if (bind_addr.isIPv6() && !g_settings->getBool("enable_ipv6")) {
1937-
*error_message = L"Unable to listen on " +
1938-
narrow_to_wide(bind_addr.serializeString()) +
1939-
L" because IPv6 is disabled";
1940-
errorstream << wide_to_narrow(*error_message) << std::endl;
1936+
*error_message = "Unable to listen on " +
1937+
bind_addr.serializeString() +
1938+
" because IPv6 is disabled";
1939+
errorstream << *error_message << std::endl;
19411940
return false;
19421941
}
19431942

@@ -1950,8 +1949,7 @@ bool Game::createSingleplayerServer(const std::string map_dir,
19501949
}
19511950

19521951
bool Game::createClient(const std::string &playername,
1953-
const std::string &password, std::string *address, u16 port,
1954-
std::wstring *error_message)
1952+
const std::string &password, std::string *address, u16 port)
19551953
{
19561954
showOverlayMessage(wgettext("Creating client..."), 0, 10);
19571955

@@ -1966,19 +1964,19 @@ bool Game::createClient(const std::string &playername,
19661964
return false;
19671965

19681966
if (!could_connect) {
1969-
if (*error_message == L"" && !connect_aborted) {
1967+
if (error_message->empty() && !connect_aborted) {
19701968
// Should not happen if error messages are set properly
1971-
*error_message = L"Connection failed for unknown reason";
1972-
errorstream << wide_to_narrow(*error_message) << std::endl;
1969+
*error_message = "Connection failed for unknown reason";
1970+
errorstream << *error_message << std::endl;
19731971
}
19741972
return false;
19751973
}
19761974

19771975
if (!getServerContent(&connect_aborted)) {
1978-
if (*error_message == L"" && !connect_aborted) {
1976+
if (error_message->empty() && !connect_aborted) {
19791977
// Should not happen if error messages are set properly
1980-
*error_message = L"Connection failed for unknown reason";
1981-
errorstream << wide_to_narrow(*error_message) << std::endl;
1978+
*error_message = "Connection failed for unknown reason";
1979+
errorstream << *error_message << std::endl;
19821980
}
19831981
return false;
19841982
}
@@ -1997,9 +1995,8 @@ bool Game::createClient(const std::string &playername,
19971995
if (m_cache_enable_clouds) {
19981996
clouds = new Clouds(smgr->getRootSceneNode(), smgr, -1, time(0));
19991997
if (!clouds) {
2000-
*error_message = L"Memory allocation error";
2001-
*error_message += narrow_to_wide(" (clouds)");
2002-
errorstream << wide_to_narrow(*error_message) << std::endl;
1998+
*error_message = "Memory allocation error (clouds)";
1999+
errorstream << *error_message << std::endl;
20032000
return false;
20042001
}
20052002
}
@@ -2012,9 +2009,8 @@ bool Game::createClient(const std::string &playername,
20122009
local_inventory = new Inventory(itemdef_manager);
20132010

20142011
if (!(sky && local_inventory)) {
2015-
*error_message = L"Memory allocation error";
2016-
*error_message += narrow_to_wide(" (sky or local inventory)");
2017-
errorstream << wide_to_narrow(*error_message) << std::endl;
2012+
*error_message = "Memory allocation error (sky or local inventory)";
2013+
errorstream << *error_message << std::endl;
20182014
return false;
20192015
}
20202016

@@ -2028,7 +2024,7 @@ bool Game::createClient(const std::string &playername,
20282024
crack_animation_length = 5;
20292025
}
20302026

2031-
if (!initGui(error_message))
2027+
if (!initGui())
20322028
return false;
20332029

20342030
/* Set window caption
@@ -2046,15 +2042,15 @@ bool Game::createClient(const std::string &playername,
20462042
hud = new Hud(driver, smgr, guienv, gamedef, player, local_inventory);
20472043

20482044
if (!hud) {
2049-
*error_message = L"Memory error: could not create HUD";
2050-
errorstream << wide_to_narrow(*error_message) << std::endl;
2045+
*error_message = "Memory error: could not create HUD";
2046+
errorstream << *error_message << std::endl;
20512047
return false;
20522048
}
20532049

20542050
return true;
20552051
}
20562052

2057-
bool Game::initGui(std::wstring *error_message)
2053+
bool Game::initGui()
20582054
{
20592055
// First line of debug text
20602056
guitext = guienv->addStaticText(
@@ -2095,8 +2091,8 @@ bool Game::initGui(std::wstring *error_message)
20952091
gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
20962092
-1, chat_backend, client);
20972093
if (!gui_chat_console) {
2098-
*error_message = L"Could not allocate memory for chat console";
2099-
errorstream << wide_to_narrow(*error_message) << std::endl;
2094+
*error_message = "Could not allocate memory for chat console";
2095+
errorstream << *error_message << std::endl;
21002096
return false;
21012097
}
21022098

@@ -2146,16 +2142,16 @@ bool Game::connectToServer(const std::string &playername,
21462142
local_server_mode = true;
21472143
}
21482144
} catch (ResolveError &e) {
2149-
*error_message = L"Couldn't resolve address: " + narrow_to_wide(e.what());
2150-
errorstream << wide_to_narrow(*error_message) << std::endl;
2145+
*error_message = std::string("Couldn't resolve address: ") + e.what();
2146+
errorstream << *error_message << std::endl;
21512147
return false;
21522148
}
21532149

21542150
if (connect_address.isIPv6() && !g_settings->getBool("enable_ipv6")) {
2155-
*error_message = L"Unable to connect to " +
2156-
narrow_to_wide(connect_address.serializeString()) +
2157-
L" because IPv6 is disabled";
2158-
errorstream << wide_to_narrow(*error_message) << std::endl;
2151+
*error_message = "Unable to connect to " +
2152+
connect_address.serializeString() +
2153+
" because IPv6 is disabled";
2154+
errorstream << *error_message << std::endl;
21592155
return false;
21602156
}
21612157

@@ -2205,9 +2201,9 @@ bool Game::connectToServer(const std::string &playername,
22052201

22062202
// Break conditions
22072203
if (client->accessDenied()) {
2208-
*error_message = L"Access denied. Reason: "
2204+
*error_message = "Access denied. Reason: "
22092205
+ client->accessDeniedReason();
2210-
errorstream << wide_to_narrow(*error_message) << std::endl;
2206+
errorstream << *error_message << std::endl;
22112207
break;
22122208
}
22132209

@@ -2253,16 +2249,12 @@ bool Game::getServerContent(bool *aborted)
22532249
}
22542250

22552251
// Error conditions
2256-
if (client->accessDenied()) {
2257-
*error_message = L"Access denied. Reason: "
2258-
+ client->accessDeniedReason();
2259-
errorstream << wide_to_narrow(*error_message) << std::endl;
2252+
if (!checkConnection())
22602253
return false;
2261-
}
22622254

22632255
if (client->getState() < LC_Init) {
2264-
*error_message = L"Client disconnected";
2265-
errorstream << wide_to_narrow(*error_message) << std::endl;
2256+
*error_message = "Client disconnected";
2257+
errorstream << *error_message << std::endl;
22662258
return false;
22672259
}
22682260

@@ -2336,9 +2328,9 @@ inline void Game::updateInteractTimers(GameRunData *runData, f32 dtime)
23362328
inline bool Game::checkConnection()
23372329
{
23382330
if (client->accessDenied()) {
2339-
*error_message = L"Access denied. Reason: "
2331+
*error_message = "Access denied. Reason: "
23402332
+ client->accessDeniedReason();
2341-
errorstream << wide_to_narrow(*error_message) << std::endl;
2333+
errorstream << *error_message << std::endl;
23422334
return false;
23432335
}
23442336

@@ -4219,7 +4211,7 @@ void the_game(bool *kill,
42194211
const std::string &address, // If empty local server is created
42204212
u16 port,
42214213

4222-
std::wstring &error_message,
4214+
std::string &error_message,
42234215
ChatBackend &chat_backend,
42244216
const SubgameSpec &gamespec, // Used for local game
42254217
bool simple_singleplayer_mode)
@@ -4235,24 +4227,24 @@ void the_game(bool *kill,
42354227
try {
42364228

42374229
if (game.startup(kill, random_input, input, device, map_dir,
4238-
playername, password, &server_address, port,
4239-
&error_message, &chat_backend, gamespec,
4240-
simple_singleplayer_mode)) {
4241-
4230+
playername, password, &server_address, port,
4231+
error_message, &chat_backend, gamespec,
4232+
simple_singleplayer_mode)) {
42424233
game.run();
42434234
game.shutdown();
42444235
}
42454236

42464237
} catch (SerializationError &e) {
4247-
error_message = L"A serialization error occurred:\n"
4248-
+ narrow_to_wide(e.what()) + L"\n\nThe server is probably "
4249-
L" running a different version of " PROJECT_NAME ".";
4250-
errorstream << wide_to_narrow(error_message) << std::endl;
4238+
error_message = std::string("A serialization error occurred:\n")
4239+
+ e.what() + "\n\nThe server is probably "
4240+
" running a different version of " PROJECT_NAME ".";
4241+
errorstream << error_message << std::endl;
42514242
} catch (ServerError &e) {
4252-
error_message = narrow_to_wide(e.what());
4253-
errorstream << "ServerError: " << e.what() << std::endl;
4243+
error_message = e.what();
4244+
errorstream << "ServerError: " << error_message << std::endl;
42544245
} catch (ModError &e) {
4255-
errorstream << "ModError: " << e.what() << std::endl;
4256-
error_message = narrow_to_wide(e.what()) + wstrgettext("\nCheck debug.txt for details.");
4246+
error_message = e.what() + strgettext("\nCheck debug.txt for details.");
4247+
errorstream << "ModError: " << error_message << std::endl;
42574248
}
42584249
}
4250+

Diff for: ‎src/game.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void the_game(bool *kill,
145145
const std::string &password,
146146
const std::string &address, // If "", local server is used
147147
u16 port,
148-
std::wstring &error_message,
148+
std::string &error_message,
149149
ChatBackend &chat_backend,
150150
const SubgameSpec &gamespec, // Used for local game
151151
bool simple_singleplayer_mode);

Diff for: ‎src/network/clientpackethandler.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
140140
// to be processed even if the serialisation format has
141141
// not been agreed yet, the same as TOCLIENT_INIT.
142142
m_access_denied = true;
143-
m_access_denied_reason = L"Unknown";
143+
m_access_denied_reason = "Unknown";
144144

145145
if (pkt->getCommand() == TOCLIENT_ACCESS_DENIED) {
146146
if (pkt->getSize() < 1)
@@ -149,7 +149,9 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
149149
u8 denyCode = SERVER_ACCESSDENIED_UNEXPECTED_DATA;
150150
*pkt >> denyCode;
151151
if (denyCode == SERVER_ACCESSDENIED_CUSTOM_STRING) {
152-
*pkt >> m_access_denied_reason;
152+
std::wstring wide_reason;
153+
*pkt >> wide_reason;
154+
m_access_denied_reason = wide_to_narrow(wide_reason);
153155
}
154156
else if (denyCode < SERVER_ACCESSDENIED_MAX) {
155157
m_access_denied_reason = accessDeniedStrings[denyCode];
@@ -159,7 +161,9 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
159161
// for compat with old clients
160162
else {
161163
if (pkt->getSize() >= 2) {
162-
*pkt >> m_access_denied_reason;
164+
std::wstring wide_reason;
165+
*pkt >> wide_reason;
166+
m_access_denied_reason = wide_to_narrow(wide_reason);
163167
}
164168
}
165169
}

Diff for: ‎src/network/networkprotocol.h

+24-24
Original file line numberDiff line numberDiff line change
@@ -861,36 +861,36 @@ enum ToServerCommand
861861
};
862862

863863
enum AccessDeniedCode {
864-
SERVER_ACCESSDENIED_WRONG_PASSWORD = 0,
865-
SERVER_ACCESSDENIED_UNEXPECTED_DATA = 1,
866-
SERVER_ACCESSDENIED_SINGLEPLAYER = 2,
867-
SERVER_ACCESSDENIED_WRONG_VERSION = 3,
868-
SERVER_ACCESSDENIED_WRONG_CHARS_IN_NAME = 4,
869-
SERVER_ACCESSDENIED_WRONG_NAME = 5,
870-
SERVER_ACCESSDENIED_TOO_MANY_USERS = 6,
871-
SERVER_ACCESSDENIED_EMPTY_PASSWORD = 7,
872-
SERVER_ACCESSDENIED_ALREADY_CONNECTED = 8,
873-
SERVER_ACCESSDENIED_SERVER_FAIL = 9,
874-
SERVER_ACCESSDENIED_CUSTOM_STRING = 10,
875-
SERVER_ACCESSDENIED_MAX = 11,
864+
SERVER_ACCESSDENIED_WRONG_PASSWORD,
865+
SERVER_ACCESSDENIED_UNEXPECTED_DATA,
866+
SERVER_ACCESSDENIED_SINGLEPLAYER,
867+
SERVER_ACCESSDENIED_WRONG_VERSION,
868+
SERVER_ACCESSDENIED_WRONG_CHARS_IN_NAME,
869+
SERVER_ACCESSDENIED_WRONG_NAME,
870+
SERVER_ACCESSDENIED_TOO_MANY_USERS,
871+
SERVER_ACCESSDENIED_EMPTY_PASSWORD,
872+
SERVER_ACCESSDENIED_ALREADY_CONNECTED,
873+
SERVER_ACCESSDENIED_SERVER_FAIL,
874+
SERVER_ACCESSDENIED_CUSTOM_STRING,
875+
SERVER_ACCESSDENIED_MAX,
876876
};
877877

878878
enum NetProtoCompressionMode {
879879
NETPROTO_COMPRESSION_ZLIB = 0,
880880
};
881881

882-
const static std::wstring accessDeniedStrings[SERVER_ACCESSDENIED_MAX] = {
883-
L"Invalid password",
884-
L"Your client sent something server didn't expect. Try reconnecting or updating your client",
885-
L"The server is running in simple singleplayer mode. You cannot connect.",
886-
L"Your client's version is not supported.\nPlease contact server administrator.",
887-
L"Name contains unallowed characters",
888-
L"Name is not allowed",
889-
L"Too many users.",
890-
L"Empty passwords are disallowed. Set a password and try again.",
891-
L"Another client is connected with this name. If your client closed unexpectedly, try again in a minute.",
892-
L"Server authenticator failed. Maybe the servers has some problems."
893-
L"",
882+
const static std::string accessDeniedStrings[SERVER_ACCESSDENIED_MAX] = {
883+
"Invalid password",
884+
"Your client sent something the server didn't expect. Try reconnecting or updating your client",
885+
"The server is running in simple singleplayer mode. You cannot connect.",
886+
"Your client's version is not supported.\nPlease contact server administrator.",
887+
"Player name contains disallowed characters.",
888+
"Player name not allowed.",
889+
"Too many users.",
890+
"Empty passwords are disallowed. Set a password and try again.",
891+
"Another client is connected with this name. If your client closed unexpectedly, try again in a minute.",
892+
"Server authention failed. This is likely a server error."
893+
"",
894894
};
895895

896896
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.