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

Method putDownLand

MicropolisCore/src/MicropolisEngine/src/tool.cpp:325–348  ·  view source on GitHub ↗

* Put down a land tile. * @param mapH X coordinate of the tile. * @param mapV Y coordinate of the tile. * @return Tool result. * @todo Auto-bulldoze deducts always 1. * @todo Auto-bulldoze costs should be pulled from a table/constant. */

Source from the content-addressed store, hash-verified

323 * @todo Auto-bulldoze costs should be pulled from a table/constant.
324 */
325ToolResult Micropolis::putDownLand(short mapH, short mapV, ToolEffects *effects)
326{
327 int tile = effects->getMapTile(mapH, mapV);
328// static short dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1, };
329// static short dy[8] = { -1, -1, -1, 0, 0, 1, 1, 1, };
330
331
332 if (tile == DIRT) return TOOLRESULT_FAILED;
333
334 effects->setMapValue(mapH, mapV, DIRT);
335
336// int i;
337// for (i = 0; i < 8; i++) {
338// int xx = mapH + dx[i];
339// int yy = mapV + dy[i];
340// if (testBounds(xx, yy)) {
341// //smoothTreesAt(xx, yy, true);
342// }
343// }
344
345 effects->addCost(gCostOf[TOOL_LAND]);
346
347 return TOOLRESULT_OK;
348}
349
350
351/**

Callers

nothing calls this directly

Calls 3

getMapTileMethod · 0.80
addCostMethod · 0.80
setMapValueMethod · 0.60

Tested by

no test coverage detected