Fixed "myW" problems (null pointer). Use gui interface to retrieve window pointer.
This commit is contained in:
@@ -36,7 +36,7 @@ public:
|
|||||||
Session &getSession();
|
Session &getSession();
|
||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
gameTableImpl* getMyW() const{};
|
gameTableImpl* getMyW() const {return NULL;}
|
||||||
|
|
||||||
void refreshSet() const;
|
void refreshSet() const;
|
||||||
void refreshCash() const;
|
void refreshCash() const;
|
||||||
|
|||||||
@@ -45,10 +45,10 @@
|
|||||||
#include "lobbychat.h"
|
#include "lobbychat.h"
|
||||||
|
|
||||||
startWindowImpl::startWindowImpl(ConfigFile *c)
|
startWindowImpl::startWindowImpl(ConfigFile *c)
|
||||||
: myW(NULL), myConfig(c)
|
: myConfig(c)
|
||||||
{
|
{
|
||||||
|
|
||||||
boost::shared_ptr<GuiInterface> myGuiInterface(new GuiWrapper(myConfig, this));
|
myGuiInterface.reset(new GuiWrapper(myConfig, this));
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Session> session(new Session(myGuiInterface.get(), myConfig));
|
boost::shared_ptr<Session> session(new Session(myGuiInterface.get(), myConfig));
|
||||||
session->init(); // TODO handle error
|
session->init(); // TODO handle error
|
||||||
@@ -141,10 +141,10 @@ void startWindowImpl::callNewGameDialog() {
|
|||||||
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
|
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
|
||||||
|
|
||||||
myNewGameDialog->exec();
|
myNewGameDialog->exec();
|
||||||
if (myNewGameDialog->result() == QDialog::Accepted ) { myW->startNewLocalGame(myNewGameDialog); }
|
if (myNewGameDialog->result() == QDialog::Accepted ) { myGuiInterface->getMyW()->startNewLocalGame(myNewGameDialog); }
|
||||||
}
|
}
|
||||||
// sonst mit gespeicherten Werten starten
|
// sonst mit gespeicherten Werten starten
|
||||||
else { myW->startNewLocalGame(); }
|
else { myGuiInterface->getMyW()->startNewLocalGame(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void startWindowImpl::callGameLobbyDialog() {
|
void startWindowImpl::callGameLobbyDialog() {
|
||||||
@@ -166,7 +166,7 @@ void startWindowImpl::callGameLobbyDialog() {
|
|||||||
void startWindowImpl::joinGameLobby() {
|
void startWindowImpl::joinGameLobby() {
|
||||||
|
|
||||||
// Stop local game.
|
// Stop local game.
|
||||||
myW->stopTimer();
|
myGuiInterface->getMyW()->stopTimer();
|
||||||
|
|
||||||
// Join Lobby
|
// Join Lobby
|
||||||
mySession->terminateNetworkClient();
|
mySession->terminateNetworkClient();
|
||||||
@@ -229,7 +229,7 @@ void startWindowImpl::callCreateNetworkGameDialog() {
|
|||||||
if (myCreateNetworkGameDialog->result() == QDialog::Accepted ) {
|
if (myCreateNetworkGameDialog->result() == QDialog::Accepted ) {
|
||||||
|
|
||||||
// Stop local game.
|
// Stop local game.
|
||||||
myW->stopTimer();
|
myGuiInterface->getMyW()->stopTimer();
|
||||||
|
|
||||||
if (!myServerGuiInterface)
|
if (!myServerGuiInterface)
|
||||||
{
|
{
|
||||||
@@ -311,7 +311,7 @@ void startWindowImpl::callJoinNetworkGameDialog() {
|
|||||||
if (myJoinNetworkGameDialog->result() == QDialog::Accepted ) {
|
if (myJoinNetworkGameDialog->result() == QDialog::Accepted ) {
|
||||||
|
|
||||||
// Stop local game.
|
// Stop local game.
|
||||||
myW->stopTimer();
|
myGuiInterface->getMyW()->stopTimer();
|
||||||
|
|
||||||
mySession->terminateNetworkClient();
|
mySession->terminateNetworkClient();
|
||||||
if (myServerGuiInterface)
|
if (myServerGuiInterface)
|
||||||
@@ -368,7 +368,7 @@ void startWindowImpl::showLobbyDialog()
|
|||||||
if (myGameLobbyDialog->result() == QDialog::Accepted)
|
if (myGameLobbyDialog->result() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
//some gui modifications
|
//some gui modifications
|
||||||
myW->networkGameModification();
|
myGuiInterface->getMyW()->networkGameModification();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -383,7 +383,7 @@ void startWindowImpl::showNetworkStartDialog()
|
|||||||
if (myStartNetworkGameDialog->result() == QDialog::Accepted ) {
|
if (myStartNetworkGameDialog->result() == QDialog::Accepted ) {
|
||||||
|
|
||||||
//some gui modifications
|
//some gui modifications
|
||||||
myW->networkGameModification();
|
myGuiInterface->getMyW()->networkGameModification();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mySession->terminateNetworkClient();
|
mySession->terminateNetworkClient();
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ public slots:
|
|||||||
void showNetworkStartDialog();
|
void showNetworkStartDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gameTableImpl *myW;
|
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
|
boost::shared_ptr<GuiInterface> myGuiInterface;
|
||||||
boost::shared_ptr<Session> mySession;
|
boost::shared_ptr<Session> mySession;
|
||||||
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user