* 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. */
| 1096 | * @todo Merge roadTool, railroadTool, wireTool, and parkTool functions. |
| 1097 | */ |
| 1098 | ToolResult 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 | /** |
nothing calls this directly
no test coverage detected