--- a/src/ai/api/ai_cargo.hpp Fri May 23 08:52:29 2008 +0000
+++ b/src/ai/api/ai_cargo.hpp Fri May 23 09:18:04 2008 +0000
@@ -15,6 +15,22 @@
static const char *GetClassName() { return "AICargo"; }
/**
+ * The classes of cargo (from newgrf_cargo.h).
+ */
+ enum CargoClass {
+ CC_PASSENGERS = 1 << 0, ///< Passengers
+ CC_MAIL = 1 << 1, ///< Mail
+ CC_EXPRESS = 1 << 2, ///< Express cargo (Goods, Food, Candy, but also possible for passengers)
+ CC_ARMOURED = 1 << 3, ///< Armoured cargo (Valuables, Gold, Diamonds)
+ CC_BULK = 1 << 4, ///< Bulk cargo (Coal, Grain etc., Ores, Fruit)
+ CC_PIECE_GOODS = 1 << 5, ///< Piece goods (Livestock, Wood, Steel, Paper)
+ CC_LIQUID = 1 << 6, ///< Liquids (Oil, Water, Rubber)
+ CC_REFRIGERATED = 1 << 7, ///< Refrigerated cargo (Food, Fruit)
+ CC_HAZARDOUS = 1 << 8, ///< Hazardous cargo (Nucleair Fuel, Explosives, etc.)
+ CC_COVERED = 1 << 9, ///< Covered/Sheltered Freight (Transporation in Box Vans, Silo Wagons, etc.)
+ };
+
+ /**
* Checks whether the given cargo type is valid.
* @param cargo_type The cargo to check.
* @return True if and only if the cargo type is valid.
@@ -38,6 +54,14 @@
static bool IsFreight(CargoID cargo_type);
/**
+ * Check if this cargo is in the requested cargo class.
+ * @param cargo_type The cargo to check on.
+ * @param cargo_class The class to check for.
+ * @return True if and only if the cargo is in the cargo class.
+ */
+ static bool HasCargoClass(CargoID cargo_type, CargoClass cargo_class);
+
+ /**
* Get the income for transporting a piece of cargo over the
* given distance within the specified time.
* @param cargo_type The cargo to transport.