(svn r16934) -Codechange: introduce a simple helper function to check whether a station is pending deletion or not

This commit is contained in:
rubidium
2009-07-24 07:38:10 +00:00
parent fb36ebd9dd
commit 7b07e93b89
6 changed files with 19 additions and 8 deletions

View File

@@ -2570,7 +2570,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
*/
static bool StationHandleBigTick(BaseStation *st)
{
if ((st->facilities & ~FACIL_WAYPOINT) == 0 && ++st->delete_ctr >= 8) {
if (!st->IsInUse() && ++st->delete_ctr >= 8) {
delete st;
return false;
}
@@ -2698,7 +2698,7 @@ static void UpdateStationRating(Station *st)
/* called for every station each tick */
static void StationHandleSmallTick(BaseStation *st)
{
if ((st->facilities & FACIL_WAYPOINT) != 0 || st->facilities == 0) return;
if ((st->facilities & FACIL_WAYPOINT) != 0 || !st->IsInUse()) return;
byte b = st->delete_ctr + 1;
if (b >= 185) b = 0;