|
@@ -24,49 +24,49 @@
|
|
|
|
|
|
/* virtual */ uint32 RoadTypeScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
|
|
|
{
|
|
|
if (this->tile == INVALID_TILE) {
|
|
|
switch (variable) {
|
|
|
case 0x40: return 0;
|
|
|
case 0x41: return 0;
|
|
|
case 0x42: return 0;
|
|
|
case 0x43: return _date;
|
|
|
case 0x44: return HZB_TOWN_EDGE;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
switch (variable) {
|
|
|
case 0x40: return GetTerrainType(this->tile, this->context);
|
|
|
case 0x41: return 0;
|
|
|
case 0x42: return IsLevelCrossingTile(this->tile) && IsCrossingBarred(this->tile);
|
|
|
case 0x43:
|
|
|
if (IsRoadDepotTile(this->tile)) return Depot::GetByTile(this->tile)->build_date;
|
|
|
return _date;
|
|
|
case 0x44: {
|
|
|
const Town *t = nullptr;
|
|
|
if (IsRoadDepotTile(this->tile)) {
|
|
|
t = Depot::GetByTile(this->tile)->town;
|
|
|
} else if (IsTileType(this->tile, MP_ROAD)) {
|
|
|
} else {
|
|
|
t = ClosestTownFromTile(this->tile, UINT_MAX);
|
|
|
}
|
|
|
return t != nullptr ? GetTownRadiusGroup(t, this->tile) : HZB_TOWN_EDGE;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
DEBUG(grf, 1, "Unhandled road type tile variable 0x%X", variable);
|
|
|
|
|
|
*available = false;
|
|
|
return UINT_MAX;
|
|
|
}
|
|
|
|
|
|
/* virtual */ const SpriteGroup *RoadTypeResolverObject::ResolveReal(const RealSpriteGroup *group) const
|
|
|
{
|
|
|
if (group->num_loading > 0) return group->loading[0];
|
|
|
if (group->num_loaded > 0) return group->loaded[0];
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
GrfSpecFeature RoadTypeResolverObject::GetFeature() const
|
|
|
{
|
|
|
RoadType rt = GetRoadTypeByLabel(this->roadtype_scope.rti->label, false);
|
|
|
switch (GetRoadTramType(rt)) {
|
|
|
case RTT_ROAD: return GSF_ROADTYPES;
|