summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-18 22:07:44 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-18 22:07:44 +0000
commit497e5fe565a7092b21e4c8c5ca3ab6cdcf07c822 (patch)
tree0b37f73c50958d5bf1aafa42df0730491c179b20 /src/station_cmd.cpp
parentd947f5cec9fee3f1388cc986e7f32afa1e118b18 (diff)
downloadopenttd-497e5fe565a7092b21e4c8c5ca3ab6cdcf07c822.tar.xz
(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 9a0ece835..663263bbf 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -529,8 +529,9 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
uint amt = min(accepts[i], 15);
// Make sure the station can accept the goods type.
- if ((i != CT_PASSENGERS && !(st->facilities & (byte)~FACIL_BUS_STOP)) ||
- (i == CT_PASSENGERS && !(st->facilities & (byte)~FACIL_TRUCK_STOP)))
+ bool is_passengers = IsCargoInClass(i, CC_PASSENGERS);
+ if ((!is_passengers && !(st->facilities & (byte)~FACIL_BUS_STOP)) ||
+ (is_passengers && !(st->facilities & (byte)~FACIL_TRUCK_STOP)))
amt = 0;
SB(st->goods[i].waiting_acceptance, 12, 4, amt);
@@ -2163,7 +2164,7 @@ static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
if (!rs->IsFreeBay(side)) return VETSB_CANNOT_ENTER;
/* Check if the vehicle is stopping at this road stop */
- if (GetRoadStopType(tile) == ((v->cargo_type == CT_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
+ if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
v->current_order.dest == GetStationIndex(tile)) {
SETBIT(v->u.road.state, RVS_IS_STOPPING);
rs->AllocateDriveThroughBay(side);
@@ -2425,8 +2426,8 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount)
(st->town->exclusive_counter == 0 || st->town->exclusivity == st->owner) && // check exclusive transport rights
st->goods[type].rating != 0 &&
(!_patches.selectgoods || st->goods[type].last_speed > 0) && // if last_speed is 0, no vehicle has been there.
- ((st->facilities & ~FACIL_BUS_STOP) != 0 || type == CT_PASSENGERS) && // if we have other fac. than a bus stop, or the cargo is passengers
- ((st->facilities & ~FACIL_TRUCK_STOP) != 0 || type != CT_PASSENGERS)) { // if we have other fac. than a cargo bay or the cargo is not passengers
+ ((st->facilities & ~FACIL_BUS_STOP) != 0 || IsCargoInClass(type, CC_PASSENGERS)) && // if we have other fac. than a bus stop, or the cargo is passengers
+ ((st->facilities & ~FACIL_TRUCK_STOP) != 0 || !IsCargoInClass(type, CC_PASSENGERS))) { // if we have other fac. than a cargo bay or the cargo is not passengers
if (_patches.modified_catchment) {
// min and max coordinates of the producer relative
const int x_min_prod = 9;