93 commonConfig(); |
94 commonConfig(); |
94 } |
95 } |
95 |
96 |
96 void HWGame::SendQuickConfig() |
97 void HWGame::SendQuickConfig() |
97 { |
98 { |
98 commonConfig(); |
|
99 |
|
100 QByteArray teamscfg; |
99 QByteArray teamscfg; |
|
100 |
|
101 HWProto::addStringToBuffer(teamscfg, "TL"); |
|
102 HWProto::addStringToBuffer(teamscfg, QString("etheme %1") |
|
103 .arg((Themes->size() > 0) ? Themes->at(rand() % Themes->size()) : "steel")); |
|
104 HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString()); |
|
105 |
101 HWTeam team1(0); |
106 HWTeam team1(0); |
102 team1.difficulty = 0; |
107 team1.difficulty = 0; |
103 team1.teamColor = *color1; |
108 team1.teamColor = *color1; |
104 team1.numHedgehogs = 4; |
109 team1.numHedgehogs = 4; |
105 HWProto::addStringListToBuffer(teamscfg, |
110 HWProto::addStringListToBuffer(teamscfg, |
106 team1.TeamGameConfig(gamecfg->getInitHealth())); |
111 team1.TeamGameConfig(100)); |
107 |
112 |
108 HWTeam team2(2); |
113 HWTeam team2(2); |
109 team2.difficulty = 4; |
114 team2.difficulty = 4; |
110 team2.teamColor = *color2; |
115 team2.teamColor = *color2; |
111 team2.numHedgehogs = 4; |
116 team2.numHedgehogs = 4; |
112 HWProto::addStringListToBuffer(teamscfg, |
117 HWProto::addStringListToBuffer(teamscfg, |
113 team2.TeamGameConfig(gamecfg->getInitHealth())); |
118 team2.TeamGameConfig(100)); |
114 |
119 |
115 HWProto::addStringToBuffer(teamscfg, *cDefaultAmmoStore); |
120 HWProto::addStringToBuffer(teamscfg, *cDefaultAmmoStore); |
116 HWProto::addStringToBuffer(teamscfg, *cDefaultAmmoStore); |
121 HWProto::addStringToBuffer(teamscfg, *cDefaultAmmoStore); |
117 RawSendIPC(teamscfg); |
122 RawSendIPC(teamscfg); |
118 } |
123 } |
119 |
124 |
120 void HWGame::SendTrainingConfig() |
125 void HWGame::SendTrainingConfig() |
121 { |
126 { |
122 QByteArray teamscfg; |
127 QByteArray traincfg; |
123 HWProto::addStringToBuffer(teamscfg, "TL"); |
128 HWProto::addStringToBuffer(traincfg, "TL"); |
124 |
129 |
125 HWTeam team1(0); |
130 HWTeam team1(0); |
126 team1.difficulty = 0; |
131 team1.difficulty = 0; |
127 team1.teamColor = *color1; |
132 team1.teamColor = *color1; |
128 team1.numHedgehogs = 1; |
133 team1.numHedgehogs = 1; |
129 HWProto::addStringListToBuffer(teamscfg, |
134 HWProto::addStringListToBuffer(traincfg, |
130 team1.TeamGameConfig(100)); |
135 team1.TeamGameConfig(100)); |
131 |
136 |
132 QFile file(datadir->absolutePath() + "/Trainings/001_Shotgun.txt"); |
137 QFile file(datadir->absolutePath() + "/Trainings/001_Shotgun.txt"); |
133 if(!file.open(QFile::ReadOnly)) |
138 if(!file.open(QFile::ReadOnly)) |
134 { |
139 { |
299 } |
304 } |
300 |
305 |
301 void HWGame::StartLocal() |
306 void HWGame::StartLocal() |
302 { |
307 { |
303 gameType = gtLocal; |
308 gameType = gtLocal; |
304 seed = gamecfg->getCurrentSeed(); |
|
305 demo.clear(); |
309 demo.clear(); |
306 Start(); |
310 Start(); |
307 SetGameState(gsStarted); |
311 SetGameState(gsStarted); |
308 } |
312 } |
309 |
313 |
310 void HWGame::StartQuick() |
314 void HWGame::StartQuick() |
311 { |
315 { |
312 gameType = gtQLocal; |
316 gameType = gtQLocal; |
313 seed = gamecfg->getCurrentSeed(); |
|
314 demo.clear(); |
317 demo.clear(); |
315 Start(); |
318 Start(); |
316 SetGameState(gsStarted); |
319 SetGameState(gsStarted); |
317 } |
320 } |
318 |
321 |
319 void HWGame::StartTraining() |
322 void HWGame::StartTraining() |
320 { |
323 { |
321 gameType = gtTraining; |
324 gameType = gtTraining; |
322 seed = "training"; |
|
323 demo.clear(); |
325 demo.clear(); |
324 Start(); |
326 Start(); |
325 SetGameState(gsStarted); |
327 SetGameState(gsStarted); |
326 } |
328 } |
327 |
329 |