diff src/order_cmd.cpp @ 6329:34db8eef99ef draft

(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
author peter1138 <peter1138@openttd.org>
date Sun, 18 Mar 2007 22:07:44 +0000
parents 715aa17970ab
children aacb290b6c73
line wrap: on
line diff
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -15,6 +15,7 @@
 #include "news.h"
 #include "saveload.h"
 #include "vehicle_gui.h"
+#include "cargotype.h"
 
 /**
  * Called if a new block is added to the order-pool
@@ -218,7 +219,7 @@
 					break;
 
 				case VEH_ROAD:
-					if (v->cargo_type == CT_PASSENGERS) {
+					if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) {
 						if (!(st->facilities & FACIL_BUS_STOP)) return CMD_ERROR;
 					} else {
 						if (!(st->facilities & FACIL_TRUCK_STOP)) return CMD_ERROR;
@@ -685,7 +686,7 @@
 
 			/* Trucks can't share orders with busses (and visa versa) */
 			if (src->type == VEH_ROAD) {
-				if (src->cargo_type != dst->cargo_type && (src->cargo_type == CT_PASSENGERS || dst->cargo_type == CT_PASSENGERS))
+				if (src->cargo_type != dst->cargo_type && (IsCargoInClass(src->cargo_type, CC_PASSENGERS) || IsCargoInClass(dst->cargo_type, CC_PASSENGERS)))
 					return CMD_ERROR;
 			}
 
@@ -738,7 +739,7 @@
 				FOR_VEHICLE_ORDERS(src, order) {
 					if (order->type == OT_GOTO_STATION) {
 						const Station *st = GetStation(order->dest);
-						if (dst->cargo_type == CT_PASSENGERS) {
+						if (IsCargoInClass(dst->cargo_type, CC_PASSENGERS)) {
 							if (st->bus_stops != NULL) required_dst = st->bus_stops->xy;
 						} else {
 							if (st->truck_stops != NULL) required_dst = st->truck_stops->xy;
@@ -953,7 +954,7 @@
 		case VEH_AIRCRAFT:  return st->airport_tile;
 		case VEH_SHIP:      return st->dock_tile;
 		case VEH_ROAD:
-			if (v->cargo_type == CT_PASSENGERS) {
+			if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) {
 				return (st->bus_stops != NULL) ? st->bus_stops->xy : 0;
 			} else {
 				return (st->truck_stops != NULL) ? st->truck_stops->xy : 0;