# HG changeset patch # User nemo # Date 1290966957 18000 # Node ID 2bc3d3475edf93803cacea02b07e239f88cf2674 # Parent c5193713055f5c105f600f008543346b8b150dc8 Try to kill off all teams if the player returns to the lobby in mid-game. Also leave game room open for admins to kick/restrict joins etc. NEEDS TESTING PROBABLY BROKE SOMETHING OR OTHER diff -r c5193713055f -r 2bc3d3475edf QTfrontend/game.cpp --- a/QTfrontend/game.cpp Sun Nov 28 19:03:28 2010 +0300 +++ b/QTfrontend/game.cpp Sun Nov 28 12:55:57 2010 -0500 @@ -377,3 +377,15 @@ gameState = state; emit GameStateChanged(state); } + +void HWGame::KillAllTeams() +{ + if (m_pTeamSelWidget) + { + QByteArray buf; + QList teams = m_pTeamSelWidget->getPlayingTeams(); + for(QList::iterator it = teams.begin(); it != teams.end(); ++it) + HWProto::addStringToBuffer(buf, QString("eteamgone %1").arg((*it).TeamName)); + RawSendIPC(buf); + } +} diff -r c5193713055f -r 2bc3d3475edf QTfrontend/game.h --- a/QTfrontend/game.h Sun Nov 28 19:03:28 2010 +0300 +++ b/QTfrontend/game.h Sun Nov 28 12:55:57 2010 -0500 @@ -53,6 +53,8 @@ void StartNet(); void StartTraining(const QString & file); void StartCampaign(const QString & file); + void KillAllTeams(); + GameState gameState; protected: virtual QStringList setArguments(); @@ -89,7 +91,6 @@ GameCFGWidget * gamecfg; TeamSelWidget* m_pTeamSelWidget; GameType gameType; - GameState gameState; void commonConfig(); void SendConfig(); diff -r c5193713055f -r 2bc3d3475edf QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Sun Nov 28 19:03:28 2010 +0300 +++ b/QTfrontend/hwform.cpp Sun Nov 28 12:55:57 2010 -0500 @@ -509,8 +509,13 @@ if(id == ID_PAGE_NETGAME) // joining a room ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text()); - else if(id == ID_PAGE_ROOMSLIST) // joining the lobby +// joining the lobby + else if(id == ID_PAGE_ROOMSLIST) { + if ( game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills. + game->KillAllTeams(); + } ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text()); + } } void HWForm::GoToPage(quint8 id) @@ -936,7 +941,7 @@ case gsStarted: { Music(false); if (wBackground) wBackground->stopAnimation(); - GoToPage(ID_PAGE_INGAME); + if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoToPage(ID_PAGE_INGAME); ui.pageGameStats->clear(); if (pRegisterServer) { @@ -950,7 +955,7 @@ case gsFinished: { //setVisible(true); setFocusPolicy(Qt::StrongFocus); - GoBack(); + if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoBack(); Music(ui.pageOptions->CBEnableFrontendMusic->isChecked()); if (wBackground) wBackground->startAnimation(); GoToPage(ID_PAGE_GAMESTATS); @@ -961,8 +966,11 @@ //setVisible(true); setFocusPolicy(Qt::StrongFocus); quint8 id = ui.Pages->currentIndex(); - if (id == ID_PAGE_INGAME) { - GoBack(); + if (id == ID_PAGE_INGAME || +// was room chief and the game was aborted + (hwnet && hwnet->isRoomChief() && hwnet->isInRoom() && + (gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed))) { + if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoBack(); Music(ui.pageOptions->CBEnableFrontendMusic->isChecked()); if (wBackground) wBackground->startAnimation(); if (hwnet) hwnet->gameFinished();