summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-02-08 19:06:46 +0000
committerpeter1138 <peter1138@openttd.org>2006-02-08 19:06:46 +0000
commitbc0b97ea2fbf1672de7ef03a84c374fdd01d431e (patch)
tree2fd8a7cb69edfbcd8ecae362a917fc9ce2c1e1b7
parent96cac2031898be8c8238a188c739abafb8ee70ea (diff)
downloadopenttd-bc0b97ea2fbf1672de7ef03a84c374fdd01d431e.tar.xz
(svn r3579) v->u.rail.first_engine holds an engine type, not a vehicle index, so use INVALID_ENGINE.
-rw-r--r--train_cmd.c4
-rw-r--r--vehicle.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 309ddc128..21839c44b 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -86,7 +86,7 @@ void TrainConsistChanged(Vehicle* v)
assert(IsFrontEngine(v) || IsFreeWagon(v));
rvi_v = RailVehInfo(v->engine_type);
- first_engine = IsFrontEngine(v) ? v->engine_type : INVALID_VEHICLE;
+ first_engine = IsFrontEngine(v) ? v->engine_type : INVALID_ENGINE;
v->u.rail.cached_total_length = 0;
for (u = v; u != NULL; u = u->next) {
@@ -97,7 +97,7 @@ void TrainConsistChanged(Vehicle* v)
if (u->first == NULL) u->first = v;
// update the 'first engine'
- u->u.rail.first_engine = (v == u) ? INVALID_VEHICLE : first_engine;
+ u->u.rail.first_engine = (v == u) ? INVALID_ENGINE : first_engine;
if (rvi_u->visual_effect != 0) {
u->u.rail.cached_vis_effect = rvi_u->visual_effect;
diff --git a/vehicle.c b/vehicle.c
index 4740ab9ac..ede33bfd6 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1753,7 +1753,7 @@ static void MaybeReplaceVehicle(Vehicle *v)
temp_cost = ReplaceVehicle(&w, flags);
if (flags & DC_EXEC &&
- (w->type != VEH_Train || w->u.rail.first_engine == INVALID_VEHICLE)) {
+ (w->type != VEH_Train || w->u.rail.first_engine == INVALID_ENGINE)) {
/* now we bought a new engine and sold the old one. We need to fix the
* pointers in order to avoid pointing to the old one for trains: these
* pointers should point to the front engine and not the cars