summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-08-15 17:54:43 +0000
committerpeter1138 <peter1138@openttd.org>2008-08-15 17:54:43 +0000
commit9d0e1b635a22903c0fc719909a9ec95a1990ae88 (patch)
tree0322a181ba444470d5defcf3fcdc45463c6c6cb5 /src
parent03f260059aae105ff6b0246717537f5d34985b07 (diff)
downloadopenttd-9d0e1b635a22903c0fc719909a9ec95a1990ae88.tar.xz
(svn r14078) -Codechange: Rename *VehicleInfo::base_cost to cost_factor, indicating what it actually is.
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/build_vehicle_gui.cpp26
-rw-r--r--src/engine_gui.cpp8
-rw-r--r--src/engine_type.h8
-rw-r--r--src/newgrf.cpp8
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/train_cmd.cpp4
8 files changed, 30 insertions, 30 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index eab3d3cac..2d000ff3b 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -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);
}
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index eab5e15c2..cf902cdad 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -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;
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 314c48a55..e574545fe 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -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));
diff --git a/src/engine_type.h b/src/engine_type.h
index 38392d313..c9eb56a5e 100644
--- a/src/engine_type.h
+++ b/src/engine_type.h
@@ -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;
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 6ae310600..2f85738ef 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -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)
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index c9bfb98b9..6c7954705 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -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)
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index bfd06c2f5..1b1eda4a4 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -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)
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index cd0cad724..327e9c01a 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -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)