ManaPlus
Functions
TmwAthena::GeneralRecv Namespace Reference

Functions

void processConnectionProblem (Net::MessageIn &msg)
 

Function Documentation

◆ processConnectionProblem()

void TmwAthena::GeneralRecv::processConnectionProblem ( Net::MessageIn msg)

Definition at line 42 of file generalrecv.cpp.

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  }
84 }
#define CAST_U32
Definition: cast.h:31
void setState(const StateT state)
Definition: client.h:66
StateT getState() const
Definition: client.h:69
void log(const char *const log_text,...)
Definition: logger.cpp:269
Client * client
Definition: client.cpp:118
std::string errorMessage
Definition: client.cpp:116
#define _(s)
Definition: gettext.h:35
Logger * logger
Definition: logger.cpp:89
bool msg(InputEvent &event)
Definition: chat.cpp:39
@ GAME
Definition: state.h:49
@ ERROR
Definition: state.h:35

References _, CAST_U32, client, State::ERROR, errorMessage, State::GAME, Client::getState(), Logger::log(), logger, Actions::msg(), and Client::setState().