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 = 0,
00050 ROADTYPE_TRAM = 1,
00051
00052 ROADTYPE_INVALID = -1,
00053 };
00054
00058 enum RoadVehicleType {
00059 ROADVEHTYPE_BUS,
00060 ROADVEHTYPE_TRUCK,
00061 };
00062
00066 enum BuildType {
00067 BT_ROAD,
00068 BT_DEPOT,
00069 BT_BUS_STOP,
00070 BT_TRUCK_STOP,
00071 };
00072
00079 static RoadVehicleType GetRoadVehicleTypeForCargo(CargoID cargo_type);
00080
00089 static bool IsRoadTile(TileIndex tile);
00090
00097 static bool IsRoadDepotTile(TileIndex tile);
00098
00105 static bool IsRoadStationTile(TileIndex tile);
00106
00114 static bool IsDriveThroughRoadStationTile(TileIndex tile);
00115
00121 static bool IsRoadTypeAvailable(RoadType road_type);
00122
00127 static RoadType GetCurrentRoadType();
00128
00133 static void SetCurrentRoadType(RoadType road_type);
00134
00143 static bool HasRoadType(TileIndex tile, RoadType road_type);
00144
00157 static bool AreRoadTilesConnected(TileIndex tile_from, TileIndex tile_to);
00158
00188 static int32 CanBuildConnectedRoadParts(ScriptTile::Slope slope, struct Array *existing, TileIndex start, TileIndex end);
00189
00209 static int32 CanBuildConnectedRoadPartsHere(TileIndex tile, TileIndex start, TileIndex end);
00210
00218 static int32 GetNeighbourRoadCount(TileIndex tile);
00219
00226 static TileIndex GetRoadDepotFrontTile(TileIndex depot);
00227
00234 static TileIndex GetRoadStationFrontTile(TileIndex station);
00235
00244 static TileIndex GetDriveThroughBackTile(TileIndex station);
00245
00266 static bool BuildRoad(TileIndex start, TileIndex end);
00267
00293 static bool BuildOneWayRoad(TileIndex start, TileIndex end);
00294
00316 static bool BuildRoadFull(TileIndex start, TileIndex end);
00317
00344 static bool BuildOneWayRoadFull(TileIndex start, TileIndex end);
00345
00358 static bool BuildRoadDepot(TileIndex tile, TileIndex front);
00359
00382 static bool BuildRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id);
00383
00406 static bool BuildDriveThroughRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id);
00407
00423 static bool RemoveRoad(TileIndex start, TileIndex end);
00424
00441 static bool RemoveRoadFull(TileIndex start, TileIndex end);
00442
00452 static bool RemoveRoadDepot(TileIndex tile);
00453
00463 static bool RemoveRoadStation(TileIndex tile);
00464
00472 static Money GetBuildCost(RoadType roadtype, BuildType build_type);
00473
00480 static uint16 GetMaintenanceCostFactor(RoadType roadtype);
00481
00482 private:
00483
00487 static bool _BuildRoadInternal(TileIndex start, TileIndex end, bool one_way, bool full);
00488
00492 static bool _BuildRoadStationInternal(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, bool drive_through, StationID station_id);
00493 };
00494
00495 #endif