From 79627b4f8952da6a6d6132d9428ce037aeaae9df Mon Sep 17 00:00:00 2001 From: frosch Date: Thu, 5 Nov 2009 19:46:17 +0000 Subject: [PATCH] (svn r17976) -Codechange: Move CargoClass to cargotype.h and clean up including of newgrf_cargo.h --- src/ai/api/ai_cargo.cpp | 1 - src/aircraft_cmd.cpp | 1 - src/build_vehicle_gui.cpp | 1 - src/cargotype.cpp | 1 - src/cargotype.h | 16 +++++++++++++++- src/economy.cpp | 1 + src/industry_cmd.cpp | 1 + src/misc_gui.cpp | 1 - src/newgrf.cpp | 1 + src/newgrf_cargo.h | 15 --------------- src/newgrf_engine.cpp | 1 + src/newgrf_spritegroup.h | 1 - src/newgrf_station.cpp | 1 + src/newgrf_station.h | 1 - src/order_cmd.cpp | 1 - src/order_gui.cpp | 1 - src/roadveh_cmd.cpp | 1 - src/station_cmd.cpp | 1 + src/water_cmd.cpp | 1 - src/yapf/yapf_road.cpp | 1 - 20 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/ai/api/ai_cargo.cpp b/src/ai/api/ai_cargo.cpp index 9748e02e5d..0a737a08a3 100644 --- a/src/ai/api/ai_cargo.cpp +++ b/src/ai/api/ai_cargo.cpp @@ -14,7 +14,6 @@ #include "../../economy_func.h" #include "../../core/alloc_func.hpp" #include "../../core/bitmath_func.hpp" -#include "../../newgrf_cargo.h" /* static */ bool AICargo::IsValidCargo(CargoID cargo_type) { diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index d90320f073..52ec58de2f 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -35,7 +35,6 @@ #include "effectvehicle_func.h" #include "station_base.h" #include "cargotype.h" -#include "newgrf_cargo.h" #include "table/strings.h" #include "table/sprites.h" diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 8a1c204a3a..87bad30503 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -31,7 +31,6 @@ #include "window_gui.h" #include "engine_gui.h" #include "cargotype.h" -#include "newgrf_cargo.h" #include "table/sprites.h" #include "table/strings.h" diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 4ee0922c25..901326c18e 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -10,7 +10,6 @@ /** @file cargotype.cpp Implementation of cargos. */ #include "stdafx.h" -#include "newgrf_cargo.h" #include "cargotype.h" #include "core/bitmath_func.hpp" diff --git a/src/cargotype.h b/src/cargotype.h index 61814dd6f8..ef7e76ee8b 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -29,6 +29,20 @@ enum TownEffect { TE_FOOD, }; +enum CargoClass { + CC_NOAVAILABLE = 0, ///< No cargo class has been specified + 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 (Nuclear Fuel, Explosives, etc.) + CC_COVERED = 1 << 9, ///< Covered/Sheltered Freight (Transporation in Box Vans, Silo Wagons, etc.) + CC_SPECIAL = 1 << 15 ///< Special bit used for livery refit tricks instead of normal cargoes. +}; static const byte INVALID_CARGO = 0xFF; @@ -115,7 +129,7 @@ SpriteID GetCargoSprite(CargoID i); CargoID GetCargoIDByLabel(CargoLabel cl); CargoID GetCargoIDByBitnum(uint8 bitnum); -static inline bool IsCargoInClass(CargoID c, uint16 cc) +static inline bool IsCargoInClass(CargoID c, CargoClass cc) { return (CargoSpec::Get(c)->classes & cc) != 0; } diff --git a/src/economy.cpp b/src/economy.cpp index 20bc23abe7..78521011b5 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -23,6 +23,7 @@ #include "ai/ai.hpp" #include "aircraft.h" #include "train.h" +#include "newgrf_cargo.h" #include "newgrf_engine.h" #include "newgrf_sound.h" #include "newgrf_industries.h" diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 4161951eea..57d112f478 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -25,6 +25,7 @@ #include "genworld.h" #include "tree_map.h" #include "newgrf.h" +#include "newgrf_cargo.h" #include "newgrf_commons.h" #include "newgrf_industries.h" #include "newgrf_industrytiles.h" diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 04da4cce80..aad9ecbf83 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -33,7 +33,6 @@ #include "fios.h" #include "zoom_func.h" #include "window_func.h" -#include "newgrf_cargo.h" #include "tilehighlight_func.h" #include "querystring_gui.h" diff --git a/src/newgrf.cpp b/src/newgrf.cpp index aa07f17747..f53639211b 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -27,6 +27,7 @@ #include "fontcache.h" #include "currency.h" #include "landscape.h" +#include "newgrf_cargo.h" #include "newgrf_house.h" #include "newgrf_sound.h" #include "newgrf_station.h" diff --git a/src/newgrf_cargo.h b/src/newgrf_cargo.h index 85b3cd15fa..ddebeeb30a 100644 --- a/src/newgrf_cargo.h +++ b/src/newgrf_cargo.h @@ -16,21 +16,6 @@ #include "cargo_type.h" #include "gfx_type.h" -enum CargoClass { - CC_NOAVAILABLE = 0, ///< No cargo class has been specified - 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 (Nuclear Fuel, Explosives, etc.) - CC_COVERED = 1 << 9, ///< Covered/Sheltered Freight (Transporation in Box Vans, Silo Wagons, etc.) - CC_SPECIAL = 1 << 15 ///< Special bit used for livery refit tricks instead of normal cargoes. -}; - static const CargoID CT_DEFAULT = NUM_CARGO + 0; static const CargoID CT_PURCHASE = NUM_CARGO + 1; static const CargoID CT_DEFAULT_NA = NUM_CARGO + 2; diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 1103bf3b3a..b49f9dbfbe 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -15,6 +15,7 @@ #include "roadveh.h" #include "company_func.h" #include "newgrf.h" +#include "newgrf_cargo.h" #include "newgrf_engine.h" #include "newgrf_spritegroup.h" #include "date_func.h" diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 69086fce26..056f95e35d 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -21,7 +21,6 @@ #include "core/pool_type.hpp" #include "house_type.h" -#include "newgrf_cargo.h" #include "newgrf_callbacks.h" #include "newgrf_generic.h" #include "newgrf_storage.h" diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index e3d1ff3d9d..b701ec3b66 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -16,6 +16,7 @@ #include "station_base.h" #include "waypoint_base.h" #include "roadstop_base.h" +#include "newgrf_cargo.h" #include "newgrf_commons.h" #include "newgrf_station.h" #include "newgrf_spritegroup.h" diff --git a/src/newgrf_station.h b/src/newgrf_station.h index b13b05d862..25d5831c70 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -14,7 +14,6 @@ #include "engine_type.h" #include "newgrf_callbacks.h" -#include "newgrf_cargo.h" #include "tile_type.h" #include "station_type.h" #include "strings_type.h" diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 6660c07b30..dc99b258b6 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -19,7 +19,6 @@ #include "strings_func.h" #include "functions.h" #include "window_func.h" -#include "newgrf_cargo.h" #include "timetable.h" #include "vehicle_func.h" #include "depot_base.h" diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 071b1cbfb8..847a38ecbb 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -23,7 +23,6 @@ #include "window_func.h" #include "vehicle_func.h" #include "company_func.h" -#include "newgrf_cargo.h" #include "widgets/dropdown_func.h" #include "textbuf_gui.h" #include "string_func.h" diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index f482c0ebb7..8aebc4e4d3 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -36,7 +36,6 @@ #include "effectvehicle_func.h" #include "roadstop_base.h" #include "cargotype.h" -#include "newgrf_cargo.h" #include "table/strings.h" #include "table/sprites.h" diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 7462028680..769c8d2d07 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -22,6 +22,7 @@ #include "train.h" #include "roadveh.h" #include "industry.h" +#include "newgrf_cargo.h" #include "newgrf_station.h" #include "newgrf_commons.h" #include "yapf/yapf.h" diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 2c9a3a9aff..9149614615 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -36,7 +36,6 @@ #include "clear_map.h" #include "tree_map.h" #include "aircraft.h" -#include "newgrf_cargo.h" #include "effectvehicle_func.h" #include "tunnelbridge_map.h" #include "station_base.h" diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp index f4bfae46d0..30b65705e8 100644 --- a/src/yapf/yapf_road.cpp +++ b/src/yapf/yapf_road.cpp @@ -12,7 +12,6 @@ #include "../stdafx.h" #include "../roadstop_base.h" #include "../cargotype.h" -#include "../newgrf_cargo.h" #include "yapf.hpp" #include "yapf_node_road.hpp"