equal
deleted
inserted
replaced
461 * Remove the VehicleList that shows all the vehicles with the same shared |
461 * Remove the VehicleList that shows all the vehicles with the same shared |
462 * orders. |
462 * orders. |
463 */ |
463 */ |
464 static void RemoveSharedOrderVehicleList(Vehicle *v) |
464 static void RemoveSharedOrderVehicleList(Vehicle *v) |
465 { |
465 { |
|
466 assert(v->orders != NULL); |
466 WindowClass window_class = WC_NONE; |
467 WindowClass window_class = WC_NONE; |
467 |
468 |
468 switch (v->type) { |
469 switch (v->type) { |
469 default: NOT_REACHED(); |
470 default: NOT_REACHED(); |
470 case VEH_TRAIN: window_class = WC_TRAINS_LIST; break; |
471 case VEH_TRAIN: window_class = WC_TRAINS_LIST; break; |
1157 v->prev_shared = NULL; |
1158 v->prev_shared = NULL; |
1158 v->next_shared = NULL; |
1159 v->next_shared = NULL; |
1159 |
1160 |
1160 /* If we are the only one left in the Shared Order Vehicle List, |
1161 /* If we are the only one left in the Shared Order Vehicle List, |
1161 * remove it, as we are no longer a Shared Order Vehicle */ |
1162 * remove it, as we are no longer a Shared Order Vehicle */ |
1162 if (u->prev_shared == NULL && u->next_shared == NULL) RemoveSharedOrderVehicleList(u); |
1163 if (u->prev_shared == NULL && u->next_shared == NULL && u->orders != NULL) RemoveSharedOrderVehicleList(u); |
1163 |
1164 |
1164 /* We only need to update this-one, because if there is a third |
1165 /* We only need to update this-one, because if there is a third |
1165 * vehicle which shares the same order-list, nothing will change. If |
1166 * vehicle which shares the same order-list, nothing will change. If |
1166 * this is the last vehicle, the last line of the order-window |
1167 * this is the last vehicle, the last line of the order-window |
1167 * will change from Shared order list, to Order list, so it needs |
1168 * will change from Shared order list, to Order list, so it needs |