@ -136,7 +136,7 @@ static bool HaveHangarInOrderList(Vehicle *v)
const Order * order ;
FOR_VEHICLE_ORDERS ( v , order ) {
const Station * st = Get Station( order - > station ) ;
const Station * st = Station: : Get ( order - > station ) ;
if ( st - > owner = = v - > owner & & st - > facilities & FACIL_AIRPORT ) {
/* If an airport doesn't have a hangar, skip it */
if ( st - > Airport ( ) - > nof_depots ! = 0 )
@ -156,7 +156,7 @@ SpriteID Aircraft::GetImage(Direction direction) const
SpriteID sprite = GetCustomVehicleSprite ( this , direction ) ;
if ( sprite ! = 0 ) return sprite ;
spritenum = Get Engine( this - > engine_type ) - > image_index ;
spritenum = Engine: : Get ( this - > engine_type ) - > image_index ;
}
return direction + _aircraft_sprite [ spritenum ] ;
@ -184,7 +184,7 @@ static SpriteID GetAircraftIcon(EngineID engine)
SpriteID sprite = GetCustomVehicleIcon ( engine , DIR_W ) ;
if ( sprite ! = 0 ) return sprite ;
spritenum = Get Engine( engine ) - > image_index ;
spritenum = Engine: : Get ( engine ) - > image_index ;
}
return 6 + _aircraft_sprite [ spritenum ] ;
@ -251,7 +251,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if ( ! IsEngineBuildable ( p1 , VEH_AIRCRAFT , _current_company ) ) return_cmd_error ( STR_AIRCRAFT_NOT_AVAILABLE ) ;
const AircraftVehicleInfo * avi = AircraftVehInfo ( p1 ) ;
const Engine * e = Get Engine( p1 ) ;
const Engine * e = Engine: : Get ( p1 ) ;
CommandCost value ( EXPENSES_NEW_VEHICLES , e - > GetCost ( ) ) ;
/* Engines without valid cargo should not be available */
@ -424,7 +424,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if ( IsLocalCompany ( ) )
InvalidateAutoreplaceWindow ( v - > engine_type , v - > group_id ) ; // updates the replace Aircraft window
Get Company( _current_company ) - > num_engines [ p1 ] + + ;
Company: : Get ( _current_company ) - > num_engines [ p1 ] + + ;
}
return value ;
@ -442,7 +442,7 @@ CommandCost CmdSellAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
{
if ( ! IsValidVehicleID ( p1 ) ) return CMD_ERROR ;
Vehicle * v = Get Vehicle( p1 ) ;
Vehicle * v = Vehicle: : Get ( p1 ) ;
if ( v - > type ! = VEH_AIRCRAFT | | ! CheckOwnership ( v - > owner ) ) return CMD_ERROR ;
if ( ! v - > IsStoppedInDepot ( ) ) return_cmd_error ( STR_ERROR_AIRCRAFT_MUST_BE_STOPPED ) ;
@ -468,7 +468,7 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination,
if ( station = = INVALID_STATION ) return false ;
st = Get Station( station ) ;
st = Station: : Get ( station ) ;
}
if ( location ! = NULL ) * location = st - > xy ;
@ -496,7 +496,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, DoCommandFlag flags, uint32
if ( ! IsValidVehicleID ( p1 ) ) return CMD_ERROR ;
Vehicle * v = Get Vehicle( p1 ) ;
Vehicle * v = Vehicle: : Get ( p1 ) ;
if ( v - > type ! = VEH_AIRCRAFT ) return CMD_ERROR ;
@ -520,7 +520,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if ( ! IsValidVehicleID ( p1 ) ) return CMD_ERROR ;
Vehicle * v = Get Vehicle( p1 ) ;
Vehicle * v = Vehicle: : Get ( p1 ) ;
if ( v - > type ! = VEH_AIRCRAFT | | ! CheckOwnership ( v - > owner ) ) return CMD_ERROR ;
if ( ! v - > IsStoppedInDepot ( ) ) return_cmd_error ( STR_ERROR_AIRCRAFT_MUST_BE_STOPPED ) ;
@ -591,7 +591,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
return ;
}
const Station * st = Get Station( v - > current_order . GetDestination ( ) ) ;
const Station * st = Station: : Get ( v - > current_order . GetDestination ( ) ) ;
/* only goto depot if the target airport has terminals (eg. it is airport) */
if ( st - > IsValid ( ) & & st - > airport_tile ! = INVALID_TILE & & st - > Airport ( ) - > terminals ! = NULL ) {
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
@ -890,7 +890,7 @@ static byte AircraftGetEntryPoint(const Vehicle *v, const AirportFTAClass *apc)
TileIndex tile = 0 ;
if ( IsValidStationID ( v - > u . air . targetairport ) ) {
const Station * st = Get Station( v - > u . air . targetairport ) ;
const Station * st = Station: : Get ( v - > u . air . targetairport ) ;
/* Make sure we don't go to INVALID_TILE if the airport has been removed. */
tile = ( st - > airport_tile ! = INVALID_TILE ) ? st - > airport_tile : st - > xy ;
}
@ -921,7 +921,7 @@ static bool AircraftController(Vehicle *v)
int count ;
/* NULL if station is invalid */
const Station * st = IsValidStationID ( v - > u . air . targetairport ) ? Get Station( v - > u . air . targetairport ) : NULL ;
const Station * st = IsValidStationID ( v - > u . air . targetairport ) ? Station: : Get ( v - > u . air . targetairport ) : NULL ;
/* INVALID_TILE if there is no station */
TileIndex tile = INVALID_TILE ;
if ( st ! = NULL ) {
@ -1326,7 +1326,7 @@ static void CrashAirplane(Vehicle *v)
static void MaybeCrashAirplane ( Vehicle * v )
{
Station * st = Get Station( v - > u . air . targetairport ) ;
Station * st = Station: : Get ( v - > u . air . targetairport ) ;
/* FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports */
uint16 prob = 0x10000 / 1500 ;
@ -1352,7 +1352,7 @@ static void AircraftEntersTerminal(Vehicle *v)
{
if ( v - > current_order . IsType ( OT_GOTO_DEPOT ) ) return ;
Station * st = Get Station( v - > u . air . targetairport ) ;
Station * st = Station: : Get ( v - > u . air . targetairport ) ;
v - > last_station_visited = v - > u . air . targetairport ;
/* Check if station was ever visited before */
@ -1427,7 +1427,7 @@ void AircraftLeaveHangar(Vehicle *v)
static inline bool CheckSendAircraftToHangarForReplacement ( const Vehicle * v )
{
EngineID new_engine ;
Company * c = Get Company( v - > owner ) ;
Company * c = Company: : Get ( v - > owner ) ;
if ( VehicleHasDepotOrders ( v ) ) return false ; // The aircraft will end up in the hangar eventually on it's own
@ -1443,7 +1443,7 @@ static inline bool CheckSendAircraftToHangarForReplacement(const Vehicle *v)
}
}
if ( ! HasBit ( Get Engine( new_engine ) - > company_avail , v - > owner ) ) {
if ( ! HasBit ( Engine: : Get ( new_engine ) - > company_avail , v - > owner ) ) {
/* Engine is not buildable anymore */
return false ;
}
@ -1527,7 +1527,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
/* an exerpt of ServiceAircraft, without the invisibility stuff */
v - > date_of_last_service = _date ;
v - > breakdowns_since_last_service = 0 ;
v - > reliability = Get Engine( v - > engine_type ) - > reliability ;
v - > reliability = Engine: : Get ( v - > engine_type ) - > reliability ;
InvalidateWindow ( WC_VEHICLE_DETAILS , v - > index ) ;
}
}
@ -1556,7 +1556,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
return ;
default : // orders have been deleted (no orders), goto depot and don't bother us
v - > current_order . Free ( ) ;
go_to_hangar = Get Station( v - > u . air . targetairport ) - > Airport ( ) - > nof_depots ! = 0 ;
go_to_hangar = Station: : Get ( v - > u . air . targetairport ) - > Airport ( ) - > nof_depots ! = 0 ;
}
if ( go_to_hangar ) {
@ -1610,7 +1610,7 @@ static void AircraftEventHandler_HeliTakeOff(Vehicle *v, const AirportFTAClass *
static void AircraftEventHandler_Flying ( Vehicle * v , const AirportFTAClass * apc )
{
Station * st = Get Station( v - > u . air . targetairport ) ;
Station * st = Station: : Get ( v - > u . air . targetairport ) ;
/* runway busy or not allowed to use this airstation, circle */
if ( apc - > flags & ( v - > subtype = = AIR_HELICOPTER ? AirportFTAClass : : HELICOPTERS : AirportFTAClass : : AIRPLANES ) & &
@ -1731,7 +1731,7 @@ static void AirportClearBlock(const Vehicle *v, const AirportFTAClass *apc)
{
/* we have left the previous block, and entered the new one. Free the previous block */
if ( apc - > layout [ v - > u . air . previous_pos ] . block ! = apc - > layout [ v - > u . air . pos ] . block ) {
Station * st = Get Station( v - > u . air . targetairport ) ;
Station * st = Station: : Get ( v - > u . air . targetairport ) ;
CLRBITS ( st - > airport_flags , apc - > layout [ v - > u . air . previous_pos ] . block ) ;
}
@ -1742,7 +1742,7 @@ static void AirportGoToNextPosition(Vehicle *v)
/* if aircraft is not in position, wait until it is */
if ( ! AircraftController ( v ) ) return ;
const AirportFTAClass * apc = Get Station( v - > u . air . targetairport ) - > Airport ( ) ;
const AirportFTAClass * apc = Station: : Get ( v - > u . air . targetairport ) - > Airport ( ) ;
AirportClearBlock ( v , apc ) ;
AirportMove ( v , apc ) ; // move aircraft to next position
@ -1805,7 +1805,7 @@ static bool AirportHasBlock(Vehicle *v, const AirportFTA *current_pos, const Air
/* same block, then of course we can move */
if ( apc - > layout [ current_pos - > position ] . block ! = next - > block ) {
const Station * st = Get Station( v - > u . air . targetairport ) ;
const Station * st = Station: : Get ( v - > u . air . targetairport ) ;
uint64 airport_flags = next - > block ;
/* check additional possible extra blocks */
@ -1853,7 +1853,7 @@ static bool AirportSetBlocks(Vehicle *v, const AirportFTA *current_pos, const Ai
* checking , because it has been set by the airplane before */
if ( current_pos - > block = = next - > block ) airport_flags ^ = next - > block ;
Station * st = Get Station( v - > u . air . targetairport ) ;
Station * st = Station: : Get ( v - > u . air . targetairport ) ;
if ( HASBITS ( st - > airport_flags , airport_flags ) ) {
v - > cur_speed = 0 ;
v - > subspeed = 0 ;
@ -1869,7 +1869,7 @@ static bool AirportSetBlocks(Vehicle *v, const AirportFTA *current_pos, const Ai
static bool FreeTerminal ( Vehicle * v , byte i , byte last_terminal )
{
Station * st = Get Station( v - > u . air . targetairport ) ;
Station * st = Station: : Get ( v - > u . air . targetairport ) ;
for ( ; i < last_terminal ; i + + ) {
if ( ! HasBit ( st - > airport_flags , _airport_terminal_flag [ i ] ) ) {
/* TERMINAL# HELIPAD# */
@ -1903,7 +1903,7 @@ static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *apc)
* fails , then attempt fails and plane waits
*/
if ( apc - > terminals [ 0 ] > 1 ) {
const Station * st = Get Station( v - > u . air . targetairport ) ;
const Station * st = Station: : Get ( v - > u . air . targetairport ) ;
const AirportFTA * temp = apc - > layout [ v - > u . air . pos ] . next ;
while ( temp ! = NULL ) {
@ -1954,7 +1954,7 @@ static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc)
/* if there are more helicoptergroups, pick one, just as in AirportFindFreeTerminal() */
if ( apc - > helipads [ 0 ] > 1 ) {
const Station * st = Get Station( v - > u . air . targetairport ) ;
const Station * st = Station: : Get ( v - > u . air . targetairport ) ;
const AirportFTA * temp = apc - > layout [ v - > u . air . pos ] . next ;
while ( temp ! = NULL ) {
@ -2053,7 +2053,7 @@ Station *GetTargetAirportIfValid(const Vehicle *v)
if ( ! IsValidStationID ( sid ) ) return NULL ;
Station * st = Get Station( sid ) ;
Station * st = Station: : Get ( sid ) ;
return st - > airport_tile = = INVALID_TILE ? NULL : st ;
}