diff options
Diffstat (limited to 'pacman-c++/block.cpp')
| -rw-r--r-- | pacman-c++/block.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pacman-c++/block.cpp b/pacman-c++/block.cpp index 16f62c4..eb51d89 100644 --- a/pacman-c++/block.cpp +++ b/pacman-c++/block.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | QMap<Color::Color, QPixmap> Block::m_pixmaps; | 7 | QMap<Color::Color, QPixmap> Block::m_pixmaps; |
| 8 | 8 | ||
| 9 | Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent) | 9 | Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent) |
| 10 | : GameEntity(color, parent) | 10 | : GameEntity(color, parent), m_neighbours(neighbours) |
| 11 | { | 11 | { |
| 12 | /* empty object for servers */ | 12 | /* empty object for servers */ |
| 13 | if (Constants::server) | 13 | if (Constants::server) |
| @@ -20,11 +20,17 @@ Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent) | |||
| 20 | m_pixmaps[color] = QPixmap(pixmapName); | 20 | m_pixmaps[color] = QPixmap(pixmapName); |
| 21 | } | 21 | } |
| 22 | setPixmap(m_pixmaps.find(color).value()); | 22 | setPixmap(m_pixmaps.find(color).value()); |
| 23 | setNeighbours(neighbours); | 23 | setNeighbours(m_neighbours); |
| 24 | } | ||
| 25 | |||
| 26 | unsigned int Block::neighbours() | ||
| 27 | { | ||
| 28 | return m_neighbours; | ||
| 24 | } | 29 | } |
| 25 | 30 | ||
| 26 | void Block::setNeighbours(unsigned int neighbours) | 31 | void Block::setNeighbours(unsigned int neighbours) |
| 27 | { | 32 | { |
| 33 | m_neighbours = neighbours; | ||
| 28 | setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height); | 34 | setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height); |
| 29 | } | 35 | } |
| 30 | 36 | ||
