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

Method putDownForest

MicropolisCore/src/MicropolisEngine/src/tool.cpp:358–378  ·  view source on GitHub ↗

* Put down a forest tile. * @param mapH X coordinate of the tile. * @param mapV Y coordinate of the tile. * @return Tool result. * @todo Auto-bulldoze deducts always 1. */

Source from the content-addressed store, hash-verified

356 * @todo Auto-bulldoze deducts always 1.
357 */
358ToolResult Micropolis::putDownForest(short mapH, short mapV,
359 ToolEffects *effects)
360{
361 static short dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1, };
362 static short dy[8] = { -1, -1, -1, 0, 0, 1, 1, 1, };
363
364 effects->setMapValue(mapH, mapV, WOODS | BLBNBIT);
365
366 int i;
367 for (i = 0; i < 8; i++) {
368 int xx = mapH + dx[i];
369 int yy = mapV + dy[i];
370 if (testBounds(xx, yy)) {
371 smoothTreesAt(xx, yy, true, effects);
372 }
373 }
374
375 effects->addCost(gCostOf[TOOL_FOREST]);
376
377 return TOOLRESULT_OK;
378}
379
380
381/**

Callers

nothing calls this directly

Calls 3

testBoundsFunction · 0.85
addCostMethod · 0.80
setMapValueMethod · 0.60

Tested by

no test coverage detected