#include "vehicle_base.h"
#include "functions.h"
#include "company_func.h"
Go to the source code of this file.
Functions | |
void | PayStationSharingFee (Vehicle *v, const Station *st) |
Pay the fee for spending a single tick inside a station. | |
void | PayDailyTrackSharingFee (Train *v) |
Pay the daily fee for trains on foreign tracks. | |
bool | CheckSharingChangePossible (VehicleType type) |
Check if a sharing change is possible. | |
void | HandleSharingCompanyDeletion (Owner owner) |
Handle the removal (through reset_company or bankruptcy) of a company. | |
void | UpdateAllBlockSignals (Owner owner=INVALID_OWNER) |
Update all block signals on the map. | |
static FORCEINLINE bool | GetSharingSetting (VehicleType type) |
Get the value of the sharing setting for a vehicle type. | |
static FORCEINLINE bool | IsInfraUsageAllowed (Owner infra_owner, Owner veh_owner, VehicleType type) |
Check whether a vehicle of a given owner and type can use the infrastrucutre of a given company. | |
static FORCEINLINE bool | IsInfraTileUsageAllowed (TileIndex tile, Owner veh_owner, VehicleType type) |
Check whether a vehicle of a given owner and type can use the infrastrucutre on a given tile. | |
static FORCEINLINE bool | CheckInfraUsageAllowed (Owner infra_owner, VehicleType type) |
Is a vehicle owned by _current_company allowed to use the infrastructure of infra_owner? | |
static FORCEINLINE bool | IsVehicleControlAllowed (const Vehicle *v, Owner o) |
Check whether a given company can control this vehicle. | |
static FORCEINLINE bool | CheckVehicleControlAllowed (const Vehicle *v) |
Check whether _current_company can control this vehicle. | |
static FORCEINLINE bool | IsOneSignalBlock (Owner o1, Owner o2) |
Do signal states propagate from the tracks of one owner to the other? |
Definition in file infrastructure_func.h.
static FORCEINLINE bool CheckInfraUsageAllowed | ( | Owner | infra_owner, | |
VehicleType | type | |||
) | [static] |
Is a vehicle owned by _current_company allowed to use the infrastructure of infra_owner?
infra_owner | Owner of the infrastructure. | |
type | Type of vehicle. |
Definition at line 73 of file infrastructure_func.h.
References GetSharingSetting(), and OWNER_NONE.
Referenced by CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVeh(), CmdBuildShip(), CmdDepotMassAutoReplace(), and CmdInsertOrder().
bool CheckSharingChangePossible | ( | VehicleType | type | ) |
Check if a sharing change is possible.
If vehicles are still on others' infrastructure or using others' stations, The change is not possible and false is returned.
type | The type of vehicle whose setting will be changed. |
Definition at line 211 of file infrastructure.cpp.
References FixAllReservations(), GetSharingSetting(), INVALID_STRING_ID, INVALID_TILE, INVALID_TRACK, OrderDestinationIsAllowed(), ShowErrorMessage(), VEH_AIRCRAFT, VEH_TRAIN, VehiclePositionIsAllowed(), and YapfNotifyTrackLayoutChange().
static FORCEINLINE bool CheckVehicleControlAllowed | ( | const Vehicle * | v | ) | [static] |
Check whether _current_company can control this vehicle.
v | The vehicle which may or may not be controlled. |
Definition at line 97 of file infrastructure_func.h.
References IsTileOwner(), and VEH_TRAIN.
Referenced by CmdForceTrainProceed(), CmdReverseTrainDirection(), CmdStartStopVehicle(), and CmdTurnRoadVeh().
static FORCEINLINE bool GetSharingSetting | ( | VehicleType | type | ) | [static] |
Get the value of the sharing setting for a vehicle type.
type | The type of vehicle. |
Definition at line 30 of file infrastructure_func.h.
References _settings_game, GameSettings::sharing, SharingSettings::sharing_air, SharingSettings::sharing_rail, SharingSettings::sharing_road, SharingSettings::sharing_water, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by CheckInfraUsageAllowed(), CheckSharingChangePossible(), and IsInfraUsageAllowed().
void HandleSharingCompanyDeletion | ( | Owner | owner | ) |
Handle the removal (through reset_company or bankruptcy) of a company.
i.e. remove all vehicles owned by that company or on its infrastructure, and delete all now-invalid orders.
Owner | the company to be removed. |
Definition at line 261 of file infrastructure.cpp.
References INVALID_TILE, INVALID_TRACK, INVALID_VEH_ORDER_ID, InvalidateVehicleOrder(), OrderDestinationIsAllowed(), RemoveAndSellVehicle(), SetWindowDirty(), VehiclePositionIsAllowed(), and YapfNotifyTrackLayoutChange().
static FORCEINLINE bool IsInfraTileUsageAllowed | ( | TileIndex | tile, | |
Owner | veh_owner, | |||
VehicleType | type | |||
) | [static] |
Check whether a vehicle of a given owner and type can use the infrastrucutre on a given tile.
infra_owner | The tile that may or may not be used. | |
veh_owner | Owner of the vehicle in question. | |
type | Type of vehicle we are talking about. |
Definition at line 60 of file infrastructure_func.h.
References GetTileOwner(), and IsInfraUsageAllowed().
Referenced by CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CanEnterTileOwnerCheck(), and RoadFindPathToDest().
static FORCEINLINE bool IsInfraUsageAllowed | ( | Owner | infra_owner, | |
Owner | veh_owner, | |||
VehicleType | type | |||
) | [static] |
Check whether a vehicle of a given owner and type can use the infrastrucutre of a given company.
infra_owner | The owner of the infrastructure. | |
veh_owner | Owner of the vehicle in question. | |
type | Type of vehicle we are talking about. |
Definition at line 48 of file infrastructure_func.h.
References GetSharingSetting(), and OWNER_NONE.
Referenced by FindNearestHangar(), IsInfraTileUsageAllowed(), OrderDestinationIsAllowed(), and VehiclePositionIsAllowed().
Do signal states propagate from the tracks of one owner to the other?
o1 | First track owner. | |
o2 | Second track owner. |
Definition at line 110 of file infrastructure_func.h.
References _settings_game, GameSettings::sharing, and SharingSettings::sharing_rail.
Referenced by AddSideToSignalBuffer(), AddTrackToSignalBuffer(), ExploreSegment(), and UpdateAllBlockSignals().
static FORCEINLINE bool IsVehicleControlAllowed | ( | const Vehicle * | v, | |
Owner | o | |||
) | [static] |
Check whether a given company can control this vehicle.
Controlling a vehicle means permission to start, stop or reverse it or to make it ignore signals.
v | The vehicle which may or may not be controlled. | |
o | The company which may or may not control this vehicle. |
Definition at line 85 of file infrastructure_func.h.
References IsTileOwner(), and VEH_TRAIN.
Referenced by VehicleViewWindow::OnPaint().
void PayDailyTrackSharingFee | ( | Train * | v | ) |
Pay the daily fee for trains on foreign tracks.
v | The vehicle to pay the fee for. |
Definition at line 68 of file infrastructure.cpp.
References _settings_game, TrainCache::cached_weight, DAY_TICKS, SharingSettings::fee_rail, GetTileOwner(), PaySharingFee(), GameSettings::sharing, and Train::tcache.
void PayStationSharingFee | ( | Vehicle * | v, | |
const Station * | st | |||
) |
Pay the fee for spending a single tick inside a station.
v | The vehicle that is using the station. | |
st | The station that it uses. |
Definition at line 51 of file infrastructure.cpp.
References _settings_game, DAY_TICKS, SharingSettings::fee_air, SharingSettings::fee_road, SharingSettings::fee_water, BaseStation::owner, OWNER_NONE, PaySharingFee(), GameSettings::sharing, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
void UpdateAllBlockSignals | ( | Owner | owner | ) |
Update all block signals on the map.
To be called after the setting for sharing of rails changes.
owner | Owner whose signals to update. If INVALID_OWNER, update everything. |
Definition at line 307 of file infrastructure.cpp.
References AddTrackToSignalBuffer(), GetTileOwner(), GetTrackBits(), HasSignalOnTrack(), HasSignals(), INVALID_OWNER, IsOneSignalBlock(), IsTileType(), MapSize(), MP_RAILWAY, RemoveFirstTrack(), TRACK_BIT_NONE, UpdateLevelCrossing(), and UpdateSignalsInBuffer().