(svn r15261) -Add: added Engine::GetRunningCost() to remove some code duplication. Also stops AIs decrementing vehicle counter of first company
This commit is contained in:
@@ -135,7 +135,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
SetDParam(3, GetEngineProperty(engine, 0x0B, rvi->power));
|
||||
SetDParam(1, GetEngineProperty(engine, 0x16, rvi->weight) << multihead);
|
||||
|
||||
SetDParam(4, GetEngineProperty(engine, 0x0D, rvi->running_cost) * GetPriceByIndex(rvi->running_cost_class) >> 8);
|
||||
SetDParam(4, GetEngine(engine)->GetRunningCost());
|
||||
|
||||
uint capacity = GetTotalCapacityOfArticulatedParts(engine, VEH_TRAIN);
|
||||
if (capacity != 0) {
|
||||
@@ -154,7 +154,7 @@ static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
SetDParam(1, avi->max_speed * 10 / 16);
|
||||
SetDParam(2, avi->passenger_capacity);
|
||||
SetDParam(3, avi->mail_capacity);
|
||||
SetDParam(4, GetEngineProperty(engine, 0x0E, avi->running_cost) * _price.aircraft_running >> 8);
|
||||
SetDParam(4, GetEngine(engine)->GetRunningCost());
|
||||
|
||||
DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
|
||||
SetDParam(0, (_price.roadveh_base >> 3) * GetEngineProperty(engine, 0x11, rvi->cost_factor) >> 5);
|
||||
SetDParam(1, rvi->max_speed * 10 / 32);
|
||||
SetDParam(2, rvi->running_cost * GetPriceByIndex(rvi->running_cost_class) >> 8);
|
||||
SetDParam(2, GetEngine(engine)->GetRunningCost());
|
||||
SetDParam(3, rvi->cargo_type);
|
||||
SetDParam(4, GetTotalCapacityOfArticulatedParts(engine, VEH_ROAD));
|
||||
|
||||
@@ -179,7 +179,7 @@ static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
SetDParam(1, GetEngineProperty(engine, 0x0B, svi->max_speed) * 10 / 32);
|
||||
SetDParam(2, svi->cargo_type);
|
||||
SetDParam(3, GetEngineProperty(engine, 0x0D, svi->capacity));
|
||||
SetDParam(4, GetEngineProperty(engine, 0x0F, svi->running_cost) * _price.ship_running >> 8);
|
||||
SetDParam(4, GetEngine(engine)->GetRunningCost());
|
||||
DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user