equal
deleted
inserted
replaced
26 #include "game.h" |
26 #include "game.h" |
27 #include "hwconsts.h" |
27 #include "hwconsts.h" |
28 #include "gameuiconfig.h" |
28 #include "gameuiconfig.h" |
29 #include "gamecfgwidget.h" |
29 #include "gamecfgwidget.h" |
30 #include "teamselect.h" |
30 #include "teamselect.h" |
31 #include "KB.h" |
|
32 #include "proto.h" |
31 #include "proto.h" |
33 #include "campaign.h" |
32 #include "campaign.h" |
34 |
33 |
35 #include <QTextStream> |
34 #include <QTextStream> |
36 #include "ThemeModel.h" |
35 #include "ThemeModel.h" |
228 { |
227 { |
229 int size = msg.size(); |
228 int size = msg.size(); |
230 emit ErrorMessage(QString("Last two engine messages:\n") + QString().append(msg.mid(2)).left(size - 4)); |
229 emit ErrorMessage(QString("Last two engine messages:\n") + QString().append(msg.mid(2)).left(size - 4)); |
231 return; |
230 return; |
232 } |
231 } |
233 case 'K': |
|
234 { |
|
235 ulong kb = msg.mid(2).toULong(); |
|
236 if (kb==1) |
|
237 { |
|
238 qWarning("%s", KBMessages[kb - 1].toLocal8Bit().constData()); |
|
239 return; |
|
240 } |
|
241 if (kb && kb <= KBmsgsCount) |
|
242 { |
|
243 emit ErrorMessage(KBMessages[kb - 1]); |
|
244 } |
|
245 return; |
|
246 } |
|
247 case 'i': |
232 case 'i': |
248 { |
233 { |
249 emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3))); |
234 emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3))); |
250 break; |
235 break; |
251 } |
236 } |
267 case 's': |
252 case 's': |
268 { |
253 { |
269 int size = msg.size(); |
254 int size = msg.size(); |
270 QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4)); |
255 QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4)); |
271 emit SendChat(msgbody); |
256 emit SendChat(msgbody); |
272 // FIXME: /me command doesn't work here |
|
273 QByteArray buf; |
257 QByteArray buf; |
274 HWProto::addStringToBuffer(buf, "s" + HWProto::formatChatMsg(config->netNick(), msgbody) + "\x20\x20"); |
258 HWProto::addStringToBuffer(buf, "s" + HWProto::formatChatMsg(config->netNick(), msgbody) + "\x20\x20"); |
275 demo.append(buf); |
259 demo.append(buf); |
276 break; |
260 break; |
277 } |
261 } |
294 { |
278 { |
295 if (gameType == gtNet && !netSuspend) |
279 if (gameType == gtNet && !netSuspend) |
296 { |
280 { |
297 emit SendNet(msg); |
281 emit SendNet(msg); |
298 } |
282 } |
299 if (msg.at(1) != 's') |
283 demo.append(msg); |
300 demo.append(msg); |
|
301 } |
284 } |
302 } |
285 } |
303 } |
286 } |
304 |
287 |
305 void HWGame::FromNet(const QByteArray & msg) |
288 void HWGame::FromNet(const QByteArray & msg) |