equal
deleted
inserted
replaced
22 #include "newnetclient.h" |
22 #include "newnetclient.h" |
23 #include "proto.h" |
23 #include "proto.h" |
24 #include "gameuiconfig.h" |
24 #include "gameuiconfig.h" |
25 #include "game.h" |
25 #include "game.h" |
26 #include "gamecfgwidget.h" |
26 #include "gamecfgwidget.h" |
|
27 #include "teamselect.h" |
27 |
28 |
28 char delimeter='\t'; |
29 char delimeter='\t'; |
29 |
30 |
30 HWNewNet::HWNewNet(GameUIConfig * config, GameCFGWidget* pGameCFGWidget, TeamSelWidget* pTeamSelWidget) : |
31 HWNewNet::HWNewNet(GameUIConfig * config, GameCFGWidget* pGameCFGWidget, TeamSelWidget* pTeamSelWidget) : |
31 config(config), |
32 config(config), |
61 { |
62 { |
62 RawSendNet(QString("ADDTEAM:") + delimeter + |
63 RawSendNet(QString("ADDTEAM:") + delimeter + |
63 team.TeamName + delimeter + team.HHName[0] + delimeter + team.HHName[1] + delimeter + |
64 team.TeamName + delimeter + team.HHName[0] + delimeter + team.HHName[1] + delimeter + |
64 team.HHName[2] + delimeter + team.HHName[3] + delimeter + team.HHName[4] + delimeter + |
65 team.HHName[2] + delimeter + team.HHName[3] + delimeter + team.HHName[4] + delimeter + |
65 team.HHName[5] + delimeter + team.HHName[6] + delimeter + team.HHName[7]); |
66 team.HHName[5] + delimeter + team.HHName[6] + delimeter + team.HHName[7]); |
|
67 } |
|
68 |
|
69 void HWNewNet::RemoveTeam(const HWTeam & team) |
|
70 { |
|
71 RawSendNet(QString("REMOVETEAM:") + delimeter + team.TeamName); |
66 } |
72 } |
67 |
73 |
68 void HWNewNet::StartGame() |
74 void HWNewNet::StartGame() |
69 { |
75 { |
70 RawSendNet(QString("START:")); |
76 RawSendNet(QString("START:")); |
159 lst.pop_front(); |
165 lst.pop_front(); |
160 emit AddNetTeam(lst); |
166 emit AddNetTeam(lst); |
161 return; |
167 return; |
162 } |
168 } |
163 |
169 |
|
170 if (lst[0] == "REMOVETEAM:") { |
|
171 if(lst.size()<2) return; |
|
172 m_pTeamSelWidget->removeNetTeam(lst[1]); |
|
173 return; |
|
174 } |
|
175 |
164 if (lst[0] == "CONFIGASKED") { |
176 if (lst[0] == "CONFIGASKED") { |
165 isChief=true; |
177 isChief=true; |
166 ConfigAsked(); |
178 ConfigAsked(); |
167 return; |
179 return; |
168 } |
180 } |
220 |
232 |
221 // should be kinda game states, which don't allow "GAMEMSG:" at configure step, |
233 // should be kinda game states, which don't allow "GAMEMSG:" at configure step, |
222 // "CONNECTED" at round phase, etc. |
234 // "CONNECTED" at round phase, etc. |
223 if (lst[0] == "GAMEMSG:") { |
235 if (lst[0] == "GAMEMSG:") { |
224 QByteArray em = QByteArray::fromBase64(lst[1].toAscii()); |
236 QByteArray em = QByteArray::fromBase64(lst[1].toAscii()); |
225 qDebug() << "to engine:" << em; |
|
226 emit FromNet(em); |
237 emit FromNet(em); |
227 return; |
238 return; |
228 } |
239 } |
229 |
240 |
230 qDebug() << "unknown net command: " << msg; |
241 qDebug() << "unknown net command: " << msg; |