diff options
Diffstat (limited to 'pacman-c++/util.cpp')
| -rw-r--r-- | pacman-c++/util.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pacman-c++/util.cpp b/pacman-c++/util.cpp index 2a3b78a..708d005 100644 --- a/pacman-c++/util.cpp +++ b/pacman-c++/util.cpp | |||
| @@ -77,7 +77,13 @@ namespace Util | |||
| 77 | 77 | ||
| 78 | void placeActors(Transmission::map_t map, unsigned int players, const Color::Color *colors) | 78 | void placeActors(Transmission::map_t map, unsigned int players, const Color::Color *colors) |
| 79 | { | 79 | { |
| 80 | int mindistance = 5; | 80 | #if 0 |
| 81 | for(unsigned int i = 0; i < players; ++i) | ||
| 82 | map[i][0] = colors[i] | Transmission::pacman | Transmission::direction_none; | ||
| 83 | return; | ||
| 84 | #endif | ||
| 85 | |||
| 86 | int mindistance = Constants::Game::player_minimum_distance; | ||
| 81 | /* this outer loop is used if there are no more valid places left | 87 | /* this outer loop is used if there are no more valid places left |
| 82 | * so we can change mindistance | 88 | * so we can change mindistance |
| 83 | */ | 89 | */ |
| @@ -107,9 +113,9 @@ namespace Util | |||
| 107 | int rand = (int) (validpos.size() * (qrand() / (RAND_MAX + 1.0))); | 113 | int rand = (int) (validpos.size() * (qrand() / (RAND_MAX + 1.0))); |
| 108 | QPoint newpos = validpos.at(rand); | 114 | QPoint newpos = validpos.at(rand); |
| 109 | map[newpos.x()][newpos.y()] = colors[i] | Transmission::pacman | Transmission::direction_none; | 115 | map[newpos.x()][newpos.y()] = colors[i] | Transmission::pacman | Transmission::direction_none; |
| 116 | qDebug() << "Actor" << i << "at" << newpos; | ||
| 110 | actors.append(newpos); | 117 | actors.append(newpos); |
| 111 | validpos.removeAt(rand); | 118 | validpos.removeAt(rand); |
| 112 | qDebug() << "actor" << colors[i] << "at" << newpos; | ||
| 113 | 119 | ||
| 114 | QMutableListIterator<QPoint> j(validpos); | 120 | QMutableListIterator<QPoint> j(validpos); |
| 115 | while(j.hasNext()) | 121 | while(j.hasNext()) |
| @@ -123,14 +129,14 @@ namespace Util | |||
| 123 | if (validpos.empty()) | 129 | if (validpos.empty()) |
| 124 | { | 130 | { |
| 125 | qWarning() << "There are no more valid positions for actors left on the map"; | 131 | qWarning() << "There are no more valid positions for actors left on the map"; |
| 126 | mindistance -= 2; | 132 | mindistance -= Constants::Game::player_distance_decr; |
| 127 | break; | 133 | break; |
| 128 | } | 134 | } |
| 129 | } | 135 | } |
| 130 | } | 136 | } |
| 131 | } | 137 | } |
| 132 | 138 | ||
| 133 | void makePoints(Transmission::map_t map) | 139 | void fillPoints(Transmission::map_t map, Transmission::field_t type) |
| 134 | { | 140 | { |
| 135 | /* auto place normal points*/ | 141 | /* auto place normal points*/ |
| 136 | for (unsigned int x = 0; x < Constants::map_size.width; ++x) | 142 | for (unsigned int x = 0; x < Constants::map_size.width; ++x) |
| @@ -139,7 +145,7 @@ namespace Util | |||
| 139 | { | 145 | { |
| 140 | Transmission::field_t &cur = map[x][y]; | 146 | Transmission::field_t &cur = map[x][y]; |
| 141 | if (cur == Transmission::none) | 147 | if (cur == Transmission::none) |
| 142 | cur |= Transmission::point; | 148 | cur = type; |
| 143 | else if (cur == Transmission::point) | 149 | else if (cur == Transmission::point) |
| 144 | cur = Transmission::none; | 150 | cur = Transmission::none; |
| 145 | } | 151 | } |
