[atlantik-cvs] CVS: kdegames/atlantik/client atlantik.cpp, 1.157.2.3, 1.157.2.4 main.h, 1.40.2.3, 1.40.2.4 selectconfiguration_widget.cpp, 1.39.2.1, 1.39.2.2 selectconfiguration_widget.h, 1.19.2.1, 1.19.2.2
[email protected] Mon, 17 Nov 2003 03:50:44 +0100 (CET)
| Newsgroups | gmane.comp.kde.devel.atlantik |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv10286/client
Modified Files:
Tag: atlantik_3_3_branch
atlantik.cpp main.h selectconfiguration_widget.cpp
selectconfiguration_widget.h
Log Message:
more gameupdate changes, game master is now a server-wide property
Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.157.2.3
retrieving revision 1.157.2.4
diff -u -d -r1.157.2.3 -r1.157.2.4
--- atlantik.cpp 15 Nov 2003 22:09:06 -0000 1.157.2.3
+++ atlantik.cpp 17 Nov 2003 02:50:41 -0000 1.157.2.4
@@ -317,9 +317,7 @@
m_selectGame = 0;
}
- Player *playerSelf = m_atlanticCore->playerSelf();
- m_selectConfiguration = new SelectConfiguration(m_mainWidget, "selectConfiguration");
- m_selectConfiguration->setCanStart(playerSelf ? playerSelf->master() : false);
+ m_selectConfiguration = new SelectConfiguration(m_atlanticCore, m_mainWidget, "selectConfiguration");
m_mainLayout->addMultiCellWidget(m_selectConfiguration, 0, 2, 1, 1);
m_selectConfiguration->show();
@@ -590,19 +588,19 @@
if (player == playerSelf)
{
// We changed ourselves, see if other players (that we know
- // about) have the same gameId..
+ // about) have the same game..
PortfolioView *portfolioView = 0;
for (QPtrListIterator<PortfolioView> it(m_portfolioViews); *it; ++it)
if ((portfolioView = dynamic_cast<PortfolioView*>(*it)))
{
Player *pTmp = portfolioView->player();
- if (pTmp->gameId() == playerSelf->gameId())
+ if (pTmp->game() == playerSelf->game())
portfolioView->show();
else
portfolioView->hide();
}
- if (player->gameId() == -1)
+ if (!player->game())
showSelectGame();
else
{
@@ -610,9 +608,6 @@
showSelectConfiguration();
}
- if (m_selectConfiguration)
- m_selectConfiguration->setCanStart(player->master());
-
m_roll->setEnabled(player->canRoll());
m_buyEstate->setEnabled(player->canBuy());
m_auctionEstate->setEnabled(player->canAuction());
@@ -629,12 +624,12 @@
// his/her portfolioView.
if (playerSelf)
{
- if (player->gameId() == playerSelf->gameId())
+ if (player->game() == playerSelf->game())
portfolioView->show();
else
portfolioView->hide();
}
- else if (player->gameId() == -1)
+ else if ( !player->game() )
portfolioView->hide();
}
}
Index: main.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/main.h,v
retrieving revision 1.40.2.3
retrieving revision 1.40.2.4
diff -u -d -r1.40.2.3 -r1.40.2.4
--- main.h 15 Nov 2003 22:09:06 -0000 1.40.2.3
+++ main.h 17 Nov 2003 02:50:41 -0000 1.40.2.4
@@ -18,7 +18,7 @@
#define ATLANTIK_MAIN_H
#define ATLANTIK_VERSION 070
-#define ATLANTIK_VERSION_STRING "0.7.0 (CVS >= 20031115)"
+#define ATLANTIK_VERSION_STRING "0.7.0 (CVS >= 20031117)"
#define ATLANTIK_VERSION_MAJOR 0
#define ATLANTIK_VERSION_MINOR 7
Index: selectconfiguration_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectconfiguration_widget.cpp,v
retrieving revision 1.39.2.1
retrieving revision 1.39.2.2
diff -u -d -r1.39.2.1 -r1.39.2.2
--- selectconfiguration_widget.cpp 15 Nov 2003 13:31:04 -0000 1.39.2.1
+++ selectconfiguration_widget.cpp 17 Nov 2003 02:50:42 -0000 1.39.2.2
@@ -26,14 +26,18 @@
#include <kmessagebox.h>
#include <kstandarddirs.h>
+#include <atlantic_core.h>
+#include <game.h>
#include <player.h>
#include "tokenwidget.h"
#include "selectconfiguration_widget.moc"
-SelectConfiguration::SelectConfiguration(QWidget *parent, const char *name) : QWidget(parent, name)
+SelectConfiguration::SelectConfiguration(AtlanticCore *atlanticCore, QWidget *parent, const char *name) : QWidget(parent, name)
{
+ m_atlanticCore = atlanticCore;
m_tokenWidget = 0;
+ m_game = 0;
m_mainLayout = new QVBoxLayout(this, KDialog::marginHint());
Q_CHECK_PTR(m_mainLayout);
@@ -69,9 +73,14 @@
m_startButton = new KPushButton(SmallIcon("forward"), i18n("Start Game"), this);
serverButtons->addWidget(m_startButton);
+ m_startButton->setEnabled(false);
connect(m_startButton, SIGNAL(clicked()), this, SIGNAL(startGame()));
+ Player *playerSelf = m_atlanticCore->playerSelf();
+ playerChanged(playerSelf);
+ connect(playerSelf, SIGNAL(changed(Player *)), this, SLOT(playerChanged(Player *)));
+
emit statusMessage(i18n("Retrieving configuration list..."));
}
@@ -145,7 +154,26 @@
emit statusMessage(i18n("Retrieved configuration list."));
}
-void SelectConfiguration::setCanStart(const bool &canStart)
+void SelectConfiguration::playerChanged(Player *player)
{
- m_startButton->setEnabled(canStart);
+ kdDebug() << "playerChanged" << endl;
+
+ if (player->game() != m_game)
+ {
+ kdDebug() << "playerChanged::change" << endl;
+
+ if (m_game)
+ disconnect(m_game, SIGNAL(changed(Game *)), this, SLOT(gameChanged(Game *)));
+
+ m_game = player->game();
+
+ if (m_game)
+ connect(m_game, SIGNAL(changed(Game *)), this, SLOT(gameChanged(Game *)));
+ }
+}
+
+void SelectConfiguration::gameChanged(Game *game)
+{
+ kdDebug() << "gameChanged" << endl;
+ m_startButton->setEnabled( game->master() == m_atlanticCore->playerSelf() );
}
Index: selectconfiguration_widget.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectconfiguration_widget.h,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -u -d -r1.19.2.1 -r1.19.2.2
--- selectconfiguration_widget.h 15 Nov 2003 13:31:04 -0000 1.19.2.1
+++ selectconfiguration_widget.h 17 Nov 2003 02:50:42 -0000 1.19.2.2
@@ -27,6 +27,8 @@
class QCheckBox;
class QListViewItem;
+class AtlanticCore;
+class Game;
class Player;
class TokenWidget;
@@ -35,7 +37,7 @@
Q_OBJECT
public:
- SelectConfiguration(QWidget *parent, const char *name=0);
+ SelectConfiguration(AtlanticCore *atlanticCore, QWidget *parent, const char *name=0);
void setCanStart(const bool &canStart);
QString hostToConnect() const;
@@ -48,6 +50,8 @@
void optionChanged();
void slotEndUpdate();
void initGame();
+ void playerChanged(Player *player);
+ void gameChanged(Game *game);
signals:
void startGame();
@@ -65,6 +69,8 @@
QMap <QObject *, QString> m_optionCommandMap;
QMap <QString, QCheckBox *> m_checkBoxMap;
QMap <Player *, QListViewItem *> m_items;
+ Game *m_game;
+ AtlanticCore *m_atlanticCore;
TokenWidget *m_tokenWidget;
};