(svn r21933) -Codechange: Split cur_order_index into cur_auto_order_index and cur_real_order_index to keep track of the current real order in an unambiguous way.

-Fix [FS#4440]: Automatic orders behave now stable wrt. service orders and are not added or removed depending on the need of servicing.
-Fix: Various other issues with automatic orders, e.g. vehicles getting stuck with "no orders" when there are automatic orders at the end of the order list.
This commit is contained in:
frosch
2011-01-31 20:44:15 +00:00
parent c7939e8a63
commit 7c04ea586d
17 changed files with 242 additions and 97 deletions

View File

@@ -44,7 +44,7 @@ OrderBackup::OrderBackup(const Vehicle *v, uint32 user)
{
this->user = user;
this->tile = v->tile;
this->orderindex = v->cur_order_index;
this->orderindex = v->cur_auto_order_index;
this->group = v->group_id;
this->service_interval = v->service_interval;
@@ -87,7 +87,10 @@ void OrderBackup::DoRestore(Vehicle *v)
}
uint num_orders = v->GetNumOrders();
if (num_orders != 0) v->cur_order_index = this->orderindex % num_orders;
if (num_orders != 0) {
v->cur_real_order_index = v->cur_auto_order_index = this->orderindex % num_orders;
v->UpdateRealOrderIndex();
}
v->service_interval = this->service_interval;
/* Restore vehicle group */