346 QUuid::createUuid().toByteArray().constData() |
346 QUuid::createUuid().toByteArray().constData() |
347 , themeModel->rowCount() > 0 ? themeModel->index(rand() % themeModel->rowCount()).data().toString().toUtf8().constData() : "Sheep" |
347 , themeModel->rowCount() > 0 ? themeModel->index(rand() % themeModel->rowCount()).data().toString().toUtf8().constData() : "Sheep" |
348 , 3); |
348 , 3); |
349 gameSetup.teamlist = flib_teamlist_create(); |
349 gameSetup.teamlist = flib_teamlist_create(); |
350 |
350 |
351 { // add teams |
351 // add teams |
352 HWTeam team1; |
352 HWTeam team1; |
353 team1.setDifficulty(0); |
353 team1.setDifficulty(0); |
354 team1.setColor(0); |
354 team1.setColor(0); |
355 team1.setNumHedgehogs(4); |
355 team1.setNumHedgehogs(4); |
356 HWNamegen::teamRandomNames(team1, true); |
356 HWNamegen::teamRandomNames(team1, true); |
357 |
357 |
358 HWTeam team2; |
358 HWTeam team2; |
359 team2.setDifficulty(4); |
359 team2.setDifficulty(4); |
360 team2.setColor(1); |
360 team2.setColor(1); |
361 team2.setNumHedgehogs(4); |
361 team2.setNumHedgehogs(4); |
362 do |
362 do |
363 HWNamegen::teamRandomNames(team2,true); |
363 HWNamegen::teamRandomNames(team2,true); |
364 while(!team2.name().compare(team1.name()) || !team2.hedgehogHat(0).compare(team1.hedgehogHat(0))); |
364 while(!team2.name().compare(team1.name()) || !team2.hedgehogHat(0).compare(team1.hedgehogHat(0))); |
365 |
365 |
366 flib_teamlist_insert(gameSetup.teamlist, team1.toFlibTeam(), 0); |
366 QList<flib_team *> teams; |
367 flib_teamlist_insert(gameSetup.teamlist, team2.toFlibTeam(), 1); |
367 teams << team1.toFlibTeam() << team2.toFlibTeam(); |
368 } |
368 |
|
369 for(int i = 0; i < 2; ++i) |
|
370 { |
|
371 flib_weaponset *set = flib_weaponset_create("Default"); |
|
372 flib_team *team = teams[i]; |
|
373 team->hogsInGame = 4; |
|
374 team->remoteDriven = false; |
|
375 for(int h = 0; h < HEDGEHOGS_PER_TEAM; ++h) |
|
376 team->hogs[h].weaponset = set; |
|
377 flib_teamlist_insert(gameSetup.teamlist, team, 0); |
|
378 } |
|
379 |
369 |
380 |
370 m_conn = flib_gameconn_create(config->netNick().toUtf8().constData(), &gameSetup, false); |
381 m_conn = flib_gameconn_create(config->netNick().toUtf8().constData(), &gameSetup, false); |
|
382 |
|
383 for(int i = 0; i < 2; ++i) |
|
384 flib_weaponset_destroy(teams[i]->hogs[0].weaponset); |
371 |
385 |
372 flib_teamlist_destroy(gameSetup.teamlist); |
386 flib_teamlist_destroy(gameSetup.teamlist); |
373 flib_map_destroy(gameSetup.map); |
387 flib_map_destroy(gameSetup.map); |
374 flib_scheme_destroy(gameSetup.gamescheme); |
388 flib_scheme_destroy(gameSetup.gamescheme); |
375 |
389 |