100 HWProto::addStringToBuffer(buf, QString("eammprob %1").arg(ammostr.mid(cAmmoNumber, cAmmoNumber))); |
115 HWProto::addStringToBuffer(buf, QString("eammprob %1").arg(ammostr.mid(cAmmoNumber, cAmmoNumber))); |
101 HWProto::addStringToBuffer(buf, QString("eammdelay %1").arg(ammostr.mid(2 * cAmmoNumber, cAmmoNumber))); |
116 HWProto::addStringToBuffer(buf, QString("eammdelay %1").arg(ammostr.mid(2 * cAmmoNumber, cAmmoNumber))); |
102 HWProto::addStringToBuffer(buf, QString("eammreinf %1").arg(ammostr.mid(3 * cAmmoNumber, cAmmoNumber))); |
117 HWProto::addStringToBuffer(buf, QString("eammreinf %1").arg(ammostr.mid(3 * cAmmoNumber, cAmmoNumber))); |
103 if(gamecfg->schemeData(15).toBool() || !gamecfg->schemeData(21).toBool()) HWProto::addStringToBuffer(buf, QString("eammstore")); |
118 if(gamecfg->schemeData(15).toBool() || !gamecfg->schemeData(21).toBool()) HWProto::addStringToBuffer(buf, QString("eammstore")); |
104 HWProto::addStringListToBuffer(buf, |
119 HWProto::addStringListToBuffer(buf, |
105 team.teamGameConfig(gamecfg->getInitHealth())); |
120 team.teamGameConfig(gamecfg->getInitHealth(), config)); |
106 ; |
121 ; |
107 } |
122 } |
108 } |
123 } |
|
124 |
109 RawSendIPC(buf); |
125 RawSendIPC(buf); |
110 } |
126 } |
111 |
127 |
112 void HWGame::SendConfig() |
128 void HWGame::SendConfig() |
113 { |
129 { |
116 |
132 |
117 void HWGame::SendQuickConfig() |
133 void HWGame::SendQuickConfig() |
118 { |
134 { |
119 QByteArray teamscfg; |
135 QByteArray teamscfg; |
120 ThemeModel * themeModel = DataManager::instance().themeModel(); |
136 ThemeModel * themeModel = DataManager::instance().themeModel(); |
|
137 |
|
138 addKeyBindings(&teamscfg); |
121 |
139 |
122 HWProto::addStringToBuffer(teamscfg, "TL"); |
140 HWProto::addStringToBuffer(teamscfg, "TL"); |
123 HWProto::addStringToBuffer(teamscfg, QString("etheme %1") |
141 HWProto::addStringToBuffer(teamscfg, QString("etheme %1") |
124 .arg((themeModel->rowCount() > 0) ? themeModel->index(rand() % themeModel->rowCount()).data().toString() : "steel")); |
142 .arg((themeModel->rowCount() > 0) ? themeModel->index(rand() % themeModel->rowCount()).data().toString() : "steel")); |
125 HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString()); |
143 HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString()); |
130 team1.setDifficulty(0); |
148 team1.setDifficulty(0); |
131 team1.setColor(0); |
149 team1.setColor(0); |
132 team1.setNumHedgehogs(4); |
150 team1.setNumHedgehogs(4); |
133 HWNamegen::teamRandomNames(team1,true); |
151 HWNamegen::teamRandomNames(team1,true); |
134 HWProto::addStringListToBuffer(teamscfg, |
152 HWProto::addStringListToBuffer(teamscfg, |
135 team1.teamGameConfig(100)); |
153 team1.teamGameConfig(100, config)); |
136 |
154 |
137 HWTeam team2; |
155 HWTeam team2; |
138 team2.setDifficulty(4); |
156 team2.setDifficulty(4); |
139 team2.setColor(1); |
157 team2.setColor(1); |
140 team2.setNumHedgehogs(4); |
158 team2.setNumHedgehogs(4); |
141 do |
159 do |
142 HWNamegen::teamRandomNames(team2,true); |
160 HWNamegen::teamRandomNames(team2,true); |
143 while(!team2.name().compare(team1.name()) || !team2.hedgehog(0).Hat.compare(team1.hedgehog(0).Hat)); |
161 while(!team2.name().compare(team1.name()) || !team2.hedgehog(0).Hat.compare(team1.hedgehog(0).Hat)); |
144 HWProto::addStringListToBuffer(teamscfg, |
162 HWProto::addStringListToBuffer(teamscfg, |
145 team2.teamGameConfig(100)); |
163 team2.teamGameConfig(100, config)); |
146 |
164 |
147 HWProto::addStringToBuffer(teamscfg, QString("eammloadt %1").arg(cDefaultAmmoStore->mid(0, cAmmoNumber))); |
165 HWProto::addStringToBuffer(teamscfg, QString("eammloadt %1").arg(cDefaultAmmoStore->mid(0, cAmmoNumber))); |
148 HWProto::addStringToBuffer(teamscfg, QString("eammprob %1").arg(cDefaultAmmoStore->mid(cAmmoNumber, cAmmoNumber))); |
166 HWProto::addStringToBuffer(teamscfg, QString("eammprob %1").arg(cDefaultAmmoStore->mid(cAmmoNumber, cAmmoNumber))); |
149 HWProto::addStringToBuffer(teamscfg, QString("eammdelay %1").arg(cDefaultAmmoStore->mid(2 * cAmmoNumber, cAmmoNumber))); |
167 HWProto::addStringToBuffer(teamscfg, QString("eammdelay %1").arg(cDefaultAmmoStore->mid(2 * cAmmoNumber, cAmmoNumber))); |
150 HWProto::addStringToBuffer(teamscfg, QString("eammreinf %1").arg(cDefaultAmmoStore->mid(3 * cAmmoNumber, cAmmoNumber))); |
168 HWProto::addStringToBuffer(teamscfg, QString("eammreinf %1").arg(cDefaultAmmoStore->mid(3 * cAmmoNumber, cAmmoNumber))); |
151 HWProto::addStringToBuffer(teamscfg, QString("eammstore")); |
169 HWProto::addStringToBuffer(teamscfg, QString("eammstore")); |
152 HWProto::addStringToBuffer(teamscfg, QString("eammstore")); |
170 HWProto::addStringToBuffer(teamscfg, QString("eammstore")); |
|
171 |
153 RawSendIPC(teamscfg); |
172 RawSendIPC(teamscfg); |
154 } |
173 } |
155 |
174 |
156 void HWGame::SendTrainingConfig() |
175 void HWGame::SendTrainingConfig() |
157 { |
176 { |
158 QByteArray traincfg; |
177 QByteArray traincfg; |
159 HWProto::addStringToBuffer(traincfg, "TL"); |
178 HWProto::addStringToBuffer(traincfg, "TL"); |
160 HWProto::addStringToBuffer(traincfg, "eseed " + QUuid::createUuid().toString()); |
179 HWProto::addStringToBuffer(traincfg, "eseed " + QUuid::createUuid().toString()); |
161 HWProto::addStringToBuffer(traincfg, "escript " + training); |
180 HWProto::addStringToBuffer(traincfg, "escript " + training); |
162 |
181 |
|
182 addKeyBindings(&traincfg); |
|
183 |
163 RawSendIPC(traincfg); |
184 RawSendIPC(traincfg); |
164 } |
185 } |
165 |
186 |
166 void HWGame::SendCampaignConfig() |
187 void HWGame::SendCampaignConfig() |
167 { |
188 { |
168 QByteArray campaigncfg; |
189 QByteArray campaigncfg; |
169 HWProto::addStringToBuffer(campaigncfg, "TL"); |
190 HWProto::addStringToBuffer(campaigncfg, "TL"); |
170 HWProto::addStringToBuffer(campaigncfg, "eseed " + QUuid::createUuid().toString()); |
191 HWProto::addStringToBuffer(campaigncfg, "eseed " + QUuid::createUuid().toString()); |
171 |
192 |
172 HWProto::addStringToBuffer(campaigncfg, "escript " + campaignScript); |
193 HWProto::addStringToBuffer(campaigncfg, "escript " + campaignScript); |
|
194 |
|
195 addKeyBindings(&campaigncfg); |
173 |
196 |
174 RawSendIPC(campaigncfg); |
197 RawSendIPC(campaigncfg); |
175 } |
198 } |
176 |
199 |
177 void HWGame::SendNetConfig() |
200 void HWGame::SendNetConfig() |