|
@@ -7,13 +7,13 @@
|
|
|
|
|
|
/** @file newgrf_railtype.cpp NewGRF handling of rail types. */
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "debug.h"
|
|
|
#include "newgrf_railtype.h"
|
|
|
#include "date_func.h"
|
|
|
#include "timer/timer_game_calendar.h"
|
|
|
#include "depot_base.h"
|
|
|
#include "town.h"
|
|
|
|
|
|
#include "safeguards.h"
|
|
|
|
|
|
/* virtual */ uint32 RailTypeScopeResolver::GetRandomBits() const
|
|
@@ -26,24 +26,24 @@
|
|
|
{
|
|
|
if (this->tile == INVALID_TILE) {
|
|
|
switch (variable) {
|
|
|
case 0x40: return 0;
|
|
|
case 0x41: return 0;
|
|
|
case 0x42: return 0;
|
|
|
case 0x43: return _date;
|
|
|
case 0x43: return TimerGameCalendar::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 (IsRailDepotTile(this->tile)) return Depot::GetByTile(this->tile)->build_date;
|
|
|
return _date;
|
|
|
return TimerGameCalendar::date;
|
|
|
case 0x44: {
|
|
|
const Town *t = nullptr;
|
|
|
if (IsRailDepotTile(this->tile)) {
|
|
|
t = Depot::GetByTile(this->tile)->town;
|
|
|
} else if (IsLevelCrossingTile(this->tile)) {
|
|
|
t = ClosestTownFromTile(this->tile, UINT_MAX);
|