diff options
| author | totycro <totycro@unknown-horizons.org> | 2011-04-19 21:56:37 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2011-04-19 21:56:37 +0200 |
| commit | eaf133fd08c9708fe718ef47451bed7ea803a46a (patch) | |
| tree | b3b9c2fca22bf4351aa854abd84e7a2f39ccbdb9 /pacman-c++/util.cpp | |
| parent | b6fec20dadaf71fc28961a4a6d720d1d665508e8 (diff) | |
| download | foop-eaf133fd08c9708fe718ef47451bed7ea803a46a.tar.gz foop-eaf133fd08c9708fe718ef47451bed7ea803a46a.tar.bz2 foop-eaf133fd08c9708fe718ef47451bed7ea803a46a.zip | |
Added rounds
rounds will end when all points are removed
TODO: end round when a pacman gets eaten
Diffstat (limited to 'pacman-c++/util.cpp')
| -rw-r--r-- | pacman-c++/util.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pacman-c++/util.cpp b/pacman-c++/util.cpp index 708d005..fcc1aff 100644 --- a/pacman-c++/util.cpp +++ b/pacman-c++/util.cpp | |||
| @@ -90,7 +90,7 @@ namespace Util | |||
| 90 | QList<QPoint> actors; | 90 | QList<QPoint> actors; |
| 91 | for(unsigned int i = 0; i < players; ++i) | 91 | for(unsigned int i = 0; i < players; ++i) |
| 92 | { | 92 | { |
| 93 | /* first remove formally placed actors from map */ | 93 | /* first remove formerly placed actors from map */ |
| 94 | foreach(QPoint pos, actors) | 94 | foreach(QPoint pos, actors) |
| 95 | map[pos.x()][pos.y()] = Transmission::none; | 95 | map[pos.x()][pos.y()] = Transmission::none; |
| 96 | actors.clear(); | 96 | actors.clear(); |
| @@ -139,15 +139,19 @@ namespace Util | |||
| 139 | void fillPoints(Transmission::map_t map, Transmission::field_t type) | 139 | void fillPoints(Transmission::map_t map, Transmission::field_t type) |
| 140 | { | 140 | { |
| 141 | /* auto place normal points*/ | 141 | /* auto place normal points*/ |
| 142 | int i =0; | ||
| 142 | for (unsigned int x = 0; x < Constants::map_size.width; ++x) | 143 | for (unsigned int x = 0; x < Constants::map_size.width; ++x) |
| 143 | { | 144 | { |
| 144 | for (unsigned int y = 0; y < Constants::map_size.height; ++y) | 145 | for (unsigned int y = 0; y < Constants::map_size.height; ++y) |
| 145 | { | 146 | { |
| 146 | Transmission::field_t &cur = map[x][y]; | 147 | Transmission::field_t &cur = map[x][y]; |
| 147 | if (cur == Transmission::none) | 148 | if (cur == Transmission::none) { |
| 149 | if (++i > 10 ) continue; | ||
| 150 | |||
| 148 | cur = type; | 151 | cur = type; |
| 149 | else if (cur == Transmission::point) | 152 | } else if (cur == Transmission::point) { |
| 150 | cur = Transmission::none; | 153 | cur = Transmission::none; |
| 154 | } | ||
| 151 | } | 155 | } |
| 152 | } | 156 | } |
| 153 | } | 157 | } |
