src/station_cmd.cpp
changeset 8909 fa15e9afad2f
parent 8882 f54bd3d64027
child 8920 04df97185061
equal deleted inserted replaced
8908:6163a06e60f8 8909:fa15e9afad2f
  1943  */
  1943  */
  1944 CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1944 CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1945 {
  1945 {
  1946 	CommandCost cost;
  1946 	CommandCost cost;
  1947 
  1947 
  1948 	DiagDirection direction;
  1948 	DiagDirection direction = GetInclinedSlopeDirection(GetTileSlope(tile, NULL));
  1949 	switch (GetTileSlope(tile, NULL)) {
  1949 	if (direction == INVALID_DIAGDIR) return_cmd_error(STR_304B_SITE_UNSUITABLE);
  1950 		case SLOPE_SW: direction = DIAGDIR_NE; break;
  1950 	direction = ReverseDiagDir(direction);
  1951 		case SLOPE_SE: direction = DIAGDIR_NW; break;
       
  1952 		case SLOPE_NW: direction = DIAGDIR_SE; break;
       
  1953 		case SLOPE_NE: direction = DIAGDIR_SW; break;
       
  1954 		default: return_cmd_error(STR_304B_SITE_UNSUITABLE);
       
  1955 	}
       
  1956 
  1951 
  1957 	/* Docks cannot be placed on rapids */
  1952 	/* Docks cannot be placed on rapids */
  1958 	if (IsRiverTile(tile)) return_cmd_error(STR_304B_SITE_UNSUITABLE);
  1953 	if (IsRiverTile(tile)) return_cmd_error(STR_304B_SITE_UNSUITABLE);
  1959 
  1954 
  1960 	if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile)) return CMD_ERROR;
  1955 	if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile)) return CMD_ERROR;