Try to setup weapon sets for quick game flibqtfrontend
authorunc0rr
Mon, 26 Nov 2012 00:28:47 +0400
branchflibqtfrontend
changeset 8128 ebef2de30c18
parent 8126 5bfa1b2025d6
child 8130 4cab13c82b4e
Try to setup weapon sets for quick game
QTfrontend/game.cpp
QTfrontend/team.cpp
--- a/QTfrontend/game.cpp	Mon Nov 26 00:09:54 2012 +0400
+++ b/QTfrontend/game.cpp	Mon Nov 26 00:28:47 2012 +0400
@@ -348,27 +348,41 @@
                 , 3);
     gameSetup.teamlist = flib_teamlist_create();
 
-    { // add teams
-        HWTeam team1;
-        team1.setDifficulty(0);
-        team1.setColor(0);
-        team1.setNumHedgehogs(4);
-        HWNamegen::teamRandomNames(team1, true);
+    // add teams
+    HWTeam team1;
+    team1.setDifficulty(0);
+    team1.setColor(0);
+    team1.setNumHedgehogs(4);
+    HWNamegen::teamRandomNames(team1, true);
 
-        HWTeam team2;
-        team2.setDifficulty(4);
-        team2.setColor(1);
-        team2.setNumHedgehogs(4);
-        do
-            HWNamegen::teamRandomNames(team2,true);
-        while(!team2.name().compare(team1.name()) || !team2.hedgehogHat(0).compare(team1.hedgehogHat(0)));
+    HWTeam team2;
+    team2.setDifficulty(4);
+    team2.setColor(1);
+    team2.setNumHedgehogs(4);
+    do
+        HWNamegen::teamRandomNames(team2,true);
+    while(!team2.name().compare(team1.name()) || !team2.hedgehogHat(0).compare(team1.hedgehogHat(0)));
 
-        flib_teamlist_insert(gameSetup.teamlist, team1.toFlibTeam(), 0);
-        flib_teamlist_insert(gameSetup.teamlist, team2.toFlibTeam(), 1);
+    QList<flib_team *> teams;
+    teams << team1.toFlibTeam() << team2.toFlibTeam();
+
+    for(int i = 0; i < 2; ++i)
+    {
+        flib_weaponset *set = flib_weaponset_create("Default");
+        flib_team *team = teams[i];
+        team->hogsInGame = 4;
+        team->remoteDriven = false;
+        for(int h = 0; h < HEDGEHOGS_PER_TEAM; ++h)
+            team->hogs[h].weaponset = set;
+        flib_teamlist_insert(gameSetup.teamlist, team, 0);
     }
 
+
     m_conn = flib_gameconn_create(config->netNick().toUtf8().constData(), &gameSetup, false);
 
+    for(int i = 0; i < 2; ++i)
+        flib_weaponset_destroy(teams[i]->hogs[0].weaponset);
+
     flib_teamlist_destroy(gameSetup.teamlist);
     flib_map_destroy(gameSetup.map);
     flib_scheme_destroy(gameSetup.gamescheme);
--- a/QTfrontend/team.cpp	Mon Nov 26 00:09:54 2012 +0400
+++ b/QTfrontend/team.cpp	Mon Nov 26 00:28:47 2012 +0400
@@ -64,9 +64,6 @@
     team.bindingCount = binds.size();
 
     m_team = flib_team_copy(&team);
-
-    m_team->remoteDriven = false;
-    m_team->hogsInGame = 4;
 }
 
 HWTeam::HWTeam(const QStringList& strLst, QObject *parent) :
@@ -121,8 +118,6 @@
     team.bindingCount = binds.size();
 
     m_team = flib_team_copy(&team);
-    m_team->remoteDriven = true;
-    m_team->hogsInGame = 4;
 }