mirror of https://github.com/OpenTTD/OpenTTD
(svn r14078) -Codechange: Rename *VehicleInfo::base_cost to cost_factor, indicating what it actually is.
parent
03f260059a
commit
9d0e1b635a
|
@ -228,7 +228,7 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height)
|
|||
|
||||
static CommandCost EstimateAircraftCost(EngineID engine, const AircraftVehicleInfo *avi)
|
||||
{
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x0B, avi->cost_factor) * (_price.aircraft_base >> 3) >> 5);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -135,7 +135,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
|
|||
const RailVehicleInfo *rvi = RailVehInfo(engine);
|
||||
int multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
|
||||
|
||||
SetDParam(0, (_price.build_railvehicle >> 3) * GetEngineProperty(engine, 0x17, rvi->base_cost) >> 5);
|
||||
SetDParam(0, (_price.build_railvehicle >> 3) * GetEngineProperty(engine, 0x17, rvi->cost_factor) >> 5);
|
||||
SetDParam(2, GetEngineProperty(engine, 0x09, rvi->max_speed) * 10 / 16);
|
||||
SetDParam(3, GetEngineProperty(engine, 0x0B, rvi->power));
|
||||
SetDParam(1, GetEngineProperty(engine, 0x16, rvi->weight) << multihead);
|
||||
|
@ -155,7 +155,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
|
|||
static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
{
|
||||
const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
|
||||
SetDParam(0, (_price.aircraft_base >> 3) * GetEngineProperty(engine, 0x0B, avi->base_cost) >> 5);
|
||||
SetDParam(0, (_price.aircraft_base >> 3) * GetEngineProperty(engine, 0x0B, avi->cost_factor) >> 5);
|
||||
SetDParam(1, avi->max_speed * 10 / 16);
|
||||
SetDParam(2, avi->passenger_capacity);
|
||||
SetDParam(3, avi->mail_capacity);
|
||||
|
@ -168,7 +168,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
|
|||
{
|
||||
const RoadVehicleInfo *rvi = RoadVehInfo(engine);
|
||||
|
||||
SetDParam(0, (_price.roadveh_base >> 3) * GetEngineProperty(engine, 0x11, rvi->base_cost) >> 5);
|
||||
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(3, rvi->cargo_type);
|
||||
|
@ -180,7 +180,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
|
|||
static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
{
|
||||
const ShipVehicleInfo *svi = ShipVehInfo(engine);
|
||||
SetDParam(0, GetEngineProperty(engine, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
|
||||
SetDParam(0, GetEngineProperty(engine, 0x0A, svi->cost_factor) * (_price.ship_base >> 3) >> 5);
|
||||
SetDParam(1, GetEngineProperty(engine, 0x0B, svi->max_speed) * 10 / 32);
|
||||
SetDParam(2, svi->cargo_type);
|
||||
SetDParam(3, GetEngineProperty(engine, 0x0D, svi->capacity));
|
||||
|
|
|
@ -36,7 +36,7 @@ enum EngineClass {
|
|||
struct RailVehicleInfo {
|
||||
byte image_index;
|
||||
RailVehicleTypes railveh_type;
|
||||
byte base_cost; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices.
|
||||
byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices.
|
||||
RailTypeByte railtype;
|
||||
uint16 max_speed;
|
||||
uint16 power; ///< Power of engine; For multiheaded engines the sum of both engine powers.
|
||||
|
@ -61,7 +61,7 @@ struct RailVehicleInfo {
|
|||
|
||||
struct ShipVehicleInfo {
|
||||
byte image_index;
|
||||
byte base_cost;
|
||||
byte cost_factor;
|
||||
uint16 max_speed;
|
||||
CargoID cargo_type;
|
||||
uint16 capacity;
|
||||
|
@ -81,7 +81,7 @@ enum {
|
|||
|
||||
struct AircraftVehicleInfo {
|
||||
byte image_index;
|
||||
byte base_cost;
|
||||
byte cost_factor;
|
||||
byte running_cost;
|
||||
byte subtype;
|
||||
SoundFxByte sfx;
|
||||
|
@ -93,7 +93,7 @@ struct AircraftVehicleInfo {
|
|||
|
||||
struct RoadVehicleInfo {
|
||||
byte image_index;
|
||||
byte base_cost;
|
||||
byte cost_factor;
|
||||
byte running_cost;
|
||||
byte running_cost_class;
|
||||
SoundFxByte sfx;
|
||||
|
|
|
@ -546,7 +546,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
|||
break;
|
||||
|
||||
case 0x17: // Cost factor
|
||||
rvi->base_cost = grf_load_byte(&buf);
|
||||
rvi->cost_factor = grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x18: // AI rank
|
||||
|
@ -735,7 +735,7 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
|||
} break;
|
||||
|
||||
case 0x11: // Cost factor
|
||||
rvi->base_cost = grf_load_byte(&buf); // ?? is it base_cost?
|
||||
rvi->cost_factor = grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x12: // SFX
|
||||
|
@ -833,7 +833,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
|||
break;
|
||||
|
||||
case 0x0A: // Cost factor
|
||||
svi->base_cost = grf_load_byte(&buf); // ?? is it base_cost?
|
||||
svi->cost_factor = grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x0B: // Speed (1 unit is 0.5 kmh)
|
||||
|
@ -952,7 +952,7 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
|
|||
break;
|
||||
|
||||
case 0x0B: // Cost factor
|
||||
avi->base_cost = grf_load_byte(&buf); // ?? is it base_cost?
|
||||
avi->cost_factor = grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x0C: // Speed (1 unit is 8 mph, we translate to 1 unit is 1 km/h)
|
||||
|
|
|
@ -134,7 +134,7 @@ void DrawRoadVehEngine(int x, int y, EngineID engine, SpriteID pal)
|
|||
|
||||
static CommandCost EstimateRoadVehCost(EngineID engine_type)
|
||||
{
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, ((_price.roadveh_base >> 3) * GetEngineProperty(engine_type, 0x11, RoadVehInfo(engine_type)->base_cost)) >> 5);
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, ((_price.roadveh_base >> 3) * GetEngineProperty(engine_type, 0x11, RoadVehInfo(engine_type)->cost_factor)) >> 5);
|
||||
}
|
||||
|
||||
byte GetRoadVehLength(const Vehicle *v)
|
||||
|
|
|
@ -337,7 +337,7 @@ static bool ShipAccelerate(Vehicle *v)
|
|||
|
||||
static CommandCost EstimateShipCost(EngineID engine_type)
|
||||
{
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine_type, 0x0A, ShipVehInfo(engine_type)->base_cost) * (_price.ship_base >> 3) >> 5);
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine_type, 0x0A, ShipVehInfo(engine_type)->cost_factor) * (_price.ship_base >> 3) >> 5);
|
||||
}
|
||||
|
||||
static void ShipArrivesAt(const Vehicle* v, Station* st)
|
||||
|
|
|
@ -610,7 +610,7 @@ void DrawTrainEngine(int x, int y, EngineID engine, SpriteID pal)
|
|||
static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
|
||||
{
|
||||
const RailVehicleInfo *rvi = RailVehInfo(engine);
|
||||
CommandCost value(EXPENSES_NEW_VEHICLES, (GetEngineProperty(engine, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
|
||||
CommandCost value(EXPENSES_NEW_VEHICLES, (GetEngineProperty(engine, 0x17, rvi->cost_factor) * _price.build_railwagon) >> 8);
|
||||
|
||||
uint num_vehicles = 1 + CountArticulatedParts(engine, false);
|
||||
|
||||
|
@ -720,7 +720,7 @@ static void NormalizeTrainVehInDepot(const Vehicle *u)
|
|||
|
||||
static CommandCost EstimateTrainCost(EngineID engine, const RailVehicleInfo *rvi)
|
||||
{
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
|
||||
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x17, rvi->cost_factor) * (_price.build_railvehicle >> 3) >> 5);
|
||||
}
|
||||
|
||||
static void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building)
|
||||
|
|
Loading…
Reference in New Issue