Fixed crash when creating a network game.

This commit is contained in:
lotodore
2007-09-01 21:15:11 +00:00
parent b9aeb5497a
commit 096c02dd24
2 changed files with 6 additions and 1 deletions
@@ -15,7 +15,7 @@
#include "gamedata.h"
gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
: QDialog(parent), myW(NULL), myConfig(c), currentGameName(""), isAdmin(false)
: QDialog(parent), myW(NULL), mySession(NULL), myConfig(c), currentGameName(""), isAdmin(false)
{
setupUi(this);
@@ -164,6 +164,7 @@ void gameLobbyDialogImpl::addConnectedPlayer(QString playerName, int rights) {
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedPlayers,0);
item->setData(0, 0, playerName);
assert(mySession);
GameInfo info = mySession->getClientGameInfo(currentGameName.toUtf8().constData());
if(treeWidget_connectedPlayers->topLevelItemCount() != info.data.maxNumberOfPlayers) {
+4
View File
@@ -785,6 +785,8 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value();
myGameLobbyDialog->setSession(&getSession());
myGameLobbyDialog->treeWidget_GameList->clear();
myStartNetworkGameDialog->setSession(&getSession());
myStartNetworkGameDialog->treeWidget->clear();
@@ -810,6 +812,8 @@ void mainWindowImpl::callJoinNetworkGameDialog() {
if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession());
myGameLobbyDialog->treeWidget_GameList->clear();
myStartNetworkGameDialog->setSession(&getSession());
myStartNetworkGameDialog->treeWidget->clear();
// Maybe use QUrl::toPunycode.