diff options
| author | manuel <manuel@mausz.at> | 2011-04-17 20:51:16 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-17 20:51:16 +0200 |
| commit | becd390b551f4ee705aa14a97c90eaa8596c824c (patch) | |
| tree | 15152f17ee894131e7523b29c8fbc3efe7ed45e5 | |
| parent | 204f2c3a32779d746f62c5ebaa6aefbaf410da7a (diff) | |
| download | foop-becd390b551f4ee705aa14a97c90eaa8596c824c.tar.gz foop-becd390b551f4ee705aa14a97c90eaa8596c824c.tar.bz2 foop-becd390b551f4ee705aa14a97c90eaa8596c824c.zip | |
fix colorize block stuff
| -rw-r--r-- | pacman-c++/block.cpp | 6 | ||||
| -rw-r--r-- | pacman-c++/server.cpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/pacman-c++/block.cpp b/pacman-c++/block.cpp index 4087662..68dd735 100644 --- a/pacman-c++/block.cpp +++ b/pacman-c++/block.cpp | |||
| @@ -36,9 +36,11 @@ void Block::setNeighbours(unsigned int neighbours) | |||
| 36 | setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height); | 36 | setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | bool Block::checkEnter(Actor * /* actor */) | 39 | bool Block::checkEnter(Actor *actor) |
| 40 | { | 40 | { |
| 41 | return (m_color != Color::none); | 41 | if (m_color == Color::none) |
| 42 | return false; | ||
| 43 | return (m_color == actor->color()); | ||
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | bool Block::enter(Actor *actor) | 46 | bool Block::enter(Actor *actor) |
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index a48ee32..9baa9ab 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp | |||
| @@ -268,7 +268,7 @@ void Server::colorizeBlocks(Transmission::map_t map) | |||
| 268 | int tickcount = min + (int) ((max - min + 1) * (qrand() / (RAND_MAX + 1.0))); | 268 | int tickcount = min + (int) ((max - min + 1) * (qrand() / (RAND_MAX + 1.0))); |
| 269 | m_coloredBlocks.insert(block, tickcount); | 269 | m_coloredBlocks.insert(block, tickcount); |
| 270 | 270 | ||
| 271 | unsigned int color = (int) ((m_maxplayers - 1) * (qrand() / (RAND_MAX + 1.0))); | 271 | unsigned int color = (int) (m_maxplayers * (qrand() / (RAND_MAX + 1.0))); |
| 272 | map[block.x()][block.y()] |= Transmission::block | Color::order[color]; | 272 | map[block.x()][block.y()] |= Transmission::block | Color::order[color]; |
| 273 | updateMap(map, block.x(), block.y()); | 273 | updateMap(map, block.x(), block.y()); |
| 274 | } | 274 | } |
