equal
deleted
inserted
replaced
25 #include "game.h" |
25 #include "game.h" |
26 #include "hwconsts.h" |
26 #include "hwconsts.h" |
27 #include "gameuiconfig.h" |
27 #include "gameuiconfig.h" |
28 #include "gamecfgwidget.h" |
28 #include "gamecfgwidget.h" |
29 #include "teamselect.h" |
29 #include "teamselect.h" |
30 #include "KB.h" |
|
31 #include "proto.h" |
30 #include "proto.h" |
32 |
31 |
33 #include <QTextStream> |
32 #include <QTextStream> |
34 |
33 |
35 QString training, campaign; // TODO: Cleaner solution? |
34 QString training, campaign; // TODO: Cleaner solution? |
223 { |
222 { |
224 int size = msg.size(); |
223 int size = msg.size(); |
225 emit ErrorMessage(QString("Last two engine messages:\n") + QString().append(msg.mid(2)).left(size - 4)); |
224 emit ErrorMessage(QString("Last two engine messages:\n") + QString().append(msg.mid(2)).left(size - 4)); |
226 return; |
225 return; |
227 } |
226 } |
228 case 'K': |
|
229 { |
|
230 ulong kb = msg.mid(2).toULong(); |
|
231 if (kb==1) |
|
232 { |
|
233 qWarning("%s", KBMessages[kb - 1].toLocal8Bit().constData()); |
|
234 return; |
|
235 } |
|
236 if (kb && kb <= KBmsgsCount) |
|
237 { |
|
238 emit ErrorMessage(KBMessages[kb - 1]); |
|
239 } |
|
240 return; |
|
241 } |
|
242 case 'i': |
227 case 'i': |
243 { |
228 { |
244 emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3))); |
229 emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3))); |
245 break; |
230 break; |
246 } |
231 } |
262 case 's': |
247 case 's': |
263 { |
248 { |
264 int size = msg.size(); |
249 int size = msg.size(); |
265 QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4)); |
250 QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4)); |
266 emit SendChat(msgbody); |
251 emit SendChat(msgbody); |
267 // FIXME: /me command doesn't work here |
|
268 QByteArray buf; |
252 QByteArray buf; |
269 HWProto::addStringToBuffer(buf, "s" + HWProto::formatChatMsg(config->netNick(), msgbody) + "\x20\x20"); |
253 HWProto::addStringToBuffer(buf, "s" + HWProto::formatChatMsg(config->netNick(), msgbody) + "\x20\x20"); |
270 demo.append(buf); |
254 demo.append(buf); |
271 break; |
255 break; |
272 } |
256 } |
281 { |
265 { |
282 if (gameType == gtNet && !netSuspend) |
266 if (gameType == gtNet && !netSuspend) |
283 { |
267 { |
284 emit SendNet(msg); |
268 emit SendNet(msg); |
285 } |
269 } |
286 if (msg.at(1) != 's') |
270 demo.append(msg); |
287 demo.append(msg); |
|
288 } |
271 } |
289 } |
272 } |
290 } |
273 } |
291 |
274 |
292 void HWGame::FromNet(const QByteArray & msg) |
275 void HWGame::FromNet(const QByteArray & msg) |