mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r16661) -Codechange: move definition of few very short functions to header files
This commit is contained in:
parent
c0ac230e3e
commit
f2e55319dd
@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
CargoSpec _cargo[NUM_CARGO];
|
CargoSpec _cargo[NUM_CARGO];
|
||||||
|
|
||||||
static const byte INVALID_CARGO = 0xFF;
|
|
||||||
|
|
||||||
/* Bitmask of cargo types available */
|
/* Bitmask of cargo types available */
|
||||||
uint32 _cargo_mask;
|
uint32 _cargo_mask;
|
||||||
|
|
||||||
@ -55,19 +53,6 @@ void SetupCargoForClimate(LandscapeID l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const CargoSpec *GetCargo(CargoID c)
|
|
||||||
{
|
|
||||||
assert(c < lengthof(_cargo));
|
|
||||||
return &_cargo[c];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CargoSpec::IsValid() const
|
|
||||||
{
|
|
||||||
return bitnum != INVALID_CARGO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CargoID GetCargoIDByLabel(CargoLabel cl)
|
CargoID GetCargoIDByLabel(CargoLabel cl)
|
||||||
{
|
{
|
||||||
for (CargoID c = 0; c < lengthof(_cargo); c++) {
|
for (CargoID c = 0; c < lengthof(_cargo); c++) {
|
||||||
|
@ -22,6 +22,8 @@ enum TownEffect {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const byte INVALID_CARGO = 0xFF;
|
||||||
|
|
||||||
struct CargoSpec {
|
struct CargoSpec {
|
||||||
uint8 bitnum;
|
uint8 bitnum;
|
||||||
CargoLabel label;
|
CargoLabel label;
|
||||||
@ -48,24 +50,32 @@ struct CargoSpec {
|
|||||||
const struct GRFFile *grffile; ///< NewGRF where 'group' belongs to
|
const struct GRFFile *grffile; ///< NewGRF where 'group' belongs to
|
||||||
const struct SpriteGroup *group;
|
const struct SpriteGroup *group;
|
||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const
|
||||||
|
{
|
||||||
|
return this->bitnum != INVALID_CARGO;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern uint32 _cargo_mask;
|
extern uint32 _cargo_mask;
|
||||||
extern CargoSpec _cargo[NUM_CARGO];
|
extern CargoSpec _cargo[NUM_CARGO];
|
||||||
|
|
||||||
|
|
||||||
/* Set up the default cargo types for the given landscape type */
|
/* Set up the default cargo types for the given landscape type */
|
||||||
void SetupCargoForClimate(LandscapeID l);
|
void SetupCargoForClimate(LandscapeID l);
|
||||||
/* Retrieve cargo details for the given cargo ID */
|
|
||||||
const CargoSpec *GetCargo(CargoID c);
|
|
||||||
/* Get the cargo icon for a given cargo ID */
|
/* Get the cargo icon for a given cargo ID */
|
||||||
SpriteID GetCargoSprite(CargoID i);
|
SpriteID GetCargoSprite(CargoID i);
|
||||||
/* Get the cargo ID with the cargo label */
|
/* Get the cargo ID with the cargo label */
|
||||||
CargoID GetCargoIDByLabel(CargoLabel cl);
|
CargoID GetCargoIDByLabel(CargoLabel cl);
|
||||||
CargoID GetCargoIDByBitnum(uint8 bitnum);
|
CargoID GetCargoIDByBitnum(uint8 bitnum);
|
||||||
|
|
||||||
|
/* Retrieve cargo details for the given cargo ID */
|
||||||
|
static inline const CargoSpec *GetCargo(CargoID c)
|
||||||
|
{
|
||||||
|
assert(c < lengthof(_cargo));
|
||||||
|
return &_cargo[c];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline bool IsCargoInClass(CargoID c, uint16 cc)
|
static inline bool IsCargoInClass(CargoID c, uint16 cc)
|
||||||
{
|
{
|
||||||
return (GetCargo(c)->classes & cc) != 0;
|
return (GetCargo(c)->classes & cc) != 0;
|
||||||
|
@ -186,11 +186,6 @@ void Station::MarkTilesDirty(bool cargo_change) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Station::TileBelongsToRailStation(TileIndex tile) const
|
|
||||||
{
|
|
||||||
return IsRailwayStationTile(tile) && GetStationIndex(tile) == this->index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Obtain the length of a platform
|
/** Obtain the length of a platform
|
||||||
* @pre tile must be a railway station tile
|
* @pre tile must be a railway station tile
|
||||||
* @param tile A tile that contains the platform in question
|
* @param tile A tile that contains the platform in question
|
||||||
@ -241,14 +236,6 @@ uint Station::GetPlatformLength(TileIndex tile, DiagDirection dir) const
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determines whether a station is a buoy only.
|
|
||||||
* @todo Ditch this encoding of buoys
|
|
||||||
*/
|
|
||||||
bool Station::IsBuoy() const
|
|
||||||
{
|
|
||||||
return (had_vehicle_of_type & HVOT_BUOY) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Determines the catchment radius of the station
|
/** Determines the catchment radius of the station
|
||||||
* @return The radius
|
* @return The radius
|
||||||
*/
|
*/
|
||||||
|
@ -160,16 +160,28 @@ public:
|
|||||||
* @ingroup dirty
|
* @ingroup dirty
|
||||||
*/
|
*/
|
||||||
void MarkTilesDirty(bool cargo_change) const;
|
void MarkTilesDirty(bool cargo_change) const;
|
||||||
bool TileBelongsToRailStation(TileIndex tile) const;
|
|
||||||
uint GetPlatformLength(TileIndex tile, DiagDirection dir) const;
|
uint GetPlatformLength(TileIndex tile, DiagDirection dir) const;
|
||||||
uint GetPlatformLength(TileIndex tile) const;
|
uint GetPlatformLength(TileIndex tile) const;
|
||||||
bool IsBuoy() const;
|
|
||||||
|
|
||||||
void RecomputeIndustriesNear();
|
void RecomputeIndustriesNear();
|
||||||
static void RecomputeIndustriesNearForAll();
|
static void RecomputeIndustriesNearForAll();
|
||||||
|
|
||||||
uint GetCatchmentRadius() const;
|
uint GetCatchmentRadius() const;
|
||||||
|
|
||||||
|
FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const
|
||||||
|
{
|
||||||
|
return IsRailwayStationTile(tile) && GetStationIndex(tile) == this->index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether a station is a buoy only.
|
||||||
|
* @todo Ditch this encoding of buoys
|
||||||
|
*/
|
||||||
|
FORCEINLINE bool IsBuoy() const
|
||||||
|
{
|
||||||
|
return (this->had_vehicle_of_type & HVOT_BUOY) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
static FORCEINLINE Station *GetByTile(TileIndex tile)
|
static FORCEINLINE Station *GetByTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
return Station::Get(GetStationIndex(tile));
|
return Station::Get(GetStationIndex(tile));
|
||||||
|
Loading…
Reference in New Issue
Block a user