Mercurial > hg > openttd
changeset 11014:1a4a901b1a95 draft
(svn r15354) -Fix (r14803): first shared of a vehicle could be NULL making it impossible to (share-)clone the vehicle.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 05 Feb 2009 15:58:42 +0000 |
parents | ec39f4c7f0ea |
children | fe0909a41c73 |
files | src/order_cmd.cpp src/vehicle_base.h |
diffstat | 2 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1427,9 +1427,8 @@ /* Do we only have 1 station in our order list? */ if (n_st < 2 && problem_type == -1) problem_type = 0; - assert(v->orders.list); // otherwise the check for v->FirstShared() != v would have been true #ifndef NDEBUG - v->orders.list->DebugCheckSanity(); + if (v->orders.list != NULL) v->orders.list->DebugCheckSanity(); #endif /* We don't have a problem */
--- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -515,7 +515,7 @@ * Get the first vehicle of this vehicle chain. * @return the first vehicle of the chain. */ - inline Vehicle *FirstShared() const { return (this->orders.list == NULL) ? NULL : this->orders.list->GetFirstSharedVehicle(); } + inline Vehicle *FirstShared() const { return (this->orders.list == NULL) ? this->First() : this->orders.list->GetFirstSharedVehicle(); } /** * Check if we share our orders with another vehicle.