QTfrontend/game.cpp
branchflibqtfrontend
changeset 8280 734b069a418e
parent 8276 d4e113e745a9
child 8282 1f81bcce3ee6
equal deleted inserted replaced
8278:9cdfcb5b7ddd 8280:734b069a418e
    37 
    37 
    38 HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) :
    38 HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) :
    39     TCPBase(0)
    39     TCPBase(0)
    40     , ammostr(ammo)
    40     , ammostr(ammo)
    41     , m_pTeamSelWidget(pTeamSelWidget)
    41     , m_pTeamSelWidget(pTeamSelWidget)
    42     , m_conn(NULL)
    42     , m_conn(0)
       
    43     , m_poller(0)
    43 {
    44 {
    44     this->config = config;
    45     this->config = config;
    45     this->gamecfg = gamecfg;
    46     this->gamecfg = gamecfg;
    46     netSuspend = false;
    47     netSuspend = false;
    47 }
    48 }
   460                 else if (gameState == gsFinished)
   461                 else if (gameState == gsFinished)
   461                     emit HaveRecord(rtDemo, demo);
   462                     emit HaveRecord(rtDemo, demo);
   462                 else
   463                 else
   463                     emit HaveRecord(rtNeither, demo);
   464                     emit HaveRecord(rtNeither, demo);
   464         }*/
   465         }*/
       
   466 
   465      game->SetGameState(gsStopped);
   467      game->SetGameState(gsStopped);
       
   468 
       
   469      delete game->m_poller;
   466 }
   470 }
   467 
   471 
   468 void HWGame::onEngineMessage(void *context, const uint8_t *em, size_t size)
   472 void HWGame::onEngineMessage(void *context, const uint8_t *em, size_t size)
   469 {
   473 {
   470     HWGame * game = (HWGame *) context;
   474     HWGame * game = (HWGame *) context;
   487     flib_gameconn_onDisconnect(m_conn, onDisconnect, this);
   491     flib_gameconn_onDisconnect(m_conn, onDisconnect, this);
   488     flib_gameconn_onEngineMessage(m_conn, onEngineMessage, this);
   492     flib_gameconn_onEngineMessage(m_conn, onEngineMessage, this);
   489     flib_gameconn_onErrorMessage(m_conn, onErrorMessage, this);
   493     flib_gameconn_onErrorMessage(m_conn, onErrorMessage, this);
   490     flib_gameconn_onGameRecorded(m_conn, onGameRecorded, this);
   494     flib_gameconn_onGameRecorded(m_conn, onGameRecorded, this);
   491 
   495 
   492     new FrontLibPoller((void (*)(void *))flib_gameconn_tick, m_conn, this);
   496     m_poller = new FrontLibPoller((void (*)(void *))flib_gameconn_tick, m_conn, this);
   493 }
   497 }