# HG changeset patch
# User unc0rr
# Date 1353961781 -14400
# Node ID 4cab13c82b4ee8883c9c270e5d05dae91166b6d3
# Parent  ebef2de30c18cef40fdbc8f6633358ffeb3ddf5b
No more crashes when running quick game

diff -r ebef2de30c18 -r 4cab13c82b4e QTfrontend/game.cpp
--- a/QTfrontend/game.cpp	Mon Nov 26 00:28:47 2012 +0400
+++ b/QTfrontend/game.cpp	Tue Nov 27 00:29:41 2012 +0400
@@ -345,7 +345,7 @@
     gameSetup.map = flib_map_create_regular(
                 QUuid::createUuid().toByteArray().constData()
                 , themeModel->rowCount() > 0 ? themeModel->index(rand() % themeModel->rowCount()).data().toString().toUtf8().constData() : "Sheep"
-                , 3);
+                , 2);
     gameSetup.teamlist = flib_teamlist_create();
 
     // add teams
@@ -368,21 +368,20 @@
 
     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;
+        {
+            team->hogs[h].weaponset = flib_weaponset_create("Default");
+            team->hogs[h].initialHealth = 100;
+        }
         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);
diff -r ebef2de30c18 -r 4cab13c82b4e QTfrontend/team.cpp
--- a/QTfrontend/team.cpp	Mon Nov 26 00:28:47 2012 +0400
+++ b/QTfrontend/team.cpp	Tue Nov 27 00:29:41 2012 +0400
@@ -221,7 +221,7 @@
 {
     free(m_team->name);
 
-    m_team->name = qstrdup(name.toUtf8().constData());
+    m_team->name = strdup(name.toUtf8().constData());
 }
 
 QString HWTeam::hedgehogName(int index) const
@@ -238,14 +238,14 @@
 {
     free(m_team->hogs[index].name);
 
-    m_team->hogs[index].name = qstrdup(name.toUtf8().constData());
+    m_team->hogs[index].name = strdup(name.toUtf8().constData());
 }
 
 void HWTeam::setHedgehogHat(int index, const QString & hat)
 {
     free(m_team->hogs[index].hat);
 
-    m_team->hogs[index].hat = qstrdup(hat.toUtf8().constData());
+    m_team->hogs[index].hat = strdup(hat.toUtf8().constData());
 }
 
 
@@ -296,7 +296,7 @@
 {
     free(m_team->bindings[idx].binding);
 
-    m_team->bindings[idx].binding = qstrdup(key.toUtf8().constData());
+    m_team->bindings[idx].binding = strdup(key.toUtf8().constData());
 }
 
 // flag
@@ -381,5 +381,5 @@
 
 flib_team * HWTeam::toFlibTeam()
 {
-    return m_team;
+    return flib_team_copy(m_team);
 }
diff -r ebef2de30c18 -r 4cab13c82b4e QTfrontend/ui/widget/mapContainer.cpp
--- a/QTfrontend/ui/widget/mapContainer.cpp	Mon Nov 26 00:28:47 2012 +0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Tue Nov 27 00:29:41 2012 +0400
@@ -44,6 +44,7 @@
     mapgen(MAPGEN_REGULAR),
     m_previewSize(256, 128)
 {
+    m_mapInfo.type = MapModel::GeneratedMap;
     hhSmall.load(":/res/hh_small.png");
     hhLimit = 18;
     templateFilter = 0;