* Smooth a station map. * * Used for smoothing fire station and police station coverage maps. * @param map Map to smooth. */
| 78 | * @param map Map to smooth. |
| 79 | */ |
| 80 | static void smoothStationMap(MapShort8 *map) |
| 81 | { |
| 82 | short x, y, edge; |
| 83 | MapShort8 tempMap(*map); |
| 84 | |
| 85 | for (x = 0; x < tempMap.MAP_W; x++) { |
| 86 | for (y = 0; y < tempMap.MAP_H; y++) { |
| 87 | edge = 0; |
| 88 | if (x > 0) { |
| 89 | edge += tempMap.get(x - 1, y); |
| 90 | } |
| 91 | if (x < tempMap.MAP_W - 1) { |
| 92 | edge += tempMap.get(x + 1, y); |
| 93 | } |
| 94 | if (y > 0) { |
| 95 | edge += tempMap.get(x, y - 1); |
| 96 | } |
| 97 | if (y < tempMap.MAP_H - 1) { |
| 98 | edge += tempMap.get(x, y + 1); |
| 99 | } |
| 100 | edge = tempMap.get(x, y) + edge / 4; |
| 101 | map->set(x, y, edge / 2); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Make firerate map from firestation map. |
no test coverage detected