station_cmd.c
changeset 1706 70c2d2ad472a
parent 1685 b9cfe79393c0
child 1751 954dd2900ac9
--- a/station_cmd.c	Sat Apr 16 18:09:24 2005 +0000
+++ b/station_cmd.c	Sat Apr 16 20:10:24 2005 +0000
@@ -1560,8 +1560,17 @@
 		return CMD_ERROR;
 
 	if (flags & DC_EXEC) {
+		int i;
 		DoClearSquare(tile);
 
+		/* Clear all vehicles destined for this station */
+		for (i = 0; i != NUM_SLOTS; i++) {
+			if (cur_stop->slot[i] != INVALID_SLOT) {
+				Vehicle *v = GetVehicle(cur_stop->slot[i]);
+				ClearSlot(v, v->u.road.slot);
+			}
+		}
+
 		cur_stop->used = false;
 		if (cur_stop->prev != NULL)	//alter previous stop
 			cur_stop->prev->next = cur_stop->next;