Changeset - r13456:7f9200df57a3
[Not reviewed]
master
0 20 0
frosch - 15 years ago 2009-11-05 19:46:17
frosch@openttd.org
(svn r17976) -Codechange: Move CargoClass to cargotype.h and clean up including of newgrf_cargo.h
20 files changed with 21 insertions and 28 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_cargo.cpp
Show inline comments
 
@@ -11,13 +11,12 @@
 

	
 
#include "ai_cargo.hpp"
 
#include "../../cargotype.h"
 
#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)
 
{
 
	return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
 
}
 

	
src/aircraft_cmd.cpp
Show inline comments
 
@@ -32,13 +32,12 @@
 
#include "gfx_func.h"
 
#include "ai/ai.hpp"
 
#include "company_func.h"
 
#include "effectvehicle_func.h"
 
#include "station_base.h"
 
#include "cargotype.h"
 
#include "newgrf_cargo.h"
 

	
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
void Aircraft::UpdateDeltaXY(Direction direction)
 
{
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -28,13 +28,12 @@
 
#include "vehicle_func.h"
 
#include "gfx_func.h"
 
#include "widgets/dropdown_func.h"
 
#include "window_gui.h"
 
#include "engine_gui.h"
 
#include "cargotype.h"
 
#include "newgrf_cargo.h"
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
enum BuildVehicleWidgets {
 
	BUILD_VEHICLE_WIDGET_CLOSEBOX = 0,
src/cargotype.cpp
Show inline comments
 
@@ -7,13 +7,12 @@
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/** @file cargotype.cpp Implementation of cargos. */
 

	
 
#include "stdafx.h"
 
#include "newgrf_cargo.h"
 
#include "cargotype.h"
 
#include "core/bitmath_func.hpp"
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "table/cargo_const.h"
src/cargotype.h
Show inline comments
 
@@ -26,12 +26,26 @@ enum TownEffect {
 
	TE_MAIL,
 
	TE_GOODS,
 
	TE_WATER,
 
	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;
 

	
 
struct CargoSpec {
 
	uint8 bitnum;
 
	CargoLabel label;
 
@@ -112,13 +126,13 @@ void SetupCargoForClimate(LandscapeID l)
 
/* Get the cargo icon for a given cargo ID */
 
SpriteID GetCargoSprite(CargoID i);
 
/* Get the cargo ID with the cargo label */
 
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;
 
}
 

	
 
#define FOR_ALL_CARGOSPECS_FROM(var, start) for (size_t cargospec_index = start; var = NULL, cargospec_index < CargoSpec::GetArraySize(); cargospec_index++) \
 
		if ((var = CargoSpec::Get(cargospec_index))->IsValid())
src/economy.cpp
Show inline comments
 
@@ -20,12 +20,13 @@
 
#include "network/network.h"
 
#include "network/network_func.h"
 
#include "vehicle_gui.h"
 
#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"
 
#include "newgrf_industrytiles.h"
 
#include "newgrf_station.h"
 
#include "unmovable.h"
src/industry_cmd.cpp
Show inline comments
 
@@ -22,12 +22,13 @@
 
#include "news_func.h"
 
#include "variables.h"
 
#include "cheat_type.h"
 
#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"
 
#include "autoslope.h"
 
#include "transparency.h"
 
#include "water.h"
src/misc_gui.cpp
Show inline comments
 
@@ -30,13 +30,12 @@
 
#include "company_manager_face.h"
 
#include "strings_func.h"
 
#include "fileio_func.h"
 
#include "fios.h"
 
#include "zoom_func.h"
 
#include "window_func.h"
 
#include "newgrf_cargo.h"
 
#include "tilehighlight_func.h"
 
#include "querystring_gui.h"
 

	
 
#include "table/strings.h"
 

	
 

	
src/newgrf.cpp
Show inline comments
 
@@ -24,12 +24,13 @@
 
#include "town.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_text.h"
 
#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"
 
#include "industry.h"
 
#include "newgrf_canal.h"
 
#include "newgrf_commons.h"
src/newgrf_cargo.h
Show inline comments
 
@@ -13,27 +13,12 @@
 
#define NEWGRF_CARGO_H
 

	
 
#include "newgrf_callbacks.h"
 
#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;
 

	
 
/* Forward declarations of structs used */
 
struct CargoSpec;
src/newgrf_engine.cpp
Show inline comments
 
@@ -12,12 +12,13 @@
 
#include "stdafx.h"
 
#include "debug.h"
 
#include "train.h"
 
#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"
 
#include "vehicle_func.h"
 
#include "core/random_func.hpp"
 
#include "aircraft.h"
src/newgrf_spritegroup.h
Show inline comments
 
@@ -18,13 +18,12 @@
 
#include "gfx_type.h"
 
#include "engine_type.h"
 
#include "tile_type.h"
 
#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"
 

	
 
/**
 
 * Gets the value of a so-called newgrf "register".
src/newgrf_station.cpp
Show inline comments
 
@@ -13,12 +13,13 @@
 
#include "variables.h"
 
#include "landscape.h"
 
#include "debug.h"
 
#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"
 
#include "newgrf_sound.h"
 
#include "town.h"
 
#include "newgrf_town.h"
src/newgrf_station.h
Show inline comments
 
@@ -11,13 +11,12 @@
 

	
 
#ifndef NEWGRF_STATION_H
 
#define NEWGRF_STATION_H
 

	
 
#include "engine_type.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_cargo.h"
 
#include "tile_type.h"
 
#include "station_type.h"
 
#include "strings_type.h"
 
#include "sprite.h"
 
#include "direction_type.h"
 
#include "newgrf.h"
src/order_cmd.cpp
Show inline comments
 
@@ -16,13 +16,12 @@
 
#include "news_func.h"
 
#include "vehicle_gui.h"
 
#include "cargotype.h"
 
#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"
 
#include "roadstop_base.h"
 
#include "core/pool_func.hpp"
 
#include "aircraft.h"
src/order_gui.cpp
Show inline comments
 
@@ -20,13 +20,12 @@
 
#include "timetable.h"
 
#include "cargotype.h"
 
#include "strings_func.h"
 
#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"
 
#include "tilehighlight_func.h"
 
#include "network/network.h"
 
#include "station_base.h"
src/roadveh_cmd.cpp
Show inline comments
 
@@ -33,13 +33,12 @@
 
#include "gfx_func.h"
 
#include "ai/ai.hpp"
 
#include "depot_map.h"
 
#include "effectvehicle_func.h"
 
#include "roadstop_base.h"
 
#include "cargotype.h"
 
#include "newgrf_cargo.h"
 

	
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
static const uint16 _roadveh_images[63] = {
 
	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
src/station_cmd.cpp
Show inline comments
 
@@ -19,12 +19,13 @@
 
#include "command_func.h"
 
#include "town.h"
 
#include "news_func.h"
 
#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"
 
#include "road_internal.h" /* For drawing catenary/checking road removal */
 
#include "variables.h"
 
#include "autoslope.h"
src/water_cmd.cpp
Show inline comments
 
@@ -33,13 +33,12 @@
 
#include "vehicle_func.h"
 
#include "sound_func.h"
 
#include "company_func.h"
 
#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"
 
#include "ai/ai.hpp"
 

	
 
#include "table/sprites.h"
src/yapf/yapf_road.cpp
Show inline comments
 
@@ -9,13 +9,12 @@
 

	
 
/** @file yapf_road.cpp The road pathfinding. */
 

	
 
#include "../stdafx.h"
 
#include "../roadstop_base.h"
 
#include "../cargotype.h"
 
#include "../newgrf_cargo.h"
 

	
 
#include "yapf.hpp"
 
#include "yapf_node_road.hpp"
 

	
 

	
 
template <class Types>
0 comments (0 inline, 0 general)