mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Rename *Railtype* to *RailType* for consistency. (#11287)
This commit is contained in:
parent
a0b2f28f9c
commit
acd7d3c913
|
@ -357,7 +357,7 @@ public:
|
|||
switch (this->window_number) {
|
||||
case VEH_TRAIN:
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
/* Skip rail type if it has no label */
|
||||
if (rti->label == 0) continue;
|
||||
d = maxdim(d, GetStringBoundingBox(rti->strings.replace_text));
|
||||
|
|
|
@ -1698,7 +1698,7 @@ struct BuildVehicleWindow : Window {
|
|||
switch (widget) {
|
||||
case WID_BV_CAPTION:
|
||||
if (this->vehicle_type == VEH_TRAIN && !this->listview_mode) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(this->filter.railtype);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(this->filter.railtype);
|
||||
SetDParam(0, rti->strings.build_caption);
|
||||
} else if (this->vehicle_type == VEH_ROAD && !this->listview_mode) {
|
||||
const RoadTypeInfo *rti = GetRoadTypeInfo(this->filter.roadtype);
|
||||
|
|
|
@ -563,7 +563,7 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY)
|
|||
/* Scale the initial loan based on the inflation rounded down to the loan interval. The maximum loan has already been inflation adjusted. */
|
||||
c->money = c->current_loan = std::min<int64_t>((INITIAL_LOAN * _economy.inflation_prices >> 16) / LOAN_INTERVAL * LOAN_INTERVAL, _economy.max_loan);
|
||||
|
||||
c->avail_railtypes = GetCompanyRailtypes(c->index);
|
||||
c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
||||
c->inaugurated_year = TimerGameCalendar::year;
|
||||
|
||||
|
|
|
@ -2398,7 +2398,7 @@ static void ConDumpRailTypes()
|
|||
|
||||
std::map<uint32_t, const GRFFile *> grfs;
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt < RAILTYPE_END; rt++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
if (rti->label == 0) continue;
|
||||
uint32_t grfid = 0;
|
||||
const GRFFile *grf = rti->grffile[RTSG_GROUND];
|
||||
|
|
|
@ -176,7 +176,7 @@ static TrackBits MaskWireBits(TileIndex t, TrackBits tracks)
|
|||
*/
|
||||
static inline SpriteID GetWireBase(TileIndex tile, TileContext context = TCX_NORMAL)
|
||||
{
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
SpriteID wires = GetCustomRailSprite(rti, tile, RTSG_WIRES, context);
|
||||
return wires == 0 ? SPR_WIRE_BASE : wires;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ static inline SpriteID GetWireBase(TileIndex tile, TileContext context = TCX_NOR
|
|||
*/
|
||||
static inline SpriteID GetPylonBase(TileIndex tile, TileContext context = TCX_NORMAL)
|
||||
{
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
SpriteID pylons = GetCustomRailSprite(rti, tile, RTSG_PYLONS, context);
|
||||
return pylons == 0 ? SPR_PYLON_BASE : pylons;
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ void SettingsDisableElrail(int32_t new_value)
|
|||
}
|
||||
}
|
||||
|
||||
for (Company *c : Company::Iterate()) c->avail_railtypes = GetCompanyRailtypes(c->index);
|
||||
for (Company *c : Company::Iterate()) c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
|
||||
/* This resets the _last_built_railtype, which will be invalid for electric
|
||||
* rails. It may have unintended consequences if that function is ever
|
||||
|
|
|
@ -756,7 +756,7 @@ void StartupEngines()
|
|||
|
||||
/* Update the bitmasks for the vehicle lists */
|
||||
for (Company *c : Company::Iterate()) {
|
||||
c->avail_railtypes = GetCompanyRailtypes(c->index);
|
||||
c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
||||
}
|
||||
|
||||
|
@ -779,7 +779,7 @@ static void EnableEngineForCompany(EngineID eid, CompanyID company)
|
|||
|
||||
SetBit(e->company_avail, company);
|
||||
if (e->type == VEH_TRAIN) {
|
||||
c->avail_railtypes = GetCompanyRailtypes(c->index);
|
||||
c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
} else if (e->type == VEH_ROAD) {
|
||||
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ static void DisableEngineForCompany(EngineID eid, CompanyID company)
|
|||
|
||||
ClrBit(e->company_avail, company);
|
||||
if (e->type == VEH_TRAIN) {
|
||||
c->avail_railtypes = GetCompanyRailtypes(c->index);
|
||||
c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
} else if (e->type == VEH_ROAD) {
|
||||
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
||||
}
|
||||
|
|
|
@ -4212,7 +4212,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
|
|||
{
|
||||
ChangeInfoResult ret = CIR_SUCCESS;
|
||||
|
||||
extern RailtypeInfo _railtypes[RAILTYPE_END];
|
||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
|
||||
if (id + numinfo > RAILTYPE_END) {
|
||||
GrfMsg(1, "RailTypeChangeInfo: Rail type {} is invalid, max {}, ignoring", id + numinfo, RAILTYPE_END);
|
||||
|
@ -4223,7 +4223,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
|
|||
RailType rt = _cur.grffile->railtype_map[id + i];
|
||||
if (rt == INVALID_RAILTYPE) return CIR_INVALID_ID;
|
||||
|
||||
RailtypeInfo *rti = &_railtypes[rt];
|
||||
RailTypeInfo *rti = &_railtypes[rt];
|
||||
|
||||
switch (prop) {
|
||||
case 0x08: // Label of rail type
|
||||
|
@ -4342,7 +4342,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte
|
|||
{
|
||||
ChangeInfoResult ret = CIR_SUCCESS;
|
||||
|
||||
extern RailtypeInfo _railtypes[RAILTYPE_END];
|
||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
|
||||
if (id + numinfo > RAILTYPE_END) {
|
||||
GrfMsg(1, "RailTypeReserveInfo: Rail type {} is invalid, max {}, ignoring", id + numinfo, RAILTYPE_END);
|
||||
|
@ -5929,10 +5929,10 @@ static void RailTypeMapSpriteGroup(ByteReader *buf, uint8_t idcount)
|
|||
|
||||
if (ctype >= RTSG_END) continue;
|
||||
|
||||
extern RailtypeInfo _railtypes[RAILTYPE_END];
|
||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
for (auto &railtype : railtypes) {
|
||||
if (railtype != INVALID_RAILTYPE) {
|
||||
RailtypeInfo *rti = &_railtypes[railtype];
|
||||
RailTypeInfo *rti = &_railtypes[railtype];
|
||||
|
||||
rti->grffile[ctype] = _cur.grffile;
|
||||
rti->group[ctype] = _cur.spritegroups[groupid];
|
||||
|
@ -7595,7 +7595,7 @@ static void ParamSet(ByteReader *buf)
|
|||
break;
|
||||
|
||||
case 0x8F: { // Rail track type cost factors
|
||||
extern RailtypeInfo _railtypes[RAILTYPE_END];
|
||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
_railtypes[RAILTYPE_RAIL].cost_multiplier = GB(res, 0, 8);
|
||||
if (_settings_game.vehicle.disable_elrails) {
|
||||
_railtypes[RAILTYPE_ELECTRIC].cost_multiplier = GB(res, 0, 8);
|
||||
|
|
|
@ -578,7 +578,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
|
|||
switch (v->type) {
|
||||
case VEH_TRAIN: {
|
||||
RailType rt = GetTileRailType(v->tile);
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
return ((rti->flags & RTFB_CATENARY) ? 0x200 : 0) |
|
||||
(HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) |
|
||||
GetReverseRailTypeTranslation(rt, object->ro.grffile);
|
||||
|
|
|
@ -78,7 +78,7 @@ uint32_t RailTypeResolverObject::GetDebugID() const
|
|||
* @param param1 Extra parameter (first parameter of the callback, except railtypes do not have callbacks).
|
||||
* @param param2 Extra parameter (second parameter of the callback, except railtypes do not have callbacks).
|
||||
*/
|
||||
RailTypeResolverObject::RailTypeResolverObject(const RailtypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32_t param1, uint32_t param2)
|
||||
RailTypeResolverObject::RailTypeResolverObject(const RailTypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32_t param1, uint32_t param2)
|
||||
: ResolverObject(rti != nullptr ? rti->grffile[rtsg] : nullptr, CBID_NO_CALLBACK, param1, param2), railtype_scope(*this, rti, tile, context)
|
||||
{
|
||||
this->root_spritegroup = rti != nullptr ? rti->group[rtsg] : nullptr;
|
||||
|
@ -93,7 +93,7 @@ RailTypeResolverObject::RailTypeResolverObject(const RailtypeInfo *rti, TileInde
|
|||
* @param[out] num_results If not nullptr, return the number of sprites in the spriteset.
|
||||
* @return The sprite to draw.
|
||||
*/
|
||||
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
|
||||
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
|
||||
{
|
||||
assert(rtsg < RTSG_END);
|
||||
|
||||
|
@ -118,7 +118,7 @@ SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSp
|
|||
* @param gui Is the sprite being used on the map or in the GUI?
|
||||
* @return The sprite to draw.
|
||||
*/
|
||||
SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui)
|
||||
SpriteID GetCustomSignalSprite(const RailTypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui)
|
||||
{
|
||||
if (rti->group[RTSG_SIGNALS] == nullptr) return 0;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
struct RailTypeScopeResolver : public ScopeResolver {
|
||||
TileIndex tile; ///< Tracktile. For track on a bridge this is the southern bridgehead.
|
||||
TileContext context; ///< Are we resolving sprites for the upper halftile, or on a bridge?
|
||||
const RailtypeInfo *rti;
|
||||
const RailTypeInfo *rti;
|
||||
|
||||
/**
|
||||
* Constructor of the railtype scope resolvers.
|
||||
|
@ -26,7 +26,7 @@ struct RailTypeScopeResolver : public ScopeResolver {
|
|||
* @param tile %Tile containing the track. For track on a bridge this is the southern bridgehead.
|
||||
* @param context Are we resolving sprites for the upper halftile, or on a bridge?
|
||||
*/
|
||||
RailTypeScopeResolver(ResolverObject &ro, const RailtypeInfo *rti, TileIndex tile, TileContext context)
|
||||
RailTypeScopeResolver(ResolverObject &ro, const RailTypeInfo *rti, TileIndex tile, TileContext context)
|
||||
: ScopeResolver(ro), tile(tile), context(context), rti(rti)
|
||||
{
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ struct RailTypeScopeResolver : public ScopeResolver {
|
|||
struct RailTypeResolverObject : public ResolverObject {
|
||||
RailTypeScopeResolver railtype_scope; ///< Resolver for the railtype scope.
|
||||
|
||||
RailTypeResolverObject(const RailtypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32_t param1 = 0, uint32_t param2 = 0);
|
||||
RailTypeResolverObject(const RailTypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32_t param1 = 0, uint32_t param2 = 0);
|
||||
|
||||
ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
|
||||
{
|
||||
|
@ -53,8 +53,8 @@ struct RailTypeResolverObject : public ResolverObject {
|
|||
uint32_t GetDebugID() const override;
|
||||
};
|
||||
|
||||
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = nullptr);
|
||||
SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false);
|
||||
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = nullptr);
|
||||
SpriteID GetCustomSignalSprite(const RailTypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false);
|
||||
|
||||
RailType GetRailTypeTranslation(uint8_t railtype, const GRFFile *grffile);
|
||||
uint8_t GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile);
|
||||
|
|
|
@ -768,7 +768,7 @@ void DeallocateSpecFromStation(BaseStation *st, byte specindex)
|
|||
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station)
|
||||
{
|
||||
const DrawTileSprites *sprites = nullptr;
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(railtype);
|
||||
PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
||||
uint tile = 2;
|
||||
|
||||
|
|
16
src/rail.cpp
16
src/rail.cpp
|
@ -183,7 +183,7 @@ RailType GetTileRailType(Tile tile)
|
|||
* @param railtype requested RailType
|
||||
* @return true if company has requested RailType available
|
||||
*/
|
||||
bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
|
||||
bool HasRailTypeAvail(const CompanyID company, const RailType railtype)
|
||||
{
|
||||
return !HasBit(_railtypes_hidden_mask, railtype) && HasBit(Company::Get(company)->avail_railtypes, railtype);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
|
|||
* @param company the company in question
|
||||
* @return true if company has any RailTypes available
|
||||
*/
|
||||
bool HasAnyRailtypesAvail(const CompanyID company)
|
||||
bool HasAnyRailTypesAvail(const CompanyID company)
|
||||
{
|
||||
return (Company::Get(company)->avail_railtypes & ~_railtypes_hidden_mask) != 0;
|
||||
}
|
||||
|
@ -203,9 +203,9 @@ bool HasAnyRailtypesAvail(const CompanyID company)
|
|||
* @param rail the railtype to check.
|
||||
* @return true if the current company may build the rail.
|
||||
*/
|
||||
bool ValParamRailtype(const RailType rail)
|
||||
bool ValParamRailType(const RailType rail)
|
||||
{
|
||||
return rail < RAILTYPE_END && HasRailtypeAvail(_current_company, rail);
|
||||
return rail < RAILTYPE_END && HasRailTypeAvail(_current_company, rail);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,7 +220,7 @@ RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date
|
|||
RailTypes rts = current;
|
||||
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
/* Unused rail type. */
|
||||
if (rti->label == 0) continue;
|
||||
|
||||
|
@ -248,7 +248,7 @@ RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date
|
|||
* @param introduces If true, include rail types introduced by other rail types
|
||||
* @return the rail types.
|
||||
*/
|
||||
RailTypes GetCompanyRailtypes(CompanyID company, bool introduces)
|
||||
RailTypes GetCompanyRailTypes(CompanyID company, bool introduces)
|
||||
{
|
||||
RailTypes rts = RAILTYPES_NONE;
|
||||
|
||||
|
@ -312,14 +312,14 @@ RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
|
|||
{
|
||||
/* Loop through each rail type until the label is found */
|
||||
for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(r);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(r);
|
||||
if (rti->label == label) return r;
|
||||
}
|
||||
|
||||
if (allow_alternate_labels) {
|
||||
/* Test if any rail type defines the label as an alternate. */
|
||||
for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(r);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(r);
|
||||
if (std::find(rti->alternate_labels.begin(), rti->alternate_labels.end(), label) != rti->alternate_labels.end()) return r;
|
||||
}
|
||||
}
|
||||
|
|
20
src/rail.h
20
src/rail.h
|
@ -121,7 +121,7 @@ typedef std::vector<RailTypeLabel> RailTypeLabelList;
|
|||
/**
|
||||
* This struct contains all the info that is needed to draw and construct tracks.
|
||||
*/
|
||||
class RailtypeInfo {
|
||||
class RailTypeInfo {
|
||||
public:
|
||||
/**
|
||||
* Struct containing the main sprites. @note not all sprites are listed, but only
|
||||
|
@ -299,11 +299,11 @@ public:
|
|||
/**
|
||||
* Returns a pointer to the Railtype information for a given railtype
|
||||
* @param railtype the rail type which the information is requested for
|
||||
* @return The pointer to the RailtypeInfo
|
||||
* @return The pointer to the RailTypeInfo
|
||||
*/
|
||||
static inline const RailtypeInfo *GetRailTypeInfo(RailType railtype)
|
||||
static inline const RailTypeInfo *GetRailTypeInfo(RailType railtype)
|
||||
{
|
||||
extern RailtypeInfo _railtypes[RAILTYPE_END];
|
||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
assert(railtype < RAILTYPE_END);
|
||||
return &_railtypes[railtype];
|
||||
}
|
||||
|
@ -355,8 +355,8 @@ static inline bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def
|
|||
{
|
||||
if (rt1 == INVALID_RAILTYPE || rt2 == INVALID_RAILTYPE) return def;
|
||||
|
||||
const RailtypeInfo *rti1 = GetRailTypeInfo(rt1);
|
||||
const RailtypeInfo *rti2 = GetRailTypeInfo(rt2);
|
||||
const RailTypeInfo *rti1 = GetRailTypeInfo(rt1);
|
||||
const RailTypeInfo *rti2 = GetRailTypeInfo(rt2);
|
||||
|
||||
bool rt1_90deg = HasBit(rti1->flags, RTF_DISALLOW_90DEG) || (!HasBit(rti1->flags, RTF_ALLOW_90DEG) && def);
|
||||
bool rt2_90deg = HasBit(rti2->flags, RTF_DISALLOW_90DEG) || (!HasBit(rti2->flags, RTF_ALLOW_90DEG) && def);
|
||||
|
@ -446,13 +446,13 @@ int TicksToLeaveDepot(const Train *v);
|
|||
Foundation GetRailFoundation(Slope tileh, TrackBits bits);
|
||||
|
||||
|
||||
bool HasRailtypeAvail(const CompanyID company, const RailType railtype);
|
||||
bool HasAnyRailtypesAvail(const CompanyID company);
|
||||
bool ValParamRailtype(const RailType rail);
|
||||
bool HasRailTypeAvail(const CompanyID company, const RailType railtype);
|
||||
bool HasAnyRailTypesAvail(const CompanyID company);
|
||||
bool ValParamRailType(const RailType rail);
|
||||
|
||||
RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date date);
|
||||
|
||||
RailTypes GetCompanyRailtypes(CompanyID company, bool introduces = true);
|
||||
RailTypes GetCompanyRailTypes(CompanyID company, bool introduces = true);
|
||||
RailTypes GetRailTypes(bool introduces);
|
||||
|
||||
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels = true);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
/** Helper type for lists/vectors of trains */
|
||||
typedef std::vector<Train *> TrainList;
|
||||
|
||||
RailtypeInfo _railtypes[RAILTYPE_END];
|
||||
RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
std::vector<RailType> _sorted_railtypes;
|
||||
RailTypes _railtypes_hidden_mask;
|
||||
|
||||
|
@ -67,12 +67,12 @@ void ResetRailTypes()
|
|||
static_assert(lengthof(_original_railtypes) <= lengthof(_railtypes));
|
||||
|
||||
auto insert = std::copy(std::begin(_original_railtypes), std::end(_original_railtypes), std::begin(_railtypes));
|
||||
std::fill(insert, std::end(_railtypes), RailtypeInfo{});
|
||||
std::fill(insert, std::end(_railtypes), RailTypeInfo{});
|
||||
|
||||
_railtypes_hidden_mask = RAILTYPES_NONE;
|
||||
}
|
||||
|
||||
void ResolveRailTypeGUISprites(RailtypeInfo *rti)
|
||||
void ResolveRailTypeGUISprites(RailTypeInfo *rti)
|
||||
{
|
||||
SpriteID cursors_base = GetCustomRailSprite(rti, INVALID_TILE, RTSG_CURSORS);
|
||||
if (cursors_base != 0) {
|
||||
|
@ -130,7 +130,7 @@ static bool CompareRailTypes(const RailType &first, const RailType &second)
|
|||
void InitRailTypes()
|
||||
{
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
RailtypeInfo *rti = &_railtypes[rt];
|
||||
RailTypeInfo *rti = &_railtypes[rt];
|
||||
ResolveRailTypeGUISprites(rti);
|
||||
if (HasBit(rti->flags, RTF_HIDDEN)) SetBit(_railtypes_hidden_mask, rt);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ void InitRailTypes()
|
|||
RailType AllocateRailType(RailTypeLabel label)
|
||||
{
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
RailtypeInfo *rti = &_railtypes[rt];
|
||||
RailTypeInfo *rti = &_railtypes[rt];
|
||||
|
||||
if (rti->label == 0) {
|
||||
/* Set up new rail type */
|
||||
|
@ -428,7 +428,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai
|
|||
{
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
|
||||
if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
||||
if (!ValParamRailType(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
||||
|
||||
Slope tileh = GetTileSlope(tile);
|
||||
TrackBits trackbit = TrackToTrackBits(track);
|
||||
|
@ -878,7 +878,7 @@ static CommandCost CmdRailTrackHelper(DoCommandFlag flags, TileIndex tile, TileI
|
|||
{
|
||||
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
||||
|
||||
if ((!remove && !ValParamRailtype(railtype)) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
||||
if ((!remove && !ValParamRailType(railtype)) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
||||
if (end_tile >= Map::Size() || tile >= Map::Size()) return CMD_ERROR;
|
||||
|
||||
Trackdir trackdir = TrackToTrackdir(track);
|
||||
|
@ -964,7 +964,7 @@ CommandCost CmdRemoveRailroadTrack(DoCommandFlag flags, TileIndex end_tile, Tile
|
|||
CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType railtype, DiagDirection dir)
|
||||
{
|
||||
/* check railtype and valid direction for depot (0 through 3), 4 in total */
|
||||
if (!ValParamRailtype(railtype) || !IsValidDiagDirection(dir)) return CMD_ERROR;
|
||||
if (!ValParamRailType(railtype) || !IsValidDiagDirection(dir)) return CMD_ERROR;
|
||||
|
||||
Slope tileh = GetTileSlope(tile);
|
||||
|
||||
|
@ -1555,7 +1555,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s
|
|||
{
|
||||
TileIndex area_end = tile;
|
||||
|
||||
if (!ValParamRailtype(totype)) return CMD_ERROR;
|
||||
if (!ValParamRailType(totype)) return CMD_ERROR;
|
||||
if (area_start >= Map::Size()) return CMD_ERROR;
|
||||
|
||||
TrainList affected_trains;
|
||||
|
@ -1869,7 +1869,7 @@ static uint GetSaveSlopeZ(uint x, uint y, Track track)
|
|||
return GetSlopePixelZ(x, y);
|
||||
}
|
||||
|
||||
static void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track track, SignalState condition, SignalOffsets image, uint pos)
|
||||
static void DrawSingleSignal(TileIndex tile, const RailTypeInfo *rti, Track track, SignalState condition, SignalOffsets image, uint pos)
|
||||
{
|
||||
bool side;
|
||||
switch (_settings_game.construction.train_signal_side) {
|
||||
|
@ -2008,7 +2008,7 @@ static void DrawTrackFence_SW(const TileInfo *ti, SpriteID base_image, uint num_
|
|||
* @param ti Tile drawing information.
|
||||
* @param rti Rail type information.
|
||||
*/
|
||||
static void DrawTrackDetails(const TileInfo *ti, const RailtypeInfo *rti)
|
||||
static void DrawTrackDetails(const TileInfo *ti, const RailTypeInfo *rti)
|
||||
{
|
||||
/* Base sprite for track fences.
|
||||
* Note: Halftile slopes only have fences on the upper part. */
|
||||
|
@ -2070,7 +2070,7 @@ static inline void DrawTrackSprite(SpriteID sprite, PaletteID pal, const TileInf
|
|||
DrawGroundSprite(sprite, pal, nullptr, 0, (ti->tileh & s) ? -8 : 0);
|
||||
}
|
||||
|
||||
static void DrawTrackBitsOverlay(TileInfo *ti, TrackBits track, const RailtypeInfo *rti)
|
||||
static void DrawTrackBitsOverlay(TileInfo *ti, TrackBits track, const RailTypeInfo *rti)
|
||||
{
|
||||
RailGroundType rgt = GetRailGroundType(ti->tile);
|
||||
Foundation f = GetRailFoundation(ti->tileh, track);
|
||||
|
@ -2237,7 +2237,7 @@ static void DrawTrackBitsOverlay(TileInfo *ti, TrackBits track, const RailtypeIn
|
|||
*/
|
||||
static void DrawTrackBits(TileInfo *ti, TrackBits track)
|
||||
{
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
|
||||
if (rti->UsesOverlay()) {
|
||||
DrawTrackBitsOverlay(ti, track, rti);
|
||||
|
@ -2386,7 +2386,7 @@ static void DrawTrackBits(TileInfo *ti, TrackBits track)
|
|||
}
|
||||
}
|
||||
|
||||
static void DrawSignals(TileIndex tile, TrackBits rails, const RailtypeInfo *rti)
|
||||
static void DrawSignals(TileIndex tile, TrackBits rails, const RailTypeInfo *rti)
|
||||
{
|
||||
#define MAYBE_DRAW_SIGNAL(x, y, z, t) if (IsSignalPresent(tile, x)) DrawSingleSignal(tile, rti, t, GetSingleSignalState(tile, x), y, z)
|
||||
|
||||
|
@ -2420,7 +2420,7 @@ static void DrawSignals(TileIndex tile, TrackBits rails, const RailtypeInfo *rti
|
|||
|
||||
static void DrawTile_Track(TileInfo *ti)
|
||||
{
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
|
||||
_drawtile_track_palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
|
||||
|
||||
|
@ -2542,7 +2542,7 @@ static void DrawTile_Track(TileInfo *ti)
|
|||
void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
|
||||
{
|
||||
const DrawTileSprites *dts = &_depot_gfx_table[dir];
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(railtype);
|
||||
SpriteID image = rti->UsesOverlay() ? SPR_FLAT_GRASS_TILE : dts->ground.sprite;
|
||||
uint32_t offset = rti->GetRailtypeSpriteOffset();
|
||||
|
||||
|
@ -2781,7 +2781,7 @@ static bool ClickTile_Track(TileIndex tile)
|
|||
|
||||
static void GetTileDesc_Track(TileIndex tile, TileDesc *td)
|
||||
{
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
td->rail_speed = rti->max_speed;
|
||||
td->railtype = rti->strings.name;
|
||||
td->owner[0] = GetTileOwner(tile);
|
||||
|
|
|
@ -435,7 +435,7 @@ struct BuildRailToolbarWindow : Window {
|
|||
void SetupRailToolbar(RailType railtype)
|
||||
{
|
||||
this->railtype = railtype;
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(railtype);
|
||||
|
||||
assert(railtype < RAILTYPE_END);
|
||||
this->GetWidget<NWidgetCore>(WID_RAT_BUILD_NS)->widget_data = rti->gui_sprites.build_ns_rail;
|
||||
|
@ -491,7 +491,7 @@ struct BuildRailToolbarWindow : Window {
|
|||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
if (widget == WID_RAT_CAPTION) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(this->railtype);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(this->railtype);
|
||||
if (rti->max_speed > 0) {
|
||||
SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
|
||||
SetDParam(1, rti->strings.toolbar_caption);
|
||||
|
@ -857,7 +857,7 @@ static WindowDesc _build_rail_desc(
|
|||
Window *ShowBuildRailToolbar(RailType railtype)
|
||||
{
|
||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
if (!ValParamRailtype(railtype)) return nullptr;
|
||||
if (!ValParamRailType(railtype)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
_cur_railtype = railtype;
|
||||
|
@ -1704,7 +1704,7 @@ public:
|
|||
this->sig_sprite_size.width = 0;
|
||||
this->sig_sprite_size.height = 0;
|
||||
this->sig_sprite_bottom_offset = 0;
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(_cur_railtype);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(_cur_railtype);
|
||||
for (uint type = SIGTYPE_NORMAL; type < SIGTYPE_END; type++) {
|
||||
for (uint variant = SIG_ELECTRIC; variant <= SIG_SEMAPHORE; variant++) {
|
||||
for (uint lowered = 0; lowered < 2; lowered++) {
|
||||
|
@ -2268,14 +2268,14 @@ static void SetDefaultRailGui()
|
|||
case 0: {
|
||||
/* Use first available type */
|
||||
std::vector<RailType>::const_iterator it = std::find_if(_sorted_railtypes.begin(), _sorted_railtypes.end(),
|
||||
[](RailType r){ return HasRailtypeAvail(_local_company, r); });
|
||||
[](RailType r){ return HasRailTypeAvail(_local_company, r); });
|
||||
rt = it != _sorted_railtypes.end() ? *it : RAILTYPE_BEGIN;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
/* Use last available type */
|
||||
std::vector<RailType>::const_reverse_iterator it = std::find_if(_sorted_railtypes.rbegin(), _sorted_railtypes.rend(),
|
||||
[](RailType r){ return HasRailtypeAvail(_local_company, r); });
|
||||
[](RailType r){ return HasRailTypeAvail(_local_company, r); });
|
||||
rt = it != _sorted_railtypes.rend() ? *it : RAILTYPE_BEGIN;
|
||||
break;
|
||||
}
|
||||
|
@ -2342,7 +2342,7 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
|||
|
||||
/* Find the used railtypes. */
|
||||
if (for_replacement) {
|
||||
avail_railtypes = GetCompanyRailtypes(c->index, false);
|
||||
avail_railtypes = GetCompanyRailTypes(c->index, false);
|
||||
used_railtypes = GetRailTypes(false);
|
||||
} else {
|
||||
avail_railtypes = c->avail_railtypes;
|
||||
|
@ -2360,7 +2360,7 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
|||
if (!for_replacement) {
|
||||
for (const auto &rt : _sorted_railtypes) {
|
||||
if (!HasBit(used_railtypes, rt)) continue;
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
d = maxdim(d, GetSpriteSize(rti->gui_sprites.build_x_rail));
|
||||
}
|
||||
}
|
||||
|
@ -2369,7 +2369,7 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
|||
/* If it's not used ever, don't show it to the user. */
|
||||
if (!HasBit(used_railtypes, rt)) continue;
|
||||
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
|
||||
SetDParam(0, rti->strings.menu_text);
|
||||
SetDParam(1, rti->max_speed);
|
||||
|
|
|
@ -1687,7 +1687,7 @@ static void DrawTile_Road(TileInfo *ti)
|
|||
|
||||
Axis axis = GetCrossingRailAxis(ti->tile);
|
||||
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
|
||||
RoadType road_rt = GetRoadTypeRoad(ti->tile);
|
||||
RoadType tram_rt = GetRoadTypeTram(ti->tile);
|
||||
|
@ -2174,7 +2174,7 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td)
|
|||
td->str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
|
||||
rail_owner = GetTileOwner(tile);
|
||||
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
td->railtype = rti->strings.name;
|
||||
td->rail_speed = rti->max_speed;
|
||||
|
||||
|
|
|
@ -1413,7 +1413,7 @@ bool AfterLoadGame()
|
|||
}
|
||||
|
||||
for (Company *c : Company::Iterate()) {
|
||||
c->avail_railtypes = GetCompanyRailtypes(c->index);
|
||||
c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ static bool NeedRailTypeConversion()
|
|||
{
|
||||
for (uint i = 0; i < _railtype_list.size(); i++) {
|
||||
if ((RailType)i < RAILTYPE_END) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo((RailType)i);
|
||||
const RailTypeInfo *rti = GetRailTypeInfo((RailType)i);
|
||||
if (rti->label != _railtype_list[i]) return true;
|
||||
} else {
|
||||
if (_railtype_list[i] != 0) return true;
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
EnforceDeityOrCompanyModeValid(false);
|
||||
if ((::RailType)rail_type >= RAILTYPE_END) return false;
|
||||
|
||||
return ScriptCompanyMode::IsDeity() || ::HasRailtypeAvail(ScriptObject::GetCompany(), (::RailType)rail_type);
|
||||
return ScriptCompanyMode::IsDeity() || ::HasRailTypeAvail(ScriptObject::GetCompany(), (::RailType)rail_type);
|
||||
}
|
||||
|
||||
/* static */ ScriptRail::RailType ScriptRail::GetCurrentRailType()
|
||||
|
|
|
@ -18,6 +18,6 @@ ScriptRailTypeList::ScriptRailTypeList()
|
|||
{
|
||||
EnforceDeityOrCompanyModeValid_Void();
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
if (ScriptCompanyMode::IsDeity() || ::HasRailtypeAvail(ScriptObject::GetCompany(), rt)) this->AddItem(rt);
|
||||
if (ScriptCompanyMode::IsDeity() || ::HasRailTypeAvail(ScriptObject::GetCompany(), rt)) this->AddItem(rt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1313,7 +1313,7 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp
|
|||
CommandCost ret = CheckIfAuthorityAllowsNewStation(tile_org, flags);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
if (!ValParamRailtype(rt) || !IsValidAxis(axis)) return CMD_ERROR;
|
||||
if (!ValParamRailType(rt) || !IsValidAxis(axis)) return CMD_ERROR;
|
||||
|
||||
/* Check if the given station class is valid */
|
||||
if ((uint)spec_class >= StationClass::GetClassCount() || spec_class == STAT_CLASS_WAYP) return CMD_ERROR;
|
||||
|
@ -2924,7 +2924,7 @@ static void DrawTile_Station(TileInfo *ti)
|
|||
DrawTileSprites tmp_rail_layout;
|
||||
const DrawTileSprites *t = nullptr;
|
||||
int32_t total_offset;
|
||||
const RailtypeInfo *rti = nullptr;
|
||||
const RailTypeInfo *rti = nullptr;
|
||||
uint32_t relocation = 0;
|
||||
uint32_t ground_relocation = 0;
|
||||
BaseStation *st = nullptr;
|
||||
|
@ -3213,7 +3213,7 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
|
|||
int32_t total_offset = 0;
|
||||
PaletteID pal = COMPANY_SPRITE_COLOUR(_local_company);
|
||||
const DrawTileSprites *t = GetStationTileLayout(st, image);
|
||||
const RailtypeInfo *railtype_info = nullptr;
|
||||
const RailTypeInfo *railtype_info = nullptr;
|
||||
|
||||
if (railtype != INVALID_RAILTYPE) {
|
||||
railtype_info = GetRailTypeInfo(railtype);
|
||||
|
@ -3321,7 +3321,7 @@ void FillTileDescRailStation(TileIndex tile, TileDesc *td)
|
|||
}
|
||||
}
|
||||
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
td->rail_speed = rti->max_speed;
|
||||
td->railtype = rti->strings.name;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
/**
|
||||
* Global Railtype definition
|
||||
*/
|
||||
static const RailtypeInfo _original_railtypes[] = {
|
||||
static const RailTypeInfo _original_railtypes[] = {
|
||||
/** Railway */
|
||||
{ // Main Sprites
|
||||
{ SPR_RAIL_TRACK_Y, SPR_RAIL_TRACK_N_S, SPR_RAIL_TRACK_BASE, SPR_RAIL_SINGLE_X, SPR_RAIL_SINGLE_Y,
|
||||
|
|
|
@ -357,7 +357,7 @@ int Train::GetCurveSpeedLimit() const
|
|||
|
||||
if (max_speed != absolute_max_speed) {
|
||||
/* Apply the current railtype's curve speed advantage */
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(this->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(this->tile));
|
||||
max_speed += (max_speed / 2) * rti->curve_speed;
|
||||
|
||||
if (this->tcache.cached_tilt) {
|
||||
|
|
|
@ -275,7 +275,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex tile_end, TileIndex ti
|
|||
|
||||
case TRANSPORT_RAIL:
|
||||
railtype = (RailType)road_rail_type;
|
||||
if (!ValParamRailtype(railtype)) return CMD_ERROR;
|
||||
if (!ValParamRailType(railtype)) return CMD_ERROR;
|
||||
break;
|
||||
|
||||
case TRANSPORT_WATER:
|
||||
|
@ -631,7 +631,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, TransportT
|
|||
switch (transport_type) {
|
||||
case TRANSPORT_RAIL:
|
||||
railtype = (RailType)road_rail_type;
|
||||
if (!ValParamRailtype(railtype)) return CMD_ERROR;
|
||||
if (!ValParamRailType(railtype)) return CMD_ERROR;
|
||||
break;
|
||||
|
||||
case TRANSPORT_ROAD:
|
||||
|
@ -1285,7 +1285,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
SpriteID image;
|
||||
SpriteID railtype_overlay = 0;
|
||||
if (transport_type == TRANSPORT_RAIL) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
image = rti->base_sprites.tunnel;
|
||||
if (rti->UsesOverlay()) {
|
||||
/* Check if the railtype has custom tunnel portals. */
|
||||
|
@ -1354,7 +1354,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
AddSortableSpriteToDraw(catenary_sprite_base + tunnelbridge_direction, PAL_NONE, ti->x, ti->y, BB_data[10], BB_data[11], TILE_HEIGHT, ti->z, IsTransparencySet(TO_CATENARY), BB_data[8], BB_data[9], BB_Z_SEPARATOR);
|
||||
}
|
||||
} else {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
if (rti->UsesOverlay()) {
|
||||
SpriteID surface = GetCustomRailSprite(rti, ti->tile, RTSG_TUNNEL);
|
||||
if (surface != 0) DrawGroundSprite(surface + tunnelbridge_direction, PAL_NONE);
|
||||
|
@ -1459,7 +1459,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
|
||||
EndSpriteCombine();
|
||||
} else if (transport_type == TRANSPORT_RAIL) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||
if (rti->UsesOverlay()) {
|
||||
SpriteID surface = GetCustomRailSprite(rti, ti->tile, RTSG_BRIDGE);
|
||||
if (surface != 0) {
|
||||
|
@ -1617,7 +1617,7 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
|||
/* DrawBridgeRoadBits() calls EndSpriteCombine() and StartSpriteCombine() */
|
||||
DrawBridgeRoadBits(rampsouth, x, y, bridge_z, axis ^ 1, false);
|
||||
} else if (transport_type == TRANSPORT_RAIL) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(rampsouth));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(rampsouth));
|
||||
if (rti->UsesOverlay() && !IsInvisibilitySet(TO_BRIDGES)) {
|
||||
SpriteID surface = GetCustomRailSprite(rti, rampsouth, RTSG_BRIDGE, TCX_ON_BRIDGE);
|
||||
if (surface != 0) {
|
||||
|
@ -1744,7 +1744,7 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
|
|||
}
|
||||
|
||||
if (tt == TRANSPORT_RAIL) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||
td->rail_speed = rti->max_speed;
|
||||
td->railtype = rti->strings.name;
|
||||
|
||||
|
|
|
@ -1835,7 +1835,7 @@ bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype)
|
|||
UnitID max;
|
||||
switch (type) {
|
||||
case VEH_TRAIN:
|
||||
if (!HasAnyRailtypesAvail(_local_company)) return false;
|
||||
if (!HasAnyRailTypesAvail(_local_company)) return false;
|
||||
max = _settings_game.vehicle.max_trains;
|
||||
break;
|
||||
case VEH_ROAD:
|
||||
|
|
Loading…
Reference in New Issue