(svn r17084) -Codechange: _age_cargo_skip_counter is common to all vehicle types

This commit is contained in:
smatz 2009-08-06 12:33:13 +00:00
parent 7fcebf0997
commit 9c25f1bdb7
6 changed files with 6 additions and 18 deletions

View File

@ -928,7 +928,6 @@ void OnTick_Station();
void OnTick_Industry();
void OnTick_Companies();
void OnTick_Train();
void CallLandscapeTick()
{
@ -938,5 +937,4 @@ void CallLandscapeTick()
OnTick_Industry();
OnTick_Companies();
OnTick_Train();
}

View File

@ -99,7 +99,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date)
InitializeIndustries();
InitializeBuildingCounts();
InitializeTrains();
InitializeNPF();
InitializeCompanies();

View File

@ -2292,12 +2292,6 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1,
return v->SendToDepot(flags, (DepotCommand)(p2 & DEPOT_COMMAND_MASK));
}
void OnTick_Train()
{
_age_cargo_skip_counter = (_age_cargo_skip_counter == 0) ? 184 : (_age_cargo_skip_counter - 1);
}
static const int8 _vehicle_smoke_pos[8] = {
1, 1, 1, 0, -1, -1, -1, 0
};
@ -4602,8 +4596,3 @@ Trackdir Train::GetVehicleTrackdir() const
return TrackDirectionToTrackdir(FindFirstTrack(this->track), this->direction);
}
void InitializeTrains()
{
_age_cargo_skip_counter = 1;
}

View File

@ -12,9 +12,6 @@
/* Amount of game ticks */
VARDEF uint16 _tick_counter;
/* Skip aging of cargo? */
VARDEF byte _age_cargo_skip_counter;
/* Also save scrollpos_x, scrollpos_y and zoom */
VARDEF uint16 _disaster_delay;

View File

@ -49,6 +49,7 @@ VehicleID _vehicle_id_ctr_day;
const Vehicle *_place_clicked_vehicle;
VehicleID _new_vehicle_id;
uint16 _returned_refit_capacity;
byte _age_cargo_skip_counter; ///< Skip aging of cargo?
/* Initialize the vehicle-pool */
@ -439,6 +440,8 @@ void InitializeVehicles()
_vehicle_pool.CleanPool();
_cargo_payment_pool.CleanPool();
_age_cargo_skip_counter = 1;
_vehicles_to_autoreplace.Reset();
ResetVehiclePosHash();
}
@ -560,6 +563,8 @@ void CallVehicleTicks()
{
_vehicles_to_autoreplace.Clear();
_age_cargo_skip_counter = (_age_cargo_skip_counter == 0) ? 184 : (_age_cargo_skip_counter - 1);
Station *st;
FOR_ALL_STATIONS(st) LoadUnloadStation(st);

View File

@ -31,7 +31,6 @@ bool HasVehicleOnPosXY(int x, int y, void *data, VehicleFromPosProc *proc);
void CallVehicleTicks();
uint8 CalcPercentVehicleFilled(const Vehicle *v, StringID *colour);
void InitializeTrains();
byte VehicleRandomBits();
void ResetVehiclePosHash();
void ResetVehicleColourMap();
@ -160,6 +159,7 @@ extern VehicleID _vehicle_id_ctr_day;
extern const Vehicle *_place_clicked_vehicle;
extern VehicleID _new_vehicle_id;
extern uint16 _returned_refit_capacity;
extern byte _age_cargo_skip_counter;
bool CanVehicleUseStation(EngineID engine_type, const struct Station *st);
bool CanVehicleUseStation(const Vehicle *v, const struct Station *st);