MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / checkMessage

Method checkMessage

src/bzadmin/BZAdminClient.cpp:148–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146
147
148BZAdminClient::ServerCode BZAdminClient::checkMessage() {
149 uint16_t code, len;
150 char inbuf[MaxPacketLen];
151 std::string dstName, srcName;
152 int i = 0;
153 PlayerIdMap::iterator iter;
154
155 sLink.flush();
156 // read until we have a package, or until we have waited 100 ms
157 if (sLink.read(code, len, inbuf, 100) == 1) {
158 lastMessage.first = "";
159 lastMessage.second = Default;
160 void* vbuf = inbuf;
161 PlayerId p;
162 PlayerIdMap::const_iterator it;
163 std::string victimName, killerName;
164 Address a;
165 if ((messageMask.find(code) != messageMask.end()) &&
166 (code == MsgSetVar || code == MsgRemovePlayer ||
167 code == MsgAddPlayer || code == MsgAdminInfo ||
168 code == MsgPlayerInfo || (*(messageMask.find(code))).second))
169 switch (code) {
170
171 case MsgNewRabbit:
172 vbuf = nboUnpackUInt8(vbuf, p);
173 if (p != NoPlayer)
174 lastMessage.first = std::string("*** '") + players[p].name +
175 "' is now the rabbit.";
176 break;
177
178 case MsgPause:
179 uint8_t pauseCode;
180 vbuf = nboUnpackUInt8(vbuf, p);
181 vbuf = nboUnpackUInt8(vbuf, pauseCode);
182 switch (pauseCode) {
183 case PauseCodeEnable: {
184 lastMessage.first = "*** '" + players[p].name + "': paused";
185 break;
186 }
187 case PauseCodeDisable: {
188 lastMessage.first = "*** '" + players[p].name + "': resumed";
189 break;
190 }
191 default: {
192 break; // bzadmin clients should not receive
193 // PauseCodeAcknowlege or PauseCodeCancel
194 }
195 }
196 break;
197
198 case MsgAlive:
199 vbuf = nboUnpackUInt8(vbuf, p);
200 lastMessage.first = std::string("*** '") + players[p].name +
201 "' has respawned.";
202 break;
203
204 case MsgLagPing:
205 lastMessage.first = "*** Received lag ping from server.";

Callers

nothing calls this directly

Calls 15

nboUnpackUInt8Function · 0.85
nboUnpackUInt16Function · 0.85
nboUnpackStdStringFunction · 0.85
nboUnpackInt16Function · 0.85
nboUnpackFloatFunction · 0.85
nboUnpackStringFunction · 0.85
TeamColorEnum · 0.85
nboUnpackUInt32Function · 0.85
nboUnpackInt32Function · 0.85
setPersistentMethod · 0.80
setPermissionMethod · 0.80
getDotNotationMethod · 0.80

Tested by

no test coverage detected