More fixes. Using player name as base for game name now. Removing games which have no players left. Check collision of all player names on connect (kind of slow, but name needs to be unique).

This commit is contained in:
lotodore
2007-08-21 17:27:13 +00:00
parent 3e4b134faa
commit 3a2f3255af
10 changed files with 120 additions and 15 deletions
@@ -21,6 +21,9 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
connect( treeWidget_GameList, SIGNAL( itemClicked ( QTreeWidgetItem*, int) ), this, SLOT( gameSelected(QTreeWidgetItem*, int) ) );
pushButton_JoinGame->setEnabled(false);
}
void gameLobbyDialogImpl::exec()
@@ -53,18 +56,28 @@ void gameLobbyDialogImpl::createGame()
//Speeds
gameData.guiSpeed = myConfig->readConfigInt("GameSpeed");
mySession->clientCreateGame(gameData, "default", "");
mySession->clientCreateGame(gameData, myConfig->readConfigString("MyName") + "'s game", "");
accept();
}
void gameLobbyDialogImpl::joinGame()
{
assert(mySession);
QTreeWidgetItem *item = treeWidget_GameList->currentItem();
if (item)
{
QString gameName = item->text(0);
mySession->clientJoinGame("default", "");
assert(mySession);
mySession->clientJoinGame(gameName.toUtf8().constData(), "");
accept();
accept();
}
}
void gameLobbyDialogImpl::gameSelected(QTreeWidgetItem*, int)
{
pushButton_JoinGame->setEnabled(true);
}
void gameLobbyDialogImpl::addGame(QString gameName)
@@ -39,6 +39,8 @@ public slots:
void createGame();
void joinGame();
void gameSelected(QTreeWidgetItem*, int);
void addGame(QString gameName);
void removeGame(QString gameName);
@@ -32,8 +32,8 @@ startNetworkGameDialogImpl::startNetworkGameDialogImpl(QWidget *parent, ConfigFi
connect( pushButton_Kick, SIGNAL( clicked() ), this, SLOT( kickPlayer() ) );
connect( treeWidget, SIGNAL( itemClicked ( QTreeWidgetItem*, int) ), this, SLOT( playerSelected(QTreeWidgetItem*, int) ) );
pushButton_Kick->setEnabled(FALSE);
pushButton_startGame->setEnabled(FALSE);
pushButton_Kick->setEnabled(false);
pushButton_startGame->setEnabled(false);
}
void startNetworkGameDialogImpl::startGame() {