ManaPlus
src
net
tmwa
generalrecv.cpp
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2009 The Mana World Development Team
4
* Copyright (C) 2009-2010 The Mana Developers
5
* Copyright (C) 2011-2019 The ManaPlus Developers
6
* Copyright (C) 2019-2021 Andrei Karas
7
*
8
* This file is part of The ManaPlus Client.
9
*
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the GNU General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
#include "
net/tmwa/generalrecv.h
"
25
26
#include "
client.h
"
27
#include "
logger.h
"
28
29
#include "
net/messagein.h
"
30
31
#include "
utils/cast.h
"
32
#include "
utils/gettext.h
"
33
34
#include "
debug.h
"
35
36
namespace
TmwAthena
37
{
38
39
ServerInfo
charServer
;
40
ServerInfo
mapServer
;
41
42
void
GeneralRecv::processConnectionProblem
(
Net::MessageIn
&
msg
)
43
{
44
const
uint8_t code =
msg
.readUInt8(
"flag"
);
45
logger
->
log
(
"Connection problem: %u"
,
CAST_U32
(code));
46
47
switch
(code)
48
{
49
case
0:
50
// TRANSLATORS: error message
51
errorMessage
=
_
(
"Authentication failed."
);
52
break
;
53
case
1:
54
// TRANSLATORS: error message
55
errorMessage
=
_
(
"No servers available."
);
56
break
;
57
case
2:
58
if
(
client
->
getState
() ==
State::GAME
)
59
{
60
// TRANSLATORS: error message
61
errorMessage
=
_
(
"Someone else is trying to use this "
62
"account."
);
63
}
64
else
65
{
66
// TRANSLATORS: error message
67
errorMessage
=
_
(
"This account is already logged in."
);
68
}
69
break
;
70
case
3:
71
// TRANSLATORS: error message
72
errorMessage
=
_
(
"Speed hack detected."
);
73
break
;
74
case
8:
75
// TRANSLATORS: error message
76
errorMessage
=
_
(
"Duplicated login."
);
77
break
;
78
default
:
79
// TRANSLATORS: error message
80
errorMessage
=
_
(
"Unknown connection error."
);
81
break
;
82
}
83
client
->
setState
(
State::ERROR
);
84
}
85
86
}
// namespace TmwAthena
cast.h
CAST_U32
#define CAST_U32
Definition:
cast.h:31
Client::setState
void setState(const StateT state)
Definition:
client.h:66
Client::getState
StateT getState() const
Definition:
client.h:69
Logger::log
void log(const char *const log_text,...)
Definition:
logger.cpp:269
Net::MessageIn
Definition:
messagein.h:42
ServerInfo
Definition:
serverinfo.h:38
debug.h
client
Client * client
Definition:
client.cpp:118
errorMessage
std::string errorMessage
Definition:
client.cpp:116
gettext.h
_
#define _(s)
Definition:
gettext.h:35
logger
Logger * logger
Definition:
logger.cpp:89
logger.h
messagein.h
Actions::msg
bool msg(InputEvent &event)
Definition:
chat.cpp:39
State::GAME
@ GAME
Definition:
state.h:49
State::ERROR
@ ERROR
Definition:
state.h:35
TmwAthena::GeneralRecv::processConnectionProblem
void processConnectionProblem(Net::MessageIn &msg)
Definition:
generalrecv.cpp:42
TmwAthena
Definition:
achievementhandler.cpp:27
TmwAthena::mapServer
ServerInfo mapServer
Definition:
charserverrecv.cpp:59
TmwAthena::charServer
ServerInfo charServer
Definition:
charserverrecv.cpp:61
client.h
generalrecv.h
Generated on Wed Mar 17 2021 19:19:08 for ManaPlus by
1.9.1