# HG changeset patch # User peter1138 # Date 1139425606 0 # Node ID f5351c475765e7df6687734316d84dd690d07312 # Parent 811ec359a2e3b276a0af2fe650b405b0e0ca3ca9 (svn r3579) v->u.rail.first_engine holds an engine type, not a vehicle index, so use INVALID_ENGINE. diff -r 811ec359a2e3 -r f5351c475765 train_cmd.c --- a/train_cmd.c Wed Feb 08 08:18:29 2006 +0000 +++ b/train_cmd.c Wed Feb 08 19:06:46 2006 +0000 @@ -86,7 +86,7 @@ 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 @@ 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 -r 811ec359a2e3 -r f5351c475765 vehicle.c --- a/vehicle.c Wed Feb 08 08:18:29 2006 +0000 +++ b/vehicle.c Wed Feb 08 19:06:46 2006 +0000 @@ -1753,7 +1753,7 @@ 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