QTfrontend/game.cpp
branchflibqtfrontend
changeset 8130 4cab13c82b4e
parent 8128 ebef2de30c18
child 8133 2d0f56423eb3
equal deleted inserted replaced
8128:ebef2de30c18 8130:4cab13c82b4e
   343     gameSetup.style = NULL;
   343     gameSetup.style = NULL;
   344     gameSetup.gamescheme = flib_scheme_create("Default");
   344     gameSetup.gamescheme = flib_scheme_create("Default");
   345     gameSetup.map = flib_map_create_regular(
   345     gameSetup.map = flib_map_create_regular(
   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                 , 2);
   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);
   366     QList<flib_team *> teams;
   366     QList<flib_team *> teams;
   367     teams << team1.toFlibTeam() << team2.toFlibTeam();
   367     teams << team1.toFlibTeam() << team2.toFlibTeam();
   368 
   368 
   369     for(int i = 0; i < 2; ++i)
   369     for(int i = 0; i < 2; ++i)
   370     {
   370     {
   371         flib_weaponset *set = flib_weaponset_create("Default");
       
   372         flib_team *team = teams[i];
   371         flib_team *team = teams[i];
   373         team->hogsInGame = 4;
   372         team->hogsInGame = 4;
   374         team->remoteDriven = false;
   373         team->remoteDriven = false;
   375         for(int h = 0; h < HEDGEHOGS_PER_TEAM; ++h)
   374         for(int h = 0; h < HEDGEHOGS_PER_TEAM; ++h)
   376             team->hogs[h].weaponset = set;
   375         {
       
   376             team->hogs[h].weaponset = flib_weaponset_create("Default");
       
   377             team->hogs[h].initialHealth = 100;
       
   378         }
   377         flib_teamlist_insert(gameSetup.teamlist, team, 0);
   379         flib_teamlist_insert(gameSetup.teamlist, team, 0);
   378     }
   380     }
   379 
   381 
   380 
   382 
   381     m_conn = flib_gameconn_create(config->netNick().toUtf8().constData(), &gameSetup, false);
   383     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);
       
   385 
   384 
   386     flib_teamlist_destroy(gameSetup.teamlist);
   385     flib_teamlist_destroy(gameSetup.teamlist);
   387     flib_map_destroy(gameSetup.map);
   386     flib_map_destroy(gameSetup.map);
   388     flib_scheme_destroy(gameSetup.gamescheme);
   387     flib_scheme_destroy(gameSetup.gamescheme);
   389 
   388