Changeset - r12625:b953305b3e07
[Not reviewed]
master
0 5 0
smatz - 15 years ago 2009-08-06 12:44:10
smatz@openttd.org
(svn r17085) -Codechange: unify the place where vehicle's cargo ages
5 files changed with 2 insertions and 29 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -636,16 +636,6 @@ void Aircraft::OnNewDay()
 
	InvalidateWindowClasses(WC_AIRCRAFT_LIST);
 
}
 

	
 
static void AgeAircraftCargo(Aircraft *v)
 
{
 
	if (_age_cargo_skip_counter != 0) return;
 

	
 
	do {
 
		v->cargo.AgeCargo();
 
		v = v->Next();
 
	} while (v != NULL);
 
}
 

	
 
static void HelicopterTickHandler(Aircraft *v)
 
{
 
	Aircraft *u = v->Next()->Next();
 
@@ -2034,8 +2024,6 @@ bool Aircraft::Tick()
 

	
 
	if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
 

	
 
	AgeAircraftCargo(this);
 

	
 
	this->current_order_time++;
 

	
 
	for (uint i = 0; i != 2; i++) {
src/roadveh_cmd.cpp
Show inline comments
 
@@ -1826,16 +1826,8 @@ static bool RoadVehController(RoadVehicl
 
	return true;
 
}
 

	
 
static void AgeRoadVehCargo(RoadVehicle *v)
 
{
 
	if (_age_cargo_skip_counter != 0) return;
 
	v->cargo.AgeCargo();
 
}
 

	
 
bool RoadVehicle::Tick()
 
{
 
	AgeRoadVehCargo(this);
 

	
 
	if (this->IsRoadVehFront()) {
 
		if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
 
		return RoadVehController(this);
src/ship_cmd.cpp
Show inline comments
 
@@ -719,17 +719,10 @@ reverse_direction:
 
	goto getout;
 
}
 

	
 
static void AgeShipCargo(Vehicle *v)
 
{
 
	if (_age_cargo_skip_counter != 0) return;
 
	v->cargo.AgeCargo();
 
}
 

	
 
bool Ship::Tick()
 
{
 
	if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
 

	
 
	AgeShipCargo(this);
 
	ShipController(this);
 

	
 
	return true;
src/train_cmd.cpp
Show inline comments
 
@@ -4485,8 +4485,6 @@ Money Train::GetRunningCost() const
 

	
 
bool Train::Tick()
 
{
 
	if (_age_cargo_skip_counter == 0) this->cargo.AgeCargo();
 

	
 
	this->tick_counter++;
 

	
 
	if (this->IsFrontEngine()) {
src/vehicle.cpp
Show inline comments
 
@@ -585,6 +585,8 @@ void CallVehicleTicks()
 
			case VEH_ROAD:
 
			case VEH_AIRCRAFT:
 
			case VEH_SHIP:
 
				if (_age_cargo_skip_counter == 0) v->cargo.AgeCargo();
 

	
 
				if (v->type == VEH_TRAIN && Train::From(v)->IsWagon()) continue;
 
				if (v->type == VEH_AIRCRAFT && v->subtype != AIR_HELICOPTER) continue;
 
				if (v->type == VEH_ROAD && !RoadVehicle::From(v)->IsRoadVehFront()) continue;
0 comments (0 inline, 0 general)