diff options
| author | manuel <manuel@mausz.at> | 2011-04-18 19:47:34 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-18 19:47:34 +0200 |
| commit | 85b09864f6d489e8c998e9f172d25079d572c602 (patch) | |
| tree | a6e38da5dc828810b21045d0ac1e4babcf198825 /pacman-c++/mainwidget.cpp | |
| parent | e373442901064d07791c9739daa380acb1dfbb8c (diff) | |
| download | foop-85b09864f6d489e8c998e9f172d25079d572c602.tar.gz foop-85b09864f6d489e8c998e9f172d25079d572c602.tar.bz2 foop-85b09864f6d489e8c998e9f172d25079d572c602.zip | |
- add actor.canEat(other) to check if actor can eat other (note: that doesn't mean that other can eat actor!!)
- server now generated and sends the colorlist to the server in the first map update packet
- add a better AI
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index c674c55..42abd01 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp | |||
| @@ -6,7 +6,8 @@ | |||
| 6 | #include "pacman.pb.h" | 6 | #include "pacman.pb.h" |
| 7 | 7 | ||
| 8 | MainWidget::MainWidget(QWidget *parent) | 8 | MainWidget::MainWidget(QWidget *parent) |
| 9 | : QWidget(parent), m_currentKey(Transmission::none), m_running(false), m_maxplayers(0) | 9 | : QWidget(parent), m_currentKey(Transmission::none), m_running(false), m_scene(NULL), |
| 10 | m_maxplayers(0) | ||
| 10 | { | 11 | { |
| 11 | /* create audio player */ | 12 | /* create audio player */ |
| 12 | m_ambientPlayer = new GaplessAudioPlayer(Sound::Ambient, 100, this); | 13 | m_ambientPlayer = new GaplessAudioPlayer(Sound::Ambient, 100, this); |
| @@ -146,6 +147,15 @@ void MainWidget::tick() | |||
| 146 | bool worked = m_updatepacket.ParseFromArray(data->data(), data->size()); | 147 | bool worked = m_updatepacket.ParseFromArray(data->data(), data->size()); |
| 147 | Q_ASSERT(worked); | 148 | Q_ASSERT(worked); |
| 148 | Q_UNUSED(worked); | 149 | Q_UNUSED(worked); |
| 150 | |||
| 151 | if (m_updatepacket.eating_order_size() > 0) | ||
| 152 | { | ||
| 153 | Q_ASSERT(m_scene != NULL); | ||
| 154 | QList<Color::Color> order; | ||
| 155 | for(int i = 0; i < m_updatepacket.eating_order_size(); ++i) | ||
| 156 | order.append(static_cast<Color::Color>(m_updatepacket.eating_order(i) & Transmission::color_mask)); | ||
| 157 | } | ||
| 158 | |||
| 149 | Transmission::map_t map = Util::createUninitialisedMap(); | 159 | Transmission::map_t map = Util::createUninitialisedMap(); |
| 150 | Q_ASSERT(m_updatepacket.field_size() == (int) (Constants::map_size.width * Constants::map_size.height)); | 160 | Q_ASSERT(m_updatepacket.field_size() == (int) (Constants::map_size.width * Constants::map_size.height)); |
| 151 | int i = 0; | 161 | int i = 0; |
