|
|
|
@ -135,8 +135,8 @@ static int CDECL EngineReliabilitySorter(const void *a, const void *b)
|
|
|
|
|
/* Train sorting functions */
|
|
|
|
|
static int CDECL TrainEngineCostSorter(const void *a, const void *b)
|
|
|
|
|
{
|
|
|
|
|
int va = RailVehInfo(*(const EngineID*)a)->base_cost;
|
|
|
|
|
int vb = RailVehInfo(*(const EngineID*)b)->base_cost;
|
|
|
|
|
int va = RailVehInfo(*(const EngineID*)a)->cost_factor;
|
|
|
|
|
int vb = RailVehInfo(*(const EngineID*)b)->cost_factor;
|
|
|
|
|
int r = va - vb;
|
|
|
|
|
|
|
|
|
|
return _internal_sort_order ? -r : r;
|
|
|
|
@ -223,8 +223,8 @@ static int CDECL TrainEnginesThenWagonsSorter(const void *a, const void *b)
|
|
|
|
|
/* Road vehicle sorting functions */
|
|
|
|
|
static int CDECL RoadVehEngineCostSorter(const void *a, const void *b)
|
|
|
|
|
{
|
|
|
|
|
int va = RoadVehInfo(*(const EngineID*)a)->base_cost;
|
|
|
|
|
int vb = RoadVehInfo(*(const EngineID*)b)->base_cost;
|
|
|
|
|
int va = RoadVehInfo(*(const EngineID*)a)->cost_factor;
|
|
|
|
|
int vb = RoadVehInfo(*(const EngineID*)b)->cost_factor;
|
|
|
|
|
int r = va - vb;
|
|
|
|
|
|
|
|
|
|
return _internal_sort_order ? -r : r;
|
|
|
|
@ -271,8 +271,8 @@ static int CDECL RoadVehEngineCapacitySorter(const void *a, const void *b)
|
|
|
|
|
/* Road vehicle sorting functions */
|
|
|
|
|
static int CDECL ShipEngineCostSorter(const void *a, const void *b)
|
|
|
|
|
{
|
|
|
|
|
int va = ShipVehInfo(*(const EngineID*)a)->base_cost;
|
|
|
|
|
int vb = ShipVehInfo(*(const EngineID*)b)->base_cost;
|
|
|
|
|
int va = ShipVehInfo(*(const EngineID*)a)->cost_factor;
|
|
|
|
|
int vb = ShipVehInfo(*(const EngineID*)b)->cost_factor;
|
|
|
|
|
int r = va - vb;
|
|
|
|
|
|
|
|
|
|
return _internal_sort_order ? -r : r;
|
|
|
|
@ -317,8 +317,8 @@ static int CDECL ShipEngineCapacitySorter(const void *a, const void *b)
|
|
|
|
|
|
|
|
|
|
static int CDECL AircraftEngineCostSorter(const void *a, const void *b)
|
|
|
|
|
{
|
|
|
|
|
const int va = AircraftVehInfo(*(const EngineID*)a)->base_cost;
|
|
|
|
|
const int vb = AircraftVehInfo(*(const EngineID*)b)->base_cost;
|
|
|
|
|
const int va = AircraftVehInfo(*(const EngineID*)a)->cost_factor;
|
|
|
|
|
const int vb = AircraftVehInfo(*(const EngineID*)b)->cost_factor;
|
|
|
|
|
int r = va - vb;
|
|
|
|
|
|
|
|
|
|
return _internal_sort_order ? -r : r;
|
|
|
|
@ -486,7 +486,7 @@ static int DrawCargoCapacityInfo(int x, int y, EngineID engine, VehicleType type
|
|
|
|
|
static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi)
|
|
|
|
|
{
|
|
|
|
|
/* Purchase cost */
|
|
|
|
|
SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
|
|
|
|
|
SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->cost_factor) * _price.build_railwagon) >> 8);
|
|
|
|
|
DrawString(x, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING);
|
|
|
|
|
y += 10;
|
|
|
|
|
|
|
|
|
@ -524,7 +524,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
|
|
|
|
|
uint weight = GetEngineProperty(engine_number, 0x16, rvi->weight);
|
|
|
|
|
|
|
|
|
|
/* Purchase Cost - Engine weight */
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->cost_factor) * (_price.build_railvehicle >> 3) >> 5);
|
|
|
|
|
SetDParam(1, weight << multihead);
|
|
|
|
|
DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING);
|
|
|
|
|
y += 10;
|
|
|
|
@ -566,7 +566,7 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
|
|
|
|
|
bool refittable = (EngInfo(engine_number)->refit_mask != 0);
|
|
|
|
|
|
|
|
|
|
/* Purchase cost - Max speed */
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->base_cost) * (_price.roadveh_base >> 3) >> 5);
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->cost_factor) * (_price.roadveh_base >> 3) >> 5);
|
|
|
|
|
SetDParam(1, rvi->max_speed * 10 / 32);
|
|
|
|
|
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
|
|
|
|
|
y += 10;
|
|
|
|
@ -584,7 +584,7 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
|
|
|
|
|
static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const ShipVehicleInfo *svi)
|
|
|
|
|
{
|
|
|
|
|
/* Purchase cost - Max speed */
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->cost_factor) * (_price.ship_base >> 3) >> 5);
|
|
|
|
|
SetDParam(1, GetEngineProperty(engine_number, 0x0B, svi->max_speed) * 10 / 32);
|
|
|
|
|
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
|
|
|
|
|
y += 10;
|
|
|
|
@ -610,7 +610,7 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
|
|
|
|
|
CargoID cargo;
|
|
|
|
|
|
|
|
|
|
/* Purchase cost - Max speed */
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
|
|
|
|
|
SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->cost_factor) * (_price.aircraft_base >> 3) >> 5);
|
|
|
|
|
SetDParam(1, avi->max_speed * 10 / 16);
|
|
|
|
|
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
|
|
|
|
|
y += 10;
|
|
|
|
|