equal
deleted
inserted
replaced
586 CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2) |
586 CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2) |
587 { |
587 { |
588 TileIndex start_tile, tile; |
588 TileIndex start_tile, tile; |
589 CommandCost cost, ret; |
589 CommandCost cost, ret; |
590 bool had_bridge = false; |
590 bool had_bridge = false; |
|
591 bool had_tunnel = false; |
591 bool had_success = false; |
592 bool had_success = false; |
592 DisallowedRoadDirections drd = DRD_NORTHBOUND; |
593 DisallowedRoadDirections drd = DRD_NORTHBOUND; |
593 |
594 |
594 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
595 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
595 |
596 |
631 if (CmdFailed(ret)) { |
632 if (CmdFailed(ret)) { |
632 if (_error_message != STR_1007_ALREADY_BUILT) return CMD_ERROR; |
633 if (_error_message != STR_1007_ALREADY_BUILT) return CMD_ERROR; |
633 _error_message = INVALID_STRING_ID; |
634 _error_message = INVALID_STRING_ID; |
634 } else { |
635 } else { |
635 had_success = true; |
636 had_success = true; |
636 /* Only pay for the upgrade on one side of the bridge */ |
637 /* Only pay for the upgrade on one side of the bridges and tunnels */ |
637 if (IsBridgeTile(tile)) { |
638 if (IsTileType(tile, MP_TUNNELBRIDGE)) { |
638 if ((!had_bridge || GetBridgeRampDirection(tile) == DIAGDIR_SE || GetBridgeRampDirection(tile) == DIAGDIR_SW)) { |
639 if (IsBridge(tile)) { |
639 cost.AddCost(ret); |
640 if ((!had_bridge || GetBridgeRampDirection(tile) == DIAGDIR_SE || GetBridgeRampDirection(tile) == DIAGDIR_SW)) { |
|
641 cost.AddCost(ret); |
|
642 } |
|
643 had_bridge = true; |
|
644 } else { |
|
645 if ((!had_tunnel || GetTunnelDirection(tile) == DIAGDIR_SE || GetTunnelDirection(tile) == DIAGDIR_SW)) { |
|
646 cost.AddCost(ret); |
|
647 } |
|
648 had_tunnel = true; |
640 } |
649 } |
641 had_bridge = true; |
|
642 } else { |
650 } else { |
643 cost.AddCost(ret); |
651 cost.AddCost(ret); |
644 } |
652 } |
645 } |
653 } |
646 |
654 |