|
@@ -2690,25 +2690,29 @@ static VehicleEnterTileStatus VehicleEnt
|
|
|
uint bay_nr = rs->AllocateBay();
|
|
|
SB(v->u.road.state, RVS_USING_SECOND_BAY, 1, bay_nr);
|
|
|
|
|
|
/* Mark the station entrace as busy */
|
|
|
rs->SetEntranceBusy(true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return VETSB_CONTINUE;
|
|
|
}
|
|
|
|
|
|
/* this function is called for one station each tick */
|
|
|
/**
|
|
|
* This function is called for each station once every 250 ticks.
|
|
|
* Not all stations will get the tick at the same time.
|
|
|
* @param st the station receiving the tick.
|
|
|
*/
|
|
|
static void StationHandleBigTick(Station *st)
|
|
|
{
|
|
|
UpdateStationAcceptance(st, true);
|
|
|
|
|
|
if (st->facilities == 0 && ++st->delete_ctr >= 8) delete st;
|
|
|
|
|
|
}
|
|
|
|
|
|
static inline void byte_inc_sat(byte *p)
|
|
|
{
|
|
|
byte b = *p + 1;
|
|
|
if (b != 0) *p = b;
|
|
@@ -2830,37 +2834,33 @@ static void StationHandleSmallTick(Stati
|
|
|
|
|
|
byte b = st->delete_ctr + 1;
|
|
|
if (b >= 185) b = 0;
|
|
|
st->delete_ctr = b;
|
|
|
|
|
|
if (b == 0) UpdateStationRating(st);
|
|
|
}
|
|
|
|
|
|
void OnTick_Station()
|
|
|
{
|
|
|
if (_game_mode == GM_EDITOR) return;
|
|
|
|
|
|
uint i = _station_tick_ctr;
|
|
|
if (++_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0;
|
|
|
|
|
|
if (Station::IsValidID(i)) StationHandleBigTick(Station::Get(i));
|
|
|
|
|
|
Station *st;
|
|
|
FOR_ALL_STATIONS(st) {
|
|
|
StationHandleSmallTick(st);
|
|
|
|
|
|
/* Run 250 tick interval trigger for station animation.
|
|
|
* Station index is included so that triggers are not all done
|
|
|
* at the same time. */
|
|
|
if ((_tick_counter + st->index) % 250 == 0) {
|
|
|
StationHandleBigTick(st);
|
|
|
StationAnimationTrigger(st, st->xy, STAT_ANIM_250_TICKS);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void StationMonthlyLoop()
|
|
|
{
|
|
|
/* not used */
|
|
|
}
|
|
|
|
|
|
|
|
|
void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius)
|
|
@@ -3202,26 +3202,24 @@ static CommandCost ClearTile_Station(Til
|
|
|
return CMD_ERROR;
|
|
|
}
|
|
|
|
|
|
void InitializeStations()
|
|
|
{
|
|
|
/* Clean the station pool and create 1 block in it */
|
|
|
_Station_pool.CleanPool();
|
|
|
_Station_pool.AddBlockToPool();
|
|
|
|
|
|
/* Clean the roadstop pool and create 1 block in it */
|
|
|
_RoadStop_pool.CleanPool();
|
|
|
_RoadStop_pool.AddBlockToPool();
|
|
|
|
|
|
_station_tick_ctr = 0;
|
|
|
}
|
|
|
|
|
|
static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
|
|
{
|
|
|
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
|
|
|
/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
|
|
|
* TTDP does not call it.
|
|
|
*/
|
|
|
if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) {
|
|
|
switch (GetStationType(tile)) {
|
|
|
case STATION_RAIL: {
|
|
|
DiagDirection direction = AxisToDiagDir(GetRailStationAxis(tile));
|