diff -r b2bd1eaed056 -r 9fd461d00287 train_cmd.c --- a/train_cmd.c Tue Mar 29 08:37:44 2005 +0000 +++ b/train_cmd.c Tue Mar 29 11:19:10 2005 +0000 @@ -736,6 +736,14 @@ dst_head = NULL; if (dst != NULL) dst_head = GetFirstVehicleInChain(dst); + /* clear the ->first cache */ + { + Vehicle *u; + + for (u = src_head; u != NULL; u = u->next) u->first = NULL; + for (u = dst_head; u != NULL; u = u->next) u->first = NULL; + } + /* check if all vehicles in the source train are stopped */ if (CheckTrainStoppedInDepot(src_head) < 0) return CMD_ERROR; @@ -939,6 +947,9 @@ // when selling an attached locomotive. we need to delete its window. if (v->subtype == TS_Front_Engine) { + Vehicle *u; + + for (u = v; u != NULL; u = u->next) u->first = NULL; DeleteWindowById(WC_VEHICLE_VIEW, v->index); // rearrange all vehicles that follow to separate lines.