GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/eathena/generalrecv.cpp Lines: 3 69 4.3 %
Date: 2017-11-29 Branches: 2 33 6.1 %

Line Branch Exec Source
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-2017  The ManaPlus Developers
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#include "net/eathena/generalrecv.h"
24
25
#include "client.h"
26
#include "logger.h"
27
28
#include "net/messagein.h"
29
30
#include "utils/cast.h"
31
#include "utils/gettext.h"
32
33
#include "debug.h"
34
35
namespace EAthena
36
{
37
38
2
ServerInfo charServer;
39
2
ServerInfo mapServer;
40
41
void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
42
{
43
    const uint8_t code = msg.readUInt8("flag");
44
    logger->log("Connection problem: %u", CAST_U32(code));
45
46
    switch (code)
47
    {
48
        case 0:
49
            // TRANSLATORS: error message
50
            errorMessage = _("Authentication failed.");
51
            break;
52
        case 1:
53
            // TRANSLATORS: error message
54
            errorMessage = _("No servers available.");
55
            break;
56
        case 2:
57
            if (client->getState() == State::GAME)
58
            {
59
                // TRANSLATORS: error message
60
                errorMessage = _("Someone else is trying to use "
61
                    "this account.");
62
            }
63
            else
64
            {
65
                // TRANSLATORS: error message
66
                errorMessage = _("This account is already logged in.");
67
            }
68
            break;
69
        case 3:
70
            // TRANSLATORS: error message
71
            errorMessage = _("Speed hack detected.");
72
            break;
73
        case 4:
74
            // TRANSLATORS: error message
75
            errorMessage = _("Server full.");
76
            break;
77
        case 5:
78
            // TRANSLATORS: error message
79
            errorMessage = _("Sorry, you are underaged.");
80
            break;
81
        case 8:
82
            // TRANSLATORS: error message
83
            errorMessage = _("Duplicated login.");
84
            break;
85
        case 9:
86
            // TRANSLATORS: error message
87
            errorMessage = _("To many connections from same ip.");
88
            break;
89
        case 10:
90
            // TRANSLATORS: error message
91
            errorMessage = _("Not paid for this time.");
92
            break;
93
        case 11:
94
            // TRANSLATORS: error message
95
            errorMessage = _("Pay suspended.");
96
            break;
97
        case 12:
98
            // TRANSLATORS: error message
99
            errorMessage = _("Pay changed.");
100
            break;
101
        case 13:
102
            // TRANSLATORS: error message
103
            errorMessage = _("Pay wrong ip.");
104
            break;
105
        case 14:
106
            // TRANSLATORS: error message
107
            errorMessage = _("Pay game room.");
108
            break;
109
        case 15:
110
            // TRANSLATORS: error message
111
            errorMessage = _("Disconnect forced by GM.");
112
            break;
113
        case 16:
114
        case 17:
115
            // TRANSLATORS: error message
116
            errorMessage = _("Ban japan refuse.");
117
            break;
118
        case 18:
119
            // TRANSLATORS: error message
120
            errorMessage = _("Remained other account.");
121
            break;
122
        case 100:
123
            // TRANSLATORS: error message
124
            errorMessage = _("Ip unfair.");
125
            break;
126
        case 101:
127
            // TRANSLATORS: error message
128
            errorMessage = _("Ip count all.");
129
            break;
130
        case 102:
131
            // TRANSLATORS: error message
132
            errorMessage = _("Ip count.");
133
            break;
134
        case 103:
135
        case 104:
136
            // TRANSLATORS: error message
137
            errorMessage = _("Memory.");
138
            break;
139
        case 105:
140
            // TRANSLATORS: error message
141
            errorMessage = _("Han valid.");
142
            break;
143
        case 106:
144
            // TRANSLATORS: error message
145
            errorMessage = _("Ip limited access.");
146
            break;
147
        case 107:
148
            // TRANSLATORS: error message
149
            errorMessage = _("Over characters list.");
150
            break;
151
        case 108:
152
            // TRANSLATORS: error message
153
            errorMessage = _("Ip blocked.");
154
            break;
155
        case 109:
156
            // TRANSLATORS: error message
157
            errorMessage = _("Invalid password count.");
158
            break;
159
        case 110:
160
            // TRANSLATORS: error message
161
            errorMessage = _("Not allowed race.");
162
            break;
163
        default:
164
            // TRANSLATORS: error message
165
            errorMessage = _("Unknown connection error.");
166
            break;
167
    }
168
    client->setState(State::ERROR);
169
}
170
171
void GeneralRecv::processMapNotFound(Net::MessageIn &msg)
172
{
173
    const int sz = msg.readInt16("len") - 4;
174
    msg.readString(sz, "map name?");
175
    // TRANSLATORS: error message
176
    errorMessage = _("Map not found");
177
    client->setState(State::ERROR);
178
}
179
180

6
}  // namespace EAthena