summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-02-20 20:56:54 +0000
committerpeter1138 <peter1138@openttd.org>2008-02-20 20:56:54 +0000
commit79b6b9cb66ac260ad2d4f601d96e877f78764a1b (patch)
tree3c40c82307fa0b48d130d6a239cca2eedcd874ba
parentdb9d5a909fb94d9a2640ed75e644e9d874b3874f (diff)
downloadopenttd-79b6b9cb66ac260ad2d4f601d96e877f78764a1b.tar.xz
(svn r12205) -Codechange: rename RailVehicleInfo::running_cost_base to running_cost, inline with other vehicle types (It is the factor, not the base)
-rw-r--r--src/build_vehicle_gui.cpp10
-rw-r--r--src/engine.h2
-rw-r--r--src/engine_gui.cpp2
-rw-r--r--src/newgrf.cpp6
-rw-r--r--src/train_cmd.cpp2
5 files changed, 11 insertions, 11 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index b58aa3ba3..f369ad23d 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -230,8 +230,8 @@ static int CDECL TrainEngineRunningCostSorter(const void *a, const void *b)
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
- Money va = rvi_a->running_cost_base * _price.running_rail[rvi_a->running_cost_class] * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
- Money vb = rvi_b->running_cost_base * _price.running_rail[rvi_b->running_cost_class] * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
+ Money va = rvi_a->running_cost * _price.running_rail[rvi_a->running_cost_class] * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
+ Money vb = rvi_b->running_cost * _price.running_rail[rvi_b->running_cost_class] * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
int r = ClampToI32(va - vb);
return _internal_sort_order ? -r : r;
@@ -248,8 +248,8 @@ static int CDECL TrainEnginePowerVsRunningCostSorter(const void *a, const void *
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
* Another thing is that both power and running costs should be doubled for multiheaded engines.
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
- Money va = (rvi_a->running_cost_base * _price.running_rail[rvi_a->running_cost_class]) / max(1U, (uint)rvi_a->power);
- Money vb = (rvi_b->running_cost_base * _price.running_rail[rvi_b->running_cost_class]) / max(1U, (uint)rvi_b->power);
+ Money va = (rvi_a->running_cost * _price.running_rail[rvi_a->running_cost_class]) / max(1U, (uint)rvi_a->power);
+ Money vb = (rvi_b->running_cost * _price.running_rail[rvi_b->running_cost_class]) / max(1U, (uint)rvi_b->power);
int r = ClampToI32(vb - va);
return _internal_sort_order ? -r : r;
@@ -603,7 +603,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
}
/* Running cost */
- SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
+ SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10;
diff --git a/src/engine.h b/src/engine.h
index 9b44fdb9a..26c7401f9 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -36,7 +36,7 @@ struct RailVehicleInfo {
uint16 max_speed;
uint16 power;
uint16 weight;
- byte running_cost_base;
+ byte running_cost;
byte running_cost_class;
EngineClass engclass; ///< Class of engine for this vehicle
byte capacity;
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index fe89809ac..a2a218d59 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -126,7 +126,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
SetDParam(3, rvi->power << multihead);
SetDParam(1, rvi->weight << multihead);
- SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
+ SetDParam(4, rvi->running_cost * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
if (rvi->capacity != 0) {
SetDParam(5, rvi->cargo_type);
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 88e6aaac4..35bc3801b 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -377,7 +377,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
if (rvi->railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2;
- rvi->running_cost_base = runcostfact;
+ rvi->running_cost = runcostfact;
} break;
case 0x0E: { // Running cost base
@@ -411,14 +411,14 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
if (rvi->railveh_type != RAILVEH_MULTIHEAD) {
// adjust power and running cost if needed
rvi->power /= 2;
- rvi->running_cost_base /= 2;
+ rvi->running_cost /= 2;
}
rvi->railveh_type = RAILVEH_MULTIHEAD;
} else {
if (rvi->railveh_type == RAILVEH_MULTIHEAD) {
// adjust power and running cost if needed
rvi->power *= 2;
- rvi->running_cost_base *= 2;
+ rvi->running_cost *= 2;
}
rvi->railveh_type = rvi->power == 0 ?
RAILVEH_WAGON : RAILVEH_SINGLEHEAD;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 9da5eec69..e700d67b7 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3574,7 +3574,7 @@ Money Train::GetRunningCost() const
do {
const RailVehicleInfo *rvi = RailVehInfo(v->engine_type);
- byte cost_factor = GetVehicleProperty(v, 0x0D, rvi->running_cost_base);
+ byte cost_factor = GetVehicleProperty(v, 0x0D, rvi->running_cost);
if (cost_factor == 0) continue;
cost += cost_factor * _price.running_rail[rvi->running_cost_class];