Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef SCRIPT_ROAD_HPP
00013 #define SCRIPT_ROAD_HPP
00014
00015 #include "script_tile.hpp"
00016
00021 class ScriptRoad : public ScriptObject {
00022 public:
00026 enum ErrorMessages {
00028 ERR_ROAD_BASE = ScriptError::ERR_CAT_ROAD << ScriptError::ERR_CAT_BIT_SIZE,
00029
00031 ERR_ROAD_WORKS_IN_PROGRESS,
00032
00034 ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION,
00035
00037 ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD,
00038
00039
00041 ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS,
00042 };
00043
00047 enum RoadType {
00048
00049 ROADTYPE_ROAD = ::ROADTYPE_ROAD,
00050 ROADTYPE_TRAM = ::ROADTYPE_TRAM,
00051
00052
00053 ROADTYPE_INVALID = -1,
00054 };
00055
00059 enum RoadVehicleType {
00060 ROADVEHTYPE_BUS,
00061 ROADVEHTYPE_TRUCK,
00062 };
00063
00067 enum BuildType {
00068 BT_ROAD,
00069 BT_DEPOT,
00070 BT_BUS_STOP,
00071 BT_TRUCK_STOP,
00072 };
00073
00080 static RoadVehicleType GetRoadVehicleTypeForCargo(CargoID cargo_type);
00081
00090 static bool IsRoadTile(TileIndex tile);
00091
00098 static bool IsRoadDepotTile(TileIndex tile);
00099
00106 static bool IsRoadStationTile(TileIndex tile);
00107
00115 static bool IsDriveThroughRoadStationTile(TileIndex tile);
00116
00123 static bool IsRoadTypeAvailable(RoadType road_type);
00124
00129 static RoadType GetCurrentRoadType();
00130
00135 static void SetCurrentRoadType(RoadType road_type);
00136
00145 static bool HasRoadType(TileIndex tile, RoadType road_type);
00146
00159 static bool AreRoadTilesConnected(TileIndex tile_from, TileIndex tile_to);
00160
00190 static int32 CanBuildConnectedRoadParts(ScriptTile::Slope slope, struct Array *existing, TileIndex start, TileIndex end);
00191
00211 static int32 CanBuildConnectedRoadPartsHere(TileIndex tile, TileIndex start, TileIndex end);
00212
00220 static int32 GetNeighbourRoadCount(TileIndex tile);
00221
00228 static TileIndex GetRoadDepotFrontTile(TileIndex depot);
00229
00236 static TileIndex GetRoadStationFrontTile(TileIndex station);
00237
00246 static TileIndex GetDriveThroughBackTile(TileIndex station);
00247
00269 static bool BuildRoad(TileIndex start, TileIndex end);
00270
00297 static bool BuildOneWayRoad(TileIndex start, TileIndex end);
00298
00321 static bool BuildRoadFull(TileIndex start, TileIndex end);
00322
00350 static bool BuildOneWayRoadFull(TileIndex start, TileIndex end);
00351
00365 static bool BuildRoadDepot(TileIndex tile, TileIndex front);
00366
00390 static bool BuildRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id);
00391
00415 static bool BuildDriveThroughRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id);
00416
00433 static bool RemoveRoad(TileIndex start, TileIndex end);
00434
00452 static bool RemoveRoadFull(TileIndex start, TileIndex end);
00453
00464 static bool RemoveRoadDepot(TileIndex tile);
00465
00476 static bool RemoveRoadStation(TileIndex tile);
00477
00485 static Money GetBuildCost(RoadType roadtype, BuildType build_type);
00486
00493 static uint16 GetMaintenanceCostFactor(RoadType roadtype);
00494
00495 private:
00496
00500 static bool _BuildRoadInternal(TileIndex start, TileIndex end, bool one_way, bool full);
00501
00505 static bool _BuildRoadStationInternal(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, bool drive_through, StationID station_id);
00506 };
00507
00508 #endif