ManaPlus
Functions
Ea::CharServerRecv Namespace Reference

Functions

void processCharLoginError (Net::MessageIn &msg)
 
void processCharCreateFailed (Net::MessageIn &msg)
 
void processCharDelete (Net::MessageIn &msg)
 

Function Documentation

◆ processCharCreateFailed()

void Ea::CharServerRecv::processCharCreateFailed ( Net::MessageIn msg)

Definition at line 67 of file charserverrecv.cpp.

68 {
69  BLOCK_START("CharServerRecv::processCharCreateFailed")
70  switch (msg.readUInt8("error"))
71  {
72  case 1:
73  case 0:
74  default:
75  // TRANSLATORS: error message
76  errorMessage = _("Failed to create character. Most "
77  "likely the name is already taken.");
78  break;
79  case 2:
80  // TRANSLATORS: error message
81  errorMessage = _("Wrong name.");
82  break;
83  case 3:
84  // TRANSLATORS: error message
85  errorMessage = _("Incorrect stats.");
86  break;
87  case 4:
88  // TRANSLATORS: error message
89  errorMessage = _("Incorrect hair.");
90  break;
91  case 5:
92  // TRANSLATORS: error message
93  errorMessage = _("Incorrect slot.");
94  break;
95  case 6:
96  // TRANSLATORS: error message
97  errorMessage = _("Incorrect race.");
98  break;
99  case 7:
100  // TRANSLATORS: error message
101  errorMessage = _("Incorrect look.");
102  break;
103  }
105  // TRANSLATORS: error message header
106  _("Error"),
107  errorMessage,
108  // TRANSLATORS: ok dialog button
109  _("OK"),
111  Modal_true,
113  nullptr,
114  260);
117  BLOCK_END("CharServerRecv::processCharCreateFailed")
118 }
static CharCreateDialog * mCharCreateDialog
#define CREATEWIDGET(type,...)
Definition: createwidget.h:29
std::string errorMessage
Definition: client.cpp:116
#define _(s)
Definition: gettext.h:35
const bool Modal_true
Definition: modal.h:30
bool msg(InputEvent &event)
Definition: chat.cpp:39
bool error(InputEvent &event) __attribute__((noreturn))
Definition: actions.cpp:82
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79
const bool ShowCenter_true
Definition: showcenter.h:30

References _, BLOCK_END, BLOCK_START, CREATEWIDGET, DialogType::ERROR, errorMessage, Net::CharServerHandler::mCharCreateDialog, Modal_true, Actions::msg(), ShowCenter_true, and CharCreateDialog::unlock().

◆ processCharDelete()

void Ea::CharServerRecv::processCharDelete ( Net::MessageIn msg)

Definition at line 120 of file charserverrecv.cpp.

121 {
122  BLOCK_START("CharServerRecv::processCharDelete")
123  Net::CharServerHandler::mCharacters.remove(
124  Net::CharServerHandler::mSelectedCharacter);
125  delete Net::CharServerHandler::mSelectedCharacter;
126  Net::CharServerHandler::mSelectedCharacter = nullptr;
127  Net::CharServerHandler::updateCharSelectDialog();
128  Net::CharServerHandler::unlockCharSelectDialog();
130  // TRANSLATORS: info message header
131  _("Info"),
132  // TRANSLATORS: info message
133  _("Character deleted."),
134  // TRANSLATORS: ok dialog button
135  _("OK"),
136  DialogType::OK,
137  Modal_true,
139  nullptr,
140  260);
141  BLOCK_END("CharServerRecv::processCharDelete")
142 }
void processCharDelete(Net::MessageIn &msg)
bool remove(const std::string &filename)
Definition: fs.cpp:780

References _, BLOCK_END, BLOCK_START, CREATEWIDGET, Net::CharServerHandler::mCharacters, Modal_true, Net::CharServerHandler::mSelectedCharacter, DialogType::OK, ShowCenter_true, Net::CharServerHandler::unlockCharSelectDialog(), and Net::CharServerHandler::updateCharSelectDialog().

◆ processCharLoginError()

void Ea::CharServerRecv::processCharLoginError ( Net::MessageIn msg)

Definition at line 44 of file charserverrecv.cpp.

45 {
46  BLOCK_START("CharServerRecv::processCharLoginError")
47  switch (msg.readUInt8("error"))
48  {
49  case 0:
50  // TRANSLATORS: error message
51  errorMessage = _("Access denied. Most likely, there are "
52  "too many players on this server.");
53  break;
54  case 1:
55  // TRANSLATORS: error message
56  errorMessage = _("Cannot use this ID.");
57  break;
58  default:
59  // TRANSLATORS: error message
60  errorMessage = _("Unknown char-server failure.");
61  break;
62  }
64  BLOCK_END("CharServerRecv::processCharLoginError")
65 }
void setState(const StateT state)
Definition: client.h:66
Client * client
Definition: client.cpp:118
@ ERROR
Definition: state.h:35

References _, BLOCK_END, BLOCK_START, client, State::ERROR, errorMessage, Actions::msg(), and Client::setState().