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

Method layDoze

MicropolisCore/src/MicropolisEngine/src/connect.cpp:211–250  ·  view source on GitHub ↗

* Builldoze a tile (make it a #RIVER or #DIRT). * @param x X map coordinate. * @param y Y map coordinate. * @param effects Modification collecting object. * @return Tool result. */

Source from the content-addressed store, hash-verified

209 * @return Tool result.
210 */
211ToolResult Micropolis::layDoze(int x, int y, ToolEffects *effects)
212{
213 MapValue tile = effects->getMapValue(x, y);
214
215 if (!(tile & BULLBIT)) {
216 return TOOLRESULT_FAILED; /* Check dozeable bit. */
217 }
218
219 tile &= LOMASK;
220 tile = neutralizeRoad(tile);
221
222 switch (tile) {
223 case HBRIDGE:
224 case VBRIDGE:
225 case BRWV:
226 case BRWH:
227 case HBRDG0:
228 case HBRDG1:
229 case HBRDG2:
230 case HBRDG3:
231 case VBRDG0:
232 case VBRDG1:
233 case VBRDG2:
234 case VBRDG3:
235 case HPOWER:
236 case VPOWER:
237 case HRAIL:
238 case VRAIL: /* Dozing over water, replace with water. */
239 effects->setMapValue(x, y, RIVER);
240 break;
241
242 default: /* Dozing on land, replace with land. Simple, eh? */
243 effects->setMapValue(x, y, DIRT);
244 break;
245 }
246
247 effects->addCost(1); /* Costs $1.00.... */
248
249 return TOOLRESULT_OK;
250}
251
252
253/**

Callers

nothing calls this directly

Calls 4

neutralizeRoadFunction · 0.85
addCostMethod · 0.80
getMapValueMethod · 0.60
setMapValueMethod · 0.60

Tested by

no test coverage detected