From 43061892c7c9d341bacb7c679444f2885bd56907 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 11 Apr 2011 02:24:48 +0200 Subject: - make use of my_color (still TODO: pre-game dialog (with intro music) + display own color first in scoreboard) - remove some audio debugging noice --- pacman-c++/mainwidget.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'pacman-c++/mainwidget.cpp') diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index 9c53513..bdc2da1 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp @@ -10,23 +10,27 @@ MainWidget::MainWidget(QWidget *parent) : SceneHolder(parent), m_currentKey(0), m_running(false) { createGui(); - updateMap(Util::createDemoMap()); - Color::Color myColor = connectToServer(); - if (myColor == Color::none) + m_color = connectToServer(); + if (m_color == Color::none) { QMessageBox::critical(this, "Error", "Failed to connect to server, falling back to local test mode"); // TODO: quit application here or sth m_socket = NULL; + m_color = Color::red; QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(tick())); timer->start(Constants::tick); } - else + + /* call updateMap after m_color ist set! */ + updateMap(Util::createDemoMap()); + + if (m_socket != NULL) connect(m_socket, SIGNAL(readyRead()), this, SLOT(tick())); // TODO: use mycolor - qDebug() << "mycolor=" << myColor; + qDebug() << "mycolor=" << m_color; //TODO: play intro as soon as there are enough players //connect(AudioPlayer::self(), SIGNAL(finished()), this, SLOT(startGame())); -- cgit v1.2.3