MCPcopy Create free account
hub / github.com/SimHacker/micropolis / makeNakedIsland

Method makeNakedIsland

MicropolisCore/src/MicropolisEngine/src/generate.cpp:194–234  ·  view source on GitHub ↗

* Construct a plain island as world, surrounded by 5 tiles of river. */

Source from the content-addressed store, hash-verified

192 * Construct a plain island as world, surrounded by 5 tiles of river.
193 */
194void Micropolis::makeNakedIsland()
195{
196 const int terrainIslandRadius = ISLAND_RADIUS;
197 int x, y;
198
199 for (x = 0; x < WORLD_W; x++) {
200 for (y = 0; y < WORLD_H; y++) {
201 if ((x < 5) || (x >= WORLD_W - 5) ||
202 (y < 5) || (y >= WORLD_H - 5)) {
203 map[x][y] = RIVER;
204 } else {
205 map[x][y] = DIRT;
206 }
207 }
208 }
209
210 for (x = 0; x < WORLD_W - 5; x += 2) {
211
212 int mapY = getERandom(terrainIslandRadius);
213 plopBRiver(Position(x, mapY));
214
215 mapY = (WORLD_H - 10) - getERandom(terrainIslandRadius);
216 plopBRiver(Position(x, mapY));
217
218 plopSRiver(Position(x, 0));
219 plopSRiver(Position(x, WORLD_H - 6));
220 }
221
222 for (y = 0; y < WORLD_H - 5; y += 2) {
223
224 int mapX = getERandom(terrainIslandRadius);
225 plopBRiver(Position(mapX, y));
226
227 mapX = (WORLD_W - 10) - getERandom(terrainIslandRadius);
228 plopBRiver(Position(mapX, y));
229
230 plopSRiver(Position(0, y));
231 plopSRiver(Position(WORLD_W - 6, y));
232 }
233
234}
235
236
237/** Construct a new world as an island */

Callers

nothing calls this directly

Calls 1

PositionClass · 0.70

Tested by

no test coverage detected