src/road_cmd.cpp
changeset 10130 f3889bf9d638
parent 10129 86af33783c5e
child 10207 c291a21b304e
equal deleted inserted replaced
10129:86af33783c5e 10130:f3889bf9d638
   521 						return_cmd_error(STR_1007_ALREADY_BUILT);
   521 						return_cmd_error(STR_1007_ALREADY_BUILT);
   522 					}
   522 					}
   523 				} break;
   523 				} break;
   524 
   524 
   525 				case ROAD_TILE_CROSSING:
   525 				case ROAD_TILE_CROSSING:
   526 					if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
       
   527 					other_bits = GetCrossingRoadBits(tile);
   526 					other_bits = GetCrossingRoadBits(tile);
   528 					if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
   527 					if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
   529 					pieces = other_bits; // we need to pay for both roadbits
   528 					pieces = other_bits; // we need to pay for both roadbits
       
   529 
       
   530 					if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
   530 					break;
   531 					break;
   531 
   532 
   532 				default:
   533 				default:
   533 				case ROAD_TILE_DEPOT:
   534 				case ROAD_TILE_DEPOT:
   534 					goto do_clear;
   535 					goto do_clear;
   576 			return CommandCost(EXPENSES_CONSTRUCTION, _price.build_road * (rt == ROADTYPE_ROAD ? 2 : 4));
   577 			return CommandCost(EXPENSES_CONSTRUCTION, _price.build_road * (rt == ROADTYPE_ROAD ? 2 : 4));
   577 		}
   578 		}
   578 
   579 
   579 		case MP_STATION: {
   580 		case MP_STATION: {
   580 			if (!IsDriveThroughStopTile(tile)) goto do_clear;
   581 			if (!IsDriveThroughStopTile(tile)) goto do_clear;
   581 			if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
       
   582 
   582 
   583 			RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
   583 			RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
   584 			if (pieces & ~curbits) goto do_clear;
   584 			if (pieces & ~curbits) goto do_clear;
   585 			pieces = curbits; // we need to pay for both roadbits
   585 			pieces = curbits; // we need to pay for both roadbits
       
   586 
       
   587 			if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
   586 		} break;
   588 		} break;
   587 
   589 
   588 		case MP_TUNNELBRIDGE:
   590 		case MP_TUNNELBRIDGE:
   589 			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
   591 			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
   590 			if (MirrorRoadBits(DiagDirToRoadBits(GetTunnelBridgeDirection(tile))) != pieces) return CMD_ERROR;
   592 			if (MirrorRoadBits(DiagDirToRoadBits(GetTunnelBridgeDirection(tile))) != pieces) return CMD_ERROR;