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

Method roadTool

MicropolisCore/src/MicropolisEngine/src/tool.cpp:1098–1114  ·  view source on GitHub ↗

* Build a road at a tile. * @param x Horizontal position of the tile to lay road. * @param y Vertical position of the tile to lay road. * @param effects Storage of effects of laying raod at the tile. * @return Tool result. * @todo Merge roadTool, railroadTool, wireTool, and parkTool functions. */

Source from the content-addressed store, hash-verified

1096 * @todo Merge roadTool, railroadTool, wireTool, and parkTool functions.
1097 */
1098ToolResult Micropolis::roadTool(short x, short y, ToolEffects *effects)
1099{
1100 if (!testBounds(x, y)) {
1101 return TOOLRESULT_FAILED;
1102 }
1103
1104 ToolResult result = connectTile(x, y, CONNECT_TILE_ROAD, effects);
1105
1106 if (result == TOOLRESULT_OK) {
1107 /* send 'didtool' message */
1108 FrontendMessage *didToolMsg;
1109 didToolMsg = new FrontendMessageDidTool("Road", x, y);
1110 effects->addFrontendMessage(didToolMsg);
1111 }
1112
1113 return result;
1114}
1115
1116
1117/**

Callers

nothing calls this directly

Calls 2

testBoundsFunction · 0.85
addFrontendMessageMethod · 0.80

Tested by

no test coverage detected