equal
deleted
inserted
replaced
146 * @param height Aimed height. |
146 * @param height Aimed height. |
147 * @param return Error code or cost. |
147 * @param return Error code or cost. |
148 */ |
148 */ |
149 static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height) |
149 static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height) |
150 { |
150 { |
151 CommandCost total_cost = CommandCost(); |
151 CommandCost total_cost(EXPENSES_CONSTRUCTION); |
152 |
152 |
153 assert(tile < MapSize()); |
153 assert(tile < MapSize()); |
154 |
154 |
155 /* Check range of destination height */ |
155 /* Check range of destination height */ |
156 if (height < 0) return_cmd_error(STR_1003_ALREADY_AT_SEA_LEVEL); |
156 if (height < 0) return_cmd_error(STR_1003_ALREADY_AT_SEA_LEVEL); |
226 * @return error or cost of terraforming |
226 * @return error or cost of terraforming |
227 */ |
227 */ |
228 CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
228 CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
229 { |
229 { |
230 TerraformerState ts; |
230 TerraformerState ts; |
231 CommandCost total_cost = CommandCost(); |
231 CommandCost total_cost(EXPENSES_CONSTRUCTION); |
232 int direction = (p2 != 0 ? 1 : -1); |
232 int direction = (p2 != 0 ? 1 : -1); |
233 |
|
234 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
|
235 |
233 |
236 _terraform_err_tile = 0; |
234 _terraform_err_tile = 0; |
237 |
235 |
238 ts.modheight_count = ts.tile_table_count = 0; |
236 ts.modheight_count = ts.tile_table_count = 0; |
239 |
237 |
356 int ey; |
354 int ey; |
357 int sx, sy; |
355 int sx, sy; |
358 uint h, oldh, curh; |
356 uint h, oldh, curh; |
359 CommandCost money; |
357 CommandCost money; |
360 CommandCost ret; |
358 CommandCost ret; |
361 CommandCost cost; |
359 CommandCost cost(EXPENSES_CONSTRUCTION); |
362 |
360 |
363 if (p1 >= MapSize()) return CMD_ERROR; |
361 if (p1 >= MapSize()) return CMD_ERROR; |
364 |
|
365 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
|
366 |
362 |
367 /* remember level height */ |
363 /* remember level height */ |
368 oldh = TileHeight(p1); |
364 oldh = TileHeight(p1); |
369 |
365 |
370 /* compute new height */ |
366 /* compute new height */ |