|
@@ -675,49 +675,49 @@ int32 CmdBuildTrainDepot(int x, int y, u
|
|
|
3) the tile is steep i.e. spans two height levels
|
|
|
4) the exit points in the wrong direction
|
|
|
|
|
|
*/
|
|
|
|
|
|
if (tileh != 0 && (
|
|
|
_is_old_ai_player ||
|
|
|
!_patches.build_on_slopes ||
|
|
|
IsSteepTileh(tileh) ||
|
|
|
!CanBuildDepotByTileh(p2, tileh)
|
|
|
)
|
|
|
) {
|
|
|
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
|
|
|
}
|
|
|
|
|
|
ret = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
if (CmdFailed(ret)) return CMD_ERROR;
|
|
|
cost = ret;
|
|
|
|
|
|
d = AllocateDepot();
|
|
|
if (d == NULL)
|
|
|
return CMD_ERROR;
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
if (_current_player == _local_player) _last_built_train_depot_tile = tile;
|
|
|
if (IsLocalPlayer()) _last_built_train_depot_tile = tile;
|
|
|
|
|
|
ModifyTile(tile,
|
|
|
MP_SETTYPE(MP_RAILWAY) |
|
|
|
MP_MAP3LO | MP_MAPOWNER_CURRENT | MP_MAP5,
|
|
|
p1, /* map3_lo */
|
|
|
p2 | RAIL_TYPE_DEPOT_WAYPOINT /* map5 */
|
|
|
);
|
|
|
|
|
|
d->xy = tile;
|
|
|
d->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
|
|
|
|
|
|
SetSignalsOnBothDir(tile, (p2&1) ? 2 : 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
return cost + _price.build_train_depot;
|
|
|
}
|
|
|
|
|
|
/** Build signals, alternate between double/single, signal/semaphore,
|
|
|
* pre/exit/combo-signals, and what-else not
|
|
|
* @param x,y coordinates where signals is being built
|
|
|
* @param p1 various bitstuffed elements
|
|
|
* - p1 = (bit 0-2) - track-orientation, valid values: 0-5 (Track enum)
|
|
|
* - p1 = (bit 3) - choose semaphores/signals or cycle normal/pre/exit/combo depending on context
|