Kicking players at the beginning of a network game now works.

This commit is contained in:
lotodore
2007-06-07 21:19:06 +00:00
parent f886ebda86
commit fb274284f5
14 changed files with 122 additions and 45 deletions
-2
View File
@@ -444,8 +444,6 @@ void Log::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int card
void Log::logPlayerLeftMsg(QString playerName) {
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
myW->textBrowser_Log->append( "<i>"+playerName+" has left the game!</i>");
if(myConfig->readConfigInt("LogOnOff")) {
+6
View File
@@ -720,6 +720,7 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
// gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
gameData.guiSpeed = 4;
myStartNetworkGameDialog->setSession(&myServerGuiInterface->getSession());
myStartNetworkGameDialog->treeWidget->clear();
myServerGuiInterface->getSession().startNetworkServer(gameData);
@@ -2482,6 +2483,11 @@ void mainWindowImpl::networkError(int errorID, int osErrorID) {
tr("The server referred to an unknown player. Aborting."),
QMessageBox::Close); }
break;
case ERR_NET_PLAYER_KICKED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("You were kicked from the server."),
QMessageBox::Close); }
break;
default: { QMessageBox::warning(this, tr("Network Error"),
tr("An internal error occured."),
QMessageBox::Close); }
@@ -21,12 +21,10 @@
#include "session.h"
#include "configfile.h"
startNetworkGameDialogImpl::startNetworkGameDialogImpl(QWidget *parent, ConfigFile *config, Session *session)
: QDialog(parent), myConfig(config), mySession(session)
startNetworkGameDialogImpl::startNetworkGameDialogImpl(QWidget *parent, ConfigFile *config)
: QDialog(parent), myConfig(config)
{
assert(mySession);
setupUi(this);
setupUi(this);
connect( pushButton_cancel, SIGNAL( clicked() ), this, SLOT( cancel() ) );
connect( pushButton_startGame, SIGNAL( clicked() ), this, SLOT( startGame() ) );
@@ -81,7 +79,8 @@ void startNetworkGameDialogImpl::kickPlayer() {
QMessageBox::Close); }
}
else {
// kickplayerFunktion(playerName.toStdString());
assert(mySession);
mySession->kickPlayer(playerName.toUtf8().constData());
}
}
pushButton_Kick->setEnabled(FALSE);
@@ -94,6 +93,11 @@ void startNetworkGameDialogImpl::checkPlayerQuantity() {
}
void startNetworkGameDialogImpl::setSession(Session *session)
{
mySession = session;
}
void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event ) {
@@ -31,7 +31,7 @@ class ConfigFile;
class startNetworkGameDialogImpl: public QDialog, public Ui::startNetworkGameDialog {
Q_OBJECT
public:
startNetworkGameDialogImpl(QWidget *parent = 0, ConfigFile *config = 0, Session *session = 0);
startNetworkGameDialogImpl(QWidget *parent = 0, ConfigFile *config = 0);
public slots:
@@ -43,6 +43,8 @@ public slots:
void kickPlayer();
void checkPlayerQuantity();
void setSession(Session *session);
void keyPressEvent ( QKeyEvent*);
void setMaxPlayerNumber ( int theValue ) { maxPlayerNumber = theValue; label_maxPlayerNumber->setText(QString::number(theValue,10)); }