(svn r22473) -Codechange: Automatic orders are better called implicit orders as no real order influencing path finding is added

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
planetmaker 13 years ago
parent bc6b348e7a
commit 43c8cd1d5e

@ -66,11 +66,11 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (order_position == AIOrder::ORDER_INVALID) return NULL;
}
const Order *order = v->orders.list->GetFirstOrder();
while (order->GetType() == OT_AUTOMATIC) order = order->next;
while (order->GetType() == OT_IMPLICIT) order = order->next;
while (order_position > 0) {
order_position = (AIOrder::OrderPosition)(order_position - 1);
order = order->next;
while (order->GetType() == OT_AUTOMATIC) order = order->next;
while (order->GetType() == OT_IMPLICIT) order = order->next;
}
return order;
}
@ -135,12 +135,12 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
int cur_order_pos = ::Vehicle::Get(vehicle_id)->cur_real_order_index;
const Order *order = ::Vehicle::Get(vehicle_id)->GetOrder(0);
if (order == NULL) return ORDER_INVALID;
int num_automatic_orders = 0;
int num_implicit_orders = 0;
for (int i = 0; i < cur_order_pos; i++) {
if (order->GetType() == OT_AUTOMATIC) num_automatic_orders++;
if (order->GetType() == OT_IMPLICIT) num_implicit_orders++;
order = order->next;
}
return (AIOrder::OrderPosition)(cur_order_pos - num_automatic_orders);
return (AIOrder::OrderPosition)(cur_order_pos - num_implicit_orders);
}
return (order_position >= 0 && order_position < ::Vehicle::Get(vehicle_id)->GetNumManualOrders()) ? order_position : ORDER_INVALID;
}

@ -52,7 +52,7 @@ struct GroundVehicleCache {
enum GroundVehicleFlags {
GVF_GOINGUP_BIT = 0, ///< Vehicle is currently going uphill. (Cached track information for acceleration)
GVF_GOINGDOWN_BIT = 1, ///< Vehicle is currently going downhill. (Cached track information for acceleration)
GVF_SUPPRESS_AUTOMATIC_ORDERS = 2, ///< Disable insertion and removal of automatic orders until the vehicle completes the real order.
GVF_SUPPRESS_IMPLICIT_ORDERS = 2, ///< Disable insertion and removal of automatic orders until the vehicle completes the real order.
};
/**

@ -3229,7 +3229,7 @@ STR_ORDER_STOP_ORDER :توقف
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(تلقائى)
STR_ORDER_IMPLICIT :(تلقائى)
STR_ORDER_FULL_LOAD :-تحميل بالكامل-
STR_ORDER_FULL_LOAD_ANY :-حمل اي بضاعة بالكامل-

@ -3593,7 +3593,7 @@ STR_ORDER_STOP_ORDER :(Стоп)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Аўтаматычна)
STR_ORDER_IMPLICIT :(Аўтаматычна)
STR_ORDER_FULL_LOAD :(Поўная загрузка)
STR_ORDER_FULL_LOAD_ANY :(Поўная загрузка любым грузам)

@ -3237,7 +3237,7 @@ STR_ORDER_STOP_ORDER :(Parar)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatico)
STR_ORDER_IMPLICIT :(Automatico)
STR_ORDER_FULL_LOAD :(Carregar completamente)
STR_ORDER_FULL_LOAD_ANY :(Carregar completamente qualquer carga)

@ -3222,7 +3222,7 @@ STR_ORDER_STOP_ORDER :(Спри)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :{G=n}(Автоматично)
STR_ORDER_IMPLICIT :{G=n}(Автоматично)
STR_ORDER_FULL_LOAD :(Напълно натовари)
STR_ORDER_FULL_LOAD_ANY :(Напълно натовари какъвто и да е товар)

@ -3237,7 +3237,7 @@ STR_ORDER_STOP_ORDER :(Para)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automàtic)
STR_ORDER_IMPLICIT :(Automàtic)
STR_ORDER_FULL_LOAD :(Carrega del tot)
STR_ORDER_FULL_LOAD_ANY :(Carrega del tot qualsevol càrrega)

@ -3332,7 +3332,7 @@ STR_ORDER_STOP_ORDER :(Stani)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatsko)
STR_ORDER_IMPLICIT :(Automatsko)
STR_ORDER_FULL_LOAD :(Puni ukrcaj)
STR_ORDER_FULL_LOAD_ANY :(Puni ukrcaj bilo kojeg tereta)

@ -3324,7 +3324,7 @@ STR_ORDER_STOP_ORDER :(Zastavit)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(automatický)
STR_ORDER_IMPLICIT :(automatický)
STR_ORDER_FULL_LOAD :(plně naložit)
STR_ORDER_FULL_LOAD_ANY :(plně naložit cokoli)

@ -3229,7 +3229,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatisk)
STR_ORDER_IMPLICIT :(Automatisk)
STR_ORDER_FULL_LOAD :(Fuld last)
STR_ORDER_FULL_LOAD_ANY :(Fuld last vilkårlig type fragt)

@ -3236,7 +3236,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatisch)
STR_ORDER_IMPLICIT :(Automatisch)
STR_ORDER_FULL_LOAD :(Volledig laden)
STR_ORDER_FULL_LOAD_ANY :(Één soort vracht volledig laden)

@ -3236,7 +3236,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatic)
STR_ORDER_IMPLICIT :(Automatic)
STR_ORDER_FULL_LOAD :(Full load)
STR_ORDER_FULL_LOAD_ANY :(Full load any cargo)

@ -3236,7 +3236,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatic)
STR_ORDER_IMPLICIT :(Automatic)
STR_ORDER_FULL_LOAD :(Full load)
STR_ORDER_FULL_LOAD_ANY :(Full load any cargo)

@ -3165,7 +3165,7 @@ STR_ORDER_STOP_ORDER :(Haltu)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Aŭtomata)
STR_ORDER_IMPLICIT :(Aŭtomata)
STR_ORDER_FULL_LOAD :(Plena Ŝarĝo)
STR_ORDER_FULL_LOAD_ANY :(Ŝarĝu ĝis plena ajnan kargon)

@ -3286,7 +3286,7 @@ STR_ORDER_STOP_ORDER :(Peatu)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automaatne)
STR_ORDER_IMPLICIT :(Automaatne)
STR_ORDER_FULL_LOAD :(Laaditakse täis)
STR_ORDER_FULL_LOAD_ANY :(Ühte kaupa laaditakse täis)

@ -3236,7 +3236,7 @@ STR_ORDER_STOP_ORDER :(Pysähdy)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automaattinen)
STR_ORDER_IMPLICIT :(Automaattinen)
STR_ORDER_FULL_LOAD :(Täysi lastaus)
STR_ORDER_FULL_LOAD_ANY :(Lastaa täyteen mitä tahansa rahtia)

@ -3237,7 +3237,7 @@ STR_ORDER_STOP_ORDER :(Arrêt)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatique)
STR_ORDER_IMPLICIT :(Automatique)
STR_ORDER_FULL_LOAD :(Charger complètement)
STR_ORDER_FULL_LOAD_ANY :(Charger complètement par un seul type)

@ -3237,7 +3237,7 @@ STR_ORDER_STOP_ORDER :(Stopp)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatisch)
STR_ORDER_IMPLICIT :(Automatisch)
STR_ORDER_FULL_LOAD :(Voll beladen)
STR_ORDER_FULL_LOAD_ANY :(Mit einer Fracht voll beladen)

@ -3323,7 +3323,7 @@ STR_ORDER_STOP_ORDER :(Στάση)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Αυτόματο)
STR_ORDER_IMPLICIT :(Αυτόματο)
STR_ORDER_FULL_LOAD :(Πλήρης φόρτωση)
STR_ORDER_FULL_LOAD_ANY :(Πλήρης φόρτωση οποιουδήποτε εμπορεύματος)

@ -3294,7 +3294,7 @@ STR_ORDER_STOP_ORDER :(megáll)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automata)
STR_ORDER_IMPLICIT :(Automata)
STR_ORDER_FULL_LOAD :(Mindenből teljes berakodás)
STR_ORDER_FULL_LOAD_ANY :(Bármiből teljes berakodás)

@ -3229,7 +3229,7 @@ STR_ORDER_STOP_ORDER :(Berhenti)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Otomatis)
STR_ORDER_IMPLICIT :(Otomatis)
STR_ORDER_FULL_LOAD :(Penuhi Semua)
STR_ORDER_FULL_LOAD_ANY :(Penuhi salah satu)

@ -3227,7 +3227,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Uathoibríoch)
STR_ORDER_IMPLICIT :(Uathoibríoch)
STR_ORDER_FULL_LOAD :(Lasta iomlán)
STR_ORDER_FULL_LOAD_ANY :(Lasta iomlán de lastas ar bith)

@ -3260,7 +3260,7 @@ STR_ORDER_STOP_ORDER :(Ferma)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatico)
STR_ORDER_IMPLICIT :(Automatico)
STR_ORDER_FULL_LOAD :(Attendi pieno carico)
STR_ORDER_FULL_LOAD_ANY :(Attendi carico)

@ -3229,7 +3229,7 @@ STR_ORDER_STOP_ORDER :(停止)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(自動的)
STR_ORDER_IMPLICIT :(自動的)
STR_ORDER_FULL_LOAD :(全積載)
STR_ORDER_FULL_LOAD_ANY :(いずれか一種の貨物を全積載するまで待つ)

@ -3230,7 +3230,7 @@ STR_ORDER_STOP_ORDER :(멈춤)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(자동)
STR_ORDER_IMPLICIT :(자동)
STR_ORDER_FULL_LOAD :(모든 화물을 가득 실음)
STR_ORDER_FULL_LOAD_ANY :(아무 화물이나 가득 싣기)

@ -3133,7 +3133,7 @@ STR_ORDER_STOP_ORDER :(Apstādināt)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automātiski)
STR_ORDER_IMPLICIT :(Automātiski)
STR_ORDER_FULL_LOAD :(Piekraut pilnu)
STR_ORDER_FULL_LOAD_ANY :(Piekraut pilnu ar jebkuru kravu)

@ -3284,7 +3284,7 @@ STR_ORDER_STOP_ORDER :(Sustoti)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatinis)
STR_ORDER_IMPLICIT :(Automatinis)
STR_ORDER_FULL_LOAD :(Pilnai pasikrauti)
STR_ORDER_FULL_LOAD_ANY :(Pilnai pasikrauti, bet kurio krovinio)

@ -3236,7 +3236,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatësch)
STR_ORDER_IMPLICIT :(Automatësch)
STR_ORDER_FULL_LOAD :(Voll lueden)
STR_ORDER_FULL_LOAD_ANY :(Voll lueden mat all Wuer)

@ -3217,7 +3217,7 @@ STR_ORDER_STOP_ORDER :(Stopp)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatisk)
STR_ORDER_IMPLICIT :(Automatisk)
STR_ORDER_FULL_LOAD :(Full last)
STR_ORDER_FULL_LOAD_ANY :(Full last av alle varetyper)

@ -3219,7 +3219,7 @@ STR_ORDER_STOP_ORDER :(Stopp)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatisk)
STR_ORDER_IMPLICIT :(Automatisk)
STR_ORDER_FULL_LOAD :(Last fullt)
STR_ORDER_FULL_LOAD_ANY :(Last fullt, vilkårleg last)

@ -3620,7 +3620,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatycznie)
STR_ORDER_IMPLICIT :(Automatycznie)
STR_ORDER_FULL_LOAD :(Pełen załadunek)
STR_ORDER_FULL_LOAD_ANY :(Pełen załadunek dowolnego towaru)

@ -3231,7 +3231,7 @@ STR_ORDER_STOP_ORDER :(Parar)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automático)
STR_ORDER_IMPLICIT :(Automático)
STR_ORDER_FULL_LOAD :(Encher)
STR_ORDER_FULL_LOAD_ANY :(Encher de qq. carga)

@ -3236,7 +3236,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automat)
STR_ORDER_IMPLICIT :(Automat)
STR_ORDER_FULL_LOAD :(Încărcare maximă)
STR_ORDER_FULL_LOAD_ANY :(Încărcare orice produs)

@ -3422,7 +3422,7 @@ STR_ORDER_STOP_ORDER :(Стоп)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Автоматически)
STR_ORDER_IMPLICIT :(Автоматически)
STR_ORDER_FULL_LOAD :(Полная погрузка)
STR_ORDER_FULL_LOAD_ANY :(Полная погрузка любым грузом)

@ -3447,7 +3447,7 @@ STR_ORDER_STOP_ORDER :(Stani)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatski)
STR_ORDER_IMPLICIT :(Automatski)
STR_ORDER_FULL_LOAD :(Pun utovar)
STR_ORDER_FULL_LOAD_ANY :(Pun utovar bilo kog)

@ -3224,7 +3224,7 @@ STR_ORDER_STOP_ORDER :(停留)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(自动)
STR_ORDER_IMPLICIT :(自动)
STR_ORDER_FULL_LOAD :(装满全部货物)
STR_ORDER_FULL_LOAD_ANY :(装满任意货物后离开)

@ -3296,7 +3296,7 @@ STR_ORDER_STOP_ORDER :(Zastaviť)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automaticky)
STR_ORDER_IMPLICIT :(Automaticky)
STR_ORDER_FULL_LOAD :(Plne nalož)
STR_ORDER_FULL_LOAD_ANY :(Plne nalož akýkoľvek náklad)

@ -3383,7 +3383,7 @@ STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Avtomatično)
STR_ORDER_IMPLICIT :(Avtomatično)
STR_ORDER_FULL_LOAD :(Napolni)
STR_ORDER_FULL_LOAD_ANY :(Napolni kakršenkoli tovor)

@ -3237,7 +3237,7 @@ STR_ORDER_STOP_ORDER :(Detenerse)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automática)
STR_ORDER_IMPLICIT :(Automática)
STR_ORDER_FULL_LOAD :(Carga completa)
STR_ORDER_FULL_LOAD_ANY :(Carga completa cualquier carga)

@ -3232,7 +3232,7 @@ STR_ORDER_STOP_ORDER :(Stanna)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatisk)
STR_ORDER_IMPLICIT :(Automatisk)
STR_ORDER_FULL_LOAD :(Full last)
STR_ORDER_FULL_LOAD_ANY :(Full last någon godstyp)

@ -3229,7 +3229,7 @@ STR_ORDER_STOP_ORDER :(停止)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(自動)
STR_ORDER_IMPLICIT :(自動)
STR_ORDER_FULL_LOAD :(滿載)
STR_ORDER_FULL_LOAD_ANY :(滿載任一種類客貨)

@ -3223,7 +3223,7 @@ STR_ORDER_STOP_ORDER :(Dur)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Otomatik)
STR_ORDER_IMPLICIT :(Otomatik)
STR_ORDER_FULL_LOAD :(Tam yükle)
STR_ORDER_FULL_LOAD_ANY :(Bir kargoyu tam yükle)

@ -3354,7 +3354,7 @@ STR_ORDER_STOP_ORDER :(зупинит
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Автоматично)
STR_ORDER_IMPLICIT :(Автоматично)
STR_ORDER_FULL_LOAD :(Завантажити все)
STR_ORDER_FULL_LOAD_ANY :(Повністю завантажити будь-який вид вантажу)

@ -1780,7 +1780,7 @@ STR_ORDER_GO_TO_DEPOT_FORMAT :{STRING} {DEPOT
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Automatikoa)
STR_ORDER_IMPLICIT :(Automatikoa)

@ -2381,7 +2381,7 @@ STR_ORDER_GO_NON_STOP_TO_WAYPOINT :Oanienwei lâns
STR_ORDER_AUTOMATIC :( Automatysk)
STR_ORDER_IMPLICIT :( Automatysk)
STR_ORDER_NO_UNLOAD_NO_LOAD :(net lade of losse)

@ -798,7 +798,7 @@ STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}Hassar l
STR_ORDER_AUTOMATIC :(Awtomatiku)
STR_ORDER_IMPLICIT :(Awtomatiku)

@ -1177,7 +1177,7 @@ STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}सर
STR_ORDER_AUTOMATIC :(आपोआप)
STR_ORDER_IMPLICIT :(आपोआप)

@ -1008,7 +1008,7 @@ STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}அன
STR_ORDER_AUTOMATIC :(தானியங்கி)
STR_ORDER_IMPLICIT :(தானியங்கி)
STR_ORDER_NO_UNLOAD_NO_LOAD :(லோடிங் அன்லோடிங் தடைசெய்யப்பட்டுள்ளது)

@ -2527,7 +2527,7 @@ STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}ลบ
STR_ORDER_AUTOMATIC :(อัตโนมัติ)
STR_ORDER_IMPLICIT :(อัตโนมัติ)
STR_ORDER_NO_UNLOAD_NO_LOAD :(ไม่มีการขนถ่ายสินค้า)

@ -3233,7 +3233,7 @@ STR_ORDER_STOP_ORDER :(Dừng)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_AUTOMATIC :(Tự động)
STR_ORDER_IMPLICIT :(Tự động)
STR_ORDER_FULL_LOAD :(Bốc đầy hàng)
STR_ORDER_FULL_LOAD_ANY :(Bốc đủ bất kỳ hàng nào)

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

@ -77,7 +77,7 @@ public:
void MakeLeaveStation();
void MakeDummy();
void MakeConditional(VehicleOrderID order);
void MakeAutomatic(StationID destination);
void MakeImplicit(StationID destination);
/**
* Gets the destination of this order.

@ -134,12 +134,12 @@ void Order::MakeConditional(VehicleOrderID order)
}
/**
* Makes this order an automatic order.
* Makes this order an implicit order.
* @param destination the station to go to.
*/
void Order::MakeAutomatic(StationID destination)
void Order::MakeImplicit(StationID destination)
{
this->type = OT_AUTOMATIC;
this->type = OT_IMPLICIT;
this->dest = destination;
}
@ -288,7 +288,7 @@ void OrderList::Initialize(Order *chain, Vehicle *v)
for (Order *o = this->first; o != NULL; o = o->next) {
++this->num_orders;
if (!o->IsType(OT_AUTOMATIC)) ++this->num_manual_orders;
if (!o->IsType(OT_IMPLICIT)) ++this->num_manual_orders;
this->timetable_duration += o->wait_time + o->travel_time;
}
@ -365,7 +365,7 @@ void OrderList::InsertOrderAt(Order *new_order, int index)
}
}
++this->num_orders;
if (!new_order->IsType(OT_AUTOMATIC)) ++this->num_manual_orders;
if (!new_order->IsType(OT_IMPLICIT)) ++this->num_manual_orders;
this->timetable_duration += new_order->wait_time + new_order->travel_time;
}
@ -389,7 +389,7 @@ void OrderList::DeleteOrderAt(int index)
prev->next = to_remove->next;
}
--this->num_orders;
if (!to_remove->IsType(OT_AUTOMATIC)) --this->num_manual_orders;
if (!to_remove->IsType(OT_IMPLICIT)) --this->num_manual_orders;
this->timetable_duration -= (to_remove->wait_time + to_remove->travel_time);
delete to_remove;
}
@ -469,8 +469,8 @@ int OrderList::GetPositionInSharedOrderList(const Vehicle *v) const
bool OrderList::IsCompleteTimetable() const
{
for (Order *o = this->first; o != NULL; o = o->next) {
/* Automatic orders are, by definition, not timetabled. */
if (o->IsType(OT_AUTOMATIC)) continue;
/* Implicit orders are, by definition, not timetabled. */
if (o->IsType(OT_IMPLICIT)) continue;
if (!o->IsCompletelyTimetabled()) return false;
}
return true;
@ -490,7 +490,7 @@ void OrderList::DebugCheckSanity() const
for (const Order *o = this->first; o != NULL; o = o->next) {
++check_num_orders;
if (!o->IsType(OT_AUTOMATIC)) ++check_num_manual_orders;
if (!o->IsType(OT_IMPLICIT)) ++check_num_manual_orders;
check_timetable_duration += o->wait_time + o->travel_time;
}
assert(this->num_orders == check_num_orders);
@ -544,7 +544,7 @@ TileIndex Order::GetLocation(const Vehicle *v) const
switch (this->GetType()) {
case OT_GOTO_WAYPOINT:
case OT_GOTO_STATION:
case OT_AUTOMATIC:
case OT_IMPLICIT:
return BaseStation::Get(this->GetDestination())->xy;
case OT_GOTO_DEPOT:
@ -820,8 +820,8 @@ void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
assert(v->orders.list == u->orders.list);
/* If there is added an order before the current one, we need
* to update the selected order. We do not change automatic/real order indices though.
* If the new order is between the current auto order and real order, the auto order will
* to update the selected order. We do not change implicit/real order indices though.
* If the new order is between the current implicit order and real order, the implicit order will
* later skip the inserted order. */
if (sel_ord <= u->cur_real_order_index) {
uint cur = u->cur_real_order_index + 1;
@ -830,18 +830,18 @@ void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
u->cur_real_order_index = cur;
}
}
if (sel_ord == u->cur_auto_order_index && u->IsGroundVehicle()) {
/* We are inserting an order just before the current automatic order.
* We do not know whether we will reach current automatic or the newly inserted order first.
* So, disable creation of automatic orders until we are on track again. */
if (sel_ord == u->cur_implicit_order_index && u->IsGroundVehicle()) {
/* We are inserting an order just before the current implicit order.
* We do not know whether we will reach current implicit or the newly inserted order first.
* So, disable creation of implicit orders until we are on track again. */
uint16 &gv_flags = u->GetGroundVehicleFlags();
SetBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
}
if (sel_ord <= u->cur_auto_order_index) {
uint cur = u->cur_auto_order_index + 1;
if (sel_ord <= u->cur_implicit_order_index) {
uint cur = u->cur_implicit_order_index + 1;
/* Check if we don't go out of bound */
if (cur < u->GetNumOrders()) {
u->cur_auto_order_index = cur;
u->cur_implicit_order_index = cur;
}
}
/* Update any possible open window of the vehicle */
@ -952,16 +952,16 @@ void DeleteOrder(Vehicle *v, VehicleOrderID sel_ord)
u->UpdateRealOrderIndex();
}
if (sel_ord < u->cur_auto_order_index) {
u->cur_auto_order_index--;
} else if (sel_ord == u->cur_auto_order_index) {
if (sel_ord < u->cur_implicit_order_index) {
u->cur_implicit_order_index--;
} else if (sel_ord == u->cur_implicit_order_index) {
/* Make sure the index is valid */
if (u->cur_auto_order_index >= u->GetNumOrders()) u->cur_auto_order_index = 0;
if (u->cur_implicit_order_index >= u->GetNumOrders()) u->cur_implicit_order_index = 0;
/* Skip non-automatic orders for the auto-order-index (e.g. if the current auto order was deleted */
while (u->cur_auto_order_index != u->cur_real_order_index && !u->GetOrder(u->cur_auto_order_index)->IsType(OT_AUTOMATIC)) {
u->cur_auto_order_index++;
if (u->cur_auto_order_index >= u->GetNumOrders()) u->cur_auto_order_index = 0;
/* Skip non-implicit orders for the implicit-order-index (e.g. if the current implicit order was deleted */
while (u->cur_implicit_order_index != u->cur_real_order_index && !u->GetOrder(u->cur_implicit_order_index)->IsType(OT_IMPLICIT)) {
u->cur_implicit_order_index++;
if (u->cur_implicit_order_index >= u->GetNumOrders()) u->cur_implicit_order_index = 0;
}
}
@ -1005,13 +1005,13 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
Vehicle *v = Vehicle::GetIfValid(veh_id);
if (v == NULL || !v->IsPrimaryVehicle() || sel_ord == v->cur_auto_order_index || sel_ord >= v->GetNumOrders() || v->GetNumOrders() < 2) return CMD_ERROR;
if (v == NULL || !v->IsPrimaryVehicle() || sel_ord == v->cur_implicit_order_index || sel_ord >= v->GetNumOrders() || v->GetNumOrders() < 2) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;
if (flags & DC_EXEC) {
v->cur_auto_order_index = v->cur_real_order_index = sel_ord;
v->cur_implicit_order_index = v->cur_real_order_index = sel_ord;
v->UpdateRealOrderIndex();
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
@ -1069,7 +1069,7 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
for (; u != NULL; u = u->NextShared()) {
/* Update the current order.
* There are multiple ways to move orders, which result in cur_auto_order_index
* There are multiple ways to move orders, which result in cur_implicit_order_index
* and cur_real_order_index to not longer make any sense. E.g. moving another
* real order between them.
*
@ -1079,10 +1079,10 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
* However, from an AI point of view, preserving cur_real_order_index is the most
* predictable and transparent behaviour.
*
* With that decision it basically does not matter what we do to cur_auto_order_index.
* If we change orders between the auto- and real-index, the auto orders are mostly likely
* completely out-dated anyway. So, keep it simple and just keep cur_auto_order_index as well.
* The worst which can happen is that a lot of automatic orders are removed when reaching current_order.
* With that decision it basically does not matter what we do to cur_implicit_order_index.
* If we change orders between the implict- and real-index, the implicit orders are mostly likely
* completely out-dated anyway. So, keep it simple and just keep cur_implicit_order_index as well.
* The worst which can happen is that a lot of implicit orders are removed when reaching current_order.
*/
if (u->cur_real_order_index == moving_order) {
u->cur_real_order_index = target_order;
@ -1092,12 +1092,12 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
u->cur_real_order_index++;
}
if (u->cur_auto_order_index == moving_order) {
u->cur_auto_order_index = target_order;
} else if (u->cur_auto_order_index > moving_order && u->cur_auto_order_index <= target_order) {
u->cur_auto_order_index--;
} else if (u->cur_auto_order_index < moving_order && u->cur_auto_order_index >= target_order) {
u->cur_auto_order_index++;
if (u->cur_implicit_order_index == moving_order) {
u->cur_implicit_order_index = target_order;
} else if (u->cur_implicit_order_index > moving_order && u->cur_implicit_order_index <= target_order) {
u->cur_implicit_order_index--;
} else if (u->cur_implicit_order_index < moving_order && u->cur_implicit_order_index >= target_order) {
u->cur_implicit_order_index++;
}
assert(v->orders.list == u->orders.list);
@ -1650,12 +1650,12 @@ restart:
OrderType ot = order->GetType();
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue;
if (ot == OT_AUTOMATIC || (v->type == VEH_AIRCRAFT && ot == OT_GOTO_DEPOT)) ot = OT_GOTO_STATION;
if (ot == OT_IMPLICIT || (v->type == VEH_AIRCRAFT && ot == OT_GOTO_DEPOT)) ot = OT_GOTO_STATION;
if (ot == type && order->GetDestination() == destination) {
/* We want to clear automatic orders, but we don't want to make them
/* We want to clear implicit orders, but we don't want to make them
* dummy orders. They should just vanish. Also check the actual order
* type as ot is currently OT_GOTO_STATION. */
if (order->IsType(OT_AUTOMATIC)) {
if (order->IsType(OT_IMPLICIT)) {
order = order->next; // DeleteOrder() invalidates current order
DeleteOrder(v, id);
if (order != NULL) goto restart;
@ -1692,7 +1692,7 @@ bool Vehicle::HasDepotOrder() const
* Delete all orders from a vehicle
* @param v Vehicle whose orders to reset
* @param keep_orderlist If true, do not free the order list, only empty it.
* @param reset_order_indices If true, reset cur_auto_order_index and cur_real_order_index
* @param reset_order_indices If true, reset cur_implicit_order_index and cur_real_order_index
* and cancel the current full load order (if the vehicle is loading).
* If false, _you_ have to make sure the order indices are valid after
* your messing with them!
@ -1712,7 +1712,7 @@ void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist, bool reset_order_indic
}
if (reset_order_indices) {
v->cur_auto_order_index = v->cur_real_order_index = 0;
v->cur_implicit_order_index = v->cur_real_order_index = 0;
if (v->current_order.IsType(OT_LOADING)) {
CancelLoadingDueToDeletedOrder(v);
}
@ -1866,18 +1866,18 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
case OT_CONDITIONAL: {
VehicleOrderID next_order = ProcessConditionalOrder(order, v);
if (next_order != INVALID_VEH_ORDER_ID) {
/* Jump to next_order. cur_auto_order_index becomes exactly that order,
/* Jump to next_order. cur_implicit_order_index becomes exactly that order,
* cur_real_order_index might come after next_order. */
UpdateVehicleTimetable(v, false);
v->cur_auto_order_index = v->cur_real_order_index = next_order;
v->cur_implicit_order_index = v->cur_real_order_index = next_order;
v->UpdateRealOrderIndex();
v->current_order_time += v->GetOrder(v->cur_real_order_index)->travel_time;
/* Disable creation of automatic orders.
/* Disable creation of implicit orders.
* When inserting them we do not know that we would have to make the conditional orders point to them. */
if (v->IsGroundVehicle()) {
uint16 &gv_flags = v->GetGroundVehicleFlags();
SetBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
}
} else {
UpdateVehicleTimetable(v, true);
@ -1891,12 +1891,12 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
return false;
}
assert(v->cur_auto_order_index < v->GetNumOrders());
assert(v->cur_implicit_order_index < v->GetNumOrders());
assert(v->cur_real_order_index < v->GetNumOrders());
/* Get the current order */
order = v->GetOrder(v->cur_real_order_index);
if (order != NULL && order->IsType(OT_AUTOMATIC)) {
if (order != NULL && order->IsType(OT_IMPLICIT)) {
assert(v->GetNumManualOrders() == 0);
order = NULL;
}
@ -1949,22 +1949,22 @@ bool ProcessOrders(Vehicle *v)
if (((v->current_order.IsType(OT_GOTO_STATION) && (v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) || v->current_order.IsType(OT_GOTO_WAYPOINT)) &&
IsTileType(v->tile, MP_STATION) &&
v->current_order.GetDestination() == GetStationIndex(v->tile)) {
v->DeleteUnreachedAutoOrders();
v->DeleteUnreachedImplicitOrders();
/* We set the last visited station here because we do not want
* the train to stop at this 'via' station if the next order
* is a no-non-stop order; in that case not setting the last
* visited station will cause the vehicle to still stop. */
v->last_station_visited = v->current_order.GetDestination();
UpdateVehicleTimetable(v, true);
v->IncrementAutoOrderIndex();
v->IncrementImplicitOrderIndex();
}
/* Get the current order */
assert(v->cur_auto_order_index == 0 || v->cur_auto_order_index < v->GetNumOrders());
assert(v->cur_implicit_order_index == 0 || v->cur_implicit_order_index < v->GetNumOrders());
v->UpdateRealOrderIndex();
const Order *order = v->GetOrder(v->cur_real_order_index);
if (order != NULL && order->IsType(OT_AUTOMATIC)) {
if (order != NULL && order->IsType(OT_IMPLICIT)) {
assert(v->GetNumManualOrders() == 0);
order = NULL;
}

@ -198,12 +198,12 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
if (v->cur_real_order_index == order_index) {
DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
} else if (v->cur_auto_order_index == order_index) {
} else if (v->cur_implicit_order_index == order_index) {
DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
}
TextColour colour = TC_BLACK;
if (order->IsType(OT_AUTOMATIC)) {
if (order->IsType(OT_IMPLICIT)) {
colour = (selected ? TC_SILVER : TC_GREY) | TC_NO_SHADE;
} else if (selected) {
colour = TC_WHITE;
@ -220,11 +220,11 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
SetDParam(1, order->GetDestination());
break;
case OT_AUTOMATIC:
case OT_IMPLICIT:
SetDParam(0, STR_ORDER_GO_TO_STATION);
SetDParam(1, STR_ORDER_GO_TO);
SetDParam(2, order->GetDestination());
SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_AUTOMATIC);
SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_IMPLICIT);
break;
case OT_GOTO_STATION: {
@ -685,10 +685,10 @@ private:
void OrderClick_Skip(int i)
{
/* Don't skip when there's nothing to skip */
if (_ctrl_pressed && this->vehicle->cur_auto_order_index == this->OrderGetSel()) return;
if (_ctrl_pressed && this->vehicle->cur_implicit_order_index == this->OrderGetSel()) return;
if (this->vehicle->GetNumOrders() <= 1) return;
DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_auto_order_index + 1) % this->vehicle->GetNumOrders()),
DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()),
CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER));
}

@ -38,7 +38,7 @@ enum OrderType {
OT_DUMMY = 5,
OT_GOTO_WAYPOINT = 6,
OT_CONDITIONAL = 7,
OT_AUTOMATIC = 8,
OT_IMPLICIT = 8,
OT_END
};

@ -1580,7 +1580,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
return;
}
SetBit(v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
SetBit(v->gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
v->dest_tile = rfdd.tile;
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);

@ -2565,9 +2565,9 @@ bool AfterLoadGame()
if (!v->IsPrimaryVehicle()) continue;
/* Older versions are less strict with indices being in range and fix them on the fly */
if (v->cur_auto_order_index >= v->GetNumOrders()) v->cur_auto_order_index = 0;
if (v->cur_implicit_order_index >= v->GetNumOrders()) v->cur_implicit_order_index = 0;
v->cur_real_order_index = v->cur_auto_order_index;
v->cur_real_order_index = v->cur_implicit_order_index;
v->UpdateRealOrderIndex();
}
}

@ -1141,7 +1141,7 @@ static const OldChunks vehicle_chunk[] = {
OCL_VAR ( OC_UINT16, 1, &_old_order ),
OCL_NULL ( 1 ), ///< num_orders, now calculated
OCL_SVAR( OC_UINT8, Vehicle, cur_auto_order_index ),
OCL_SVAR( OC_UINT8, Vehicle, cur_implicit_order_index ),
OCL_SVAR( OC_TILE, Vehicle, dest_tile ),
OCL_SVAR( OC_UINT16, Vehicle, load_unload_ticks ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_U32, Vehicle, date_of_last_service ),

@ -504,7 +504,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_VAR(Vehicle, tick_counter, SLE_UINT8),
SLE_CONDVAR(Vehicle, running_ticks, SLE_UINT8, 88, SL_MAX_VERSION),
SLE_VAR(Vehicle, cur_auto_order_index, SLE_UINT8),
SLE_VAR(Vehicle, cur_implicit_order_index, SLE_UINT8),
SLE_CONDVAR(Vehicle, cur_real_order_index, SLE_UINT8, 158, SL_MAX_VERSION),
/* num_orders is now part of OrderList and is not saved but counted */
SLE_CONDNULL(1, 0, 104),

@ -77,7 +77,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u
VehicleOrderID order_number = GB(p1, 20, 8);
Order *order = v->GetOrder(order_number);
if (order == NULL || order->IsType(OT_AUTOMATIC)) return CMD_ERROR;
if (order == NULL || order->IsType(OT_IMPLICIT)) return CMD_ERROR;
bool is_journey = HasBit(p1, 28);
@ -241,10 +241,10 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
v->current_order_time = 0;
if (v->current_order.IsType(OT_AUTOMATIC)) return; // no timetabling of auto orders
if (v->current_order.IsType(OT_IMPLICIT)) return; // no timetabling of auto orders
VehicleOrderID first_manual_order = 0;
for (Order *o = v->GetFirstOrder(); o != NULL && o->IsType(OT_AUTOMATIC); o = o->next) {
for (Order *o = v->GetFirstOrder(); o != NULL && o->IsType(OT_IMPLICIT); o = o->next) {
++first_manual_order;
}

@ -90,7 +90,7 @@ static void SetArrivalDepartParams(int param1, int param2, Ticks ticks)
static bool CanDetermineTimeTaken(const Order *order, bool travelling)
{
/* Current order is conditional */
if (order->IsType(OT_CONDITIONAL) || order->IsType(OT_AUTOMATIC)) return false;
if (order->IsType(OT_CONDITIONAL) || order->IsType(OT_IMPLICIT)) return false;
/* No travel time and we have not already finished travelling */
if (travelling && order->travel_time == 0) return false;
/* No wait time but we are loading at this timetabled station */
@ -128,8 +128,8 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
do {
/* Automatic orders don't influence the overall timetable;
* they just add some untimetabled entries, but the time till
* the next non-automatic order can still be known. */
if (!order->IsType(OT_AUTOMATIC)) {
* the next non-implicit order can still be known. */
if (!order->IsType(OT_IMPLICIT)) {
if (travelling || i != start) {
if (!CanDetermineTimeTaken(order, true)) return;
sum += order->travel_time;
@ -330,7 +330,7 @@ struct TimetableWindow : Window {
if (selected != -1) {
const Order *order = v->GetOrder(((selected + 1) / 2) % v->GetNumOrders());
if (selected % 2 == 1) {
disable = order != NULL && (order->IsType(OT_CONDITIONAL) || order->IsType(OT_AUTOMATIC));
disable = order != NULL && (order->IsType(OT_CONDITIONAL) || order->IsType(OT_IMPLICIT));
} else {
disable = order == NULL || ((!order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) && !order->IsType(OT_CONDITIONAL));
}
@ -403,7 +403,7 @@ struct TimetableWindow : Window {
TextColour colour = (i == selected) ? TC_WHITE : TC_BLACK;
if (order->IsType(OT_CONDITIONAL)) {
string = STR_TIMETABLE_NO_TRAVEL;
} else if (order->IsType(OT_AUTOMATIC)) {
} else if (order->IsType(OT_IMPLICIT)) {
string = STR_TIMETABLE_NOT_TIMETABLEABLE;
colour = ((i == selected) ? TC_SILVER : TC_GREY) | TC_NO_SHADE;
} else if (order->travel_time == 0) {

@ -2292,7 +2292,7 @@ private:
TileIndex old_dest_tile;
StationID old_last_station_visited;
VehicleOrderID index;
bool suppress_automatic_orders;
bool suppress_implicit_orders;
public:
VehicleOrderSaver(Train *_v) :
@ -2301,7 +2301,7 @@ public:
old_dest_tile(_v->dest_tile),
old_last_station_visited(_v->last_station_visited),
index(_v->cur_real_order_index),
suppress_automatic_orders(HasBit(_v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS))
suppress_implicit_orders(HasBit(_v->gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS))
{
}
@ -2310,7 +2310,7 @@ public:
this->v->current_order = this->old_order;
this->v->dest_tile = this->old_dest_tile;
this->v->last_station_visited = this->old_last_station_visited;
SB(this->v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS, 1, suppress_automatic_orders ? 1: 0);
SB(this->v->gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS, 1, suppress_implicit_orders ? 1: 0);
}
/**
@ -3770,7 +3770,7 @@ static void CheckIfTrainNeedsService(Train *v)
return;
}
SetBit(v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
SetBit(v->gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
v->dest_tile = tfdd.tile;
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);

@ -1301,9 +1301,9 @@ void VehicleEnterDepot(Vehicle *v)
if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
/* Part of orders */
v->DeleteUnreachedAutoOrders();
v->DeleteUnreachedImplicitOrders();
UpdateVehicleTimetable(v, true);
v->IncrementAutoOrderIndex();
v->IncrementImplicitOrderIndex();
}
if (t.GetDepotActionType() & ODATFB_HALT) {
/* Vehicles are always stopped on entering depots. Do not restart this one. */
@ -1793,39 +1793,39 @@ uint GetVehicleCapacity(const Vehicle *v, uint16 *mail_capacity)
}
/**
* Delete all automatic orders which were not reached.
* Delete all implicit orders which were not reached.
*/
void Vehicle::DeleteUnreachedAutoOrders()
void Vehicle::DeleteUnreachedImplicitOrders()
{
if (this->IsGroundVehicle()) {
uint16 &gv_flags = this->GetGroundVehicleFlags();
if (HasBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS)) {
if (HasBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS)) {
/* Do not delete orders, only skip them */
ClrBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
this->cur_auto_order_index = this->cur_real_order_index;
ClrBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
this->cur_implicit_order_index = this->cur_real_order_index;
InvalidateVehicleOrder(this, 0);
return;
}
}
const Order *order = this->GetOrder(this->cur_auto_order_index);
const Order *order = this->GetOrder(this->cur_implicit_order_index);
while (order != NULL) {
if (this->cur_auto_order_index == this->cur_real_order_index) break;
if (this->cur_implicit_order_index == this->cur_real_order_index) break;
if (order->IsType(OT_AUTOMATIC)) {
if (order->IsType(OT_IMPLICIT)) {
/* Delete order effectively deletes order, so get the next before deleting it. */
order = order->next;
DeleteOrder(this, this->cur_auto_order_index);
DeleteOrder(this, this->cur_implicit_order_index);
} else {
/* Skip non-automatic orders, e.g. service-orders */
/* Skip non-implicit orders, e.g. service-orders */
order = order->next;
this->cur_auto_order_index++;
this->cur_implicit_order_index++;
}
/* Wrap around */
if (order == NULL) {
order = this->GetOrder(0);
this->cur_auto_order_index = 0;
this->cur_implicit_order_index = 0;
}
}
}
@ -1840,7 +1840,7 @@ void Vehicle::BeginLoading()
if (this->current_order.IsType(OT_GOTO_STATION) &&
this->current_order.GetDestination() == this->last_station_visited) {
this->DeleteUnreachedAutoOrders();
this->DeleteUnreachedImplicitOrders();
/* Now both order indices point to the destination station, and we can start loading */
this->current_order.MakeLoading(true);
@ -1855,74 +1855,74 @@ void Vehicle::BeginLoading()
} else {
assert(this->IsGroundVehicle());
bool suppress_automatic_orders = HasBit(this->GetGroundVehicleFlags(), GVF_SUPPRESS_AUTOMATIC_ORDERS);
bool suppress_implicit_orders = HasBit(this->GetGroundVehicleFlags(), GVF_SUPPRESS_IMPLICIT_ORDERS);
/* We weren't scheduled to stop here. Insert an automatic order
/* We weren't scheduled to stop here. Insert an implicit order
* to show that we are stopping here, but only do that if the order
* list isn't empty. */
Order *in_list = this->GetOrder(this->cur_auto_order_index);
Order *in_list = this->GetOrder(this->cur_implicit_order_index);
if (in_list != NULL &&
(!in_list->IsType(OT_AUTOMATIC) ||
(!in_list->IsType(OT_IMPLICIT) ||
in_list->GetDestination() != this->last_station_visited)) {
/* Do not create consecutive duplicates of automatic orders */
Order *prev_order = this->cur_auto_order_index > 0 ? this->GetOrder(this->cur_auto_order_index - 1) : NULL;
/* Do not create consecutive duplicates of implicit orders */
Order *prev_order = this->cur_implicit_order_index > 0 ? this->GetOrder(this->cur_implicit_order_index - 1) : NULL;
if (prev_order == NULL ||
(!prev_order->IsType(OT_AUTOMATIC) && !prev_order->IsType(OT_GOTO_STATION)) ||
(!prev_order->IsType(OT_IMPLICIT) && !prev_order->IsType(OT_GOTO_STATION)) ||
prev_order->GetDestination() != this->last_station_visited) {
/* Prefer deleting automatic orders instead of inserting new ones,
/* Prefer deleting implicit orders instead of inserting new ones,
* so test whether the right order follows later */
int target_index = this->cur_auto_order_index;
int target_index = this->cur_implicit_order_index;
bool found = false;
while (target_index != this->cur_real_order_index) {
const Order *order = this->GetOrder(target_index);
if (order->IsType(OT_AUTOMATIC) && order->GetDestination() == this->last_station_visited) {
if (order->IsType(OT_IMPLICIT) && order->GetDestination() == this->last_station_visited) {
found = true;
break;
}
target_index++;
if (target_index >= this->orders.list->GetNumOrders()) target_index = 0;
assert(target_index != this->cur_auto_order_index); // infinite loop?
assert(target_index != this->cur_implicit_order_index); // infinite loop?
}
if (found) {
if (suppress_automatic_orders) {
if (suppress_implicit_orders) {
/* Skip to the found order */
this->cur_auto_order_index = target_index;
this->cur_implicit_order_index = target_index;
InvalidateVehicleOrder(this, 0);
} else {
/* Delete all automatic orders up to the station we just reached */
const Order *order = this->GetOrder(this->cur_auto_order_index);
while (!order->IsType(OT_AUTOMATIC) || order->GetDestination() != this->last_station_visited) {
if (order->IsType(OT_AUTOMATIC)) {
/* Delete all implicit orders up to the station we just reached */
const Order *order = this->GetOrder(this->cur_implicit_order_index);
while (!order->IsType(OT_IMPLICIT) || order->GetDestination() != this->last_station_visited) {
if (order->IsType(OT_IMPLICIT)) {
/* Delete order effectively deletes order, so get the next before deleting it. */
order = order->next;
DeleteOrder(this, this->cur_auto_order_index);
DeleteOrder(this, this->cur_implicit_order_index);
} else {
/* Skip non-automatic orders, e.g. service-orders */
/* Skip non-implicit orders, e.g. service-orders */
order = order->next;
this->cur_auto_order_index++;
this->cur_implicit_order_index++;
}
/* Wrap around */
if (order == NULL) {
order = this->GetOrder(0);
this->cur_auto_order_index = 0;
this->cur_implicit_order_index = 0;
}
assert(order != NULL);
}
}
} else if (!suppress_automatic_orders && this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID && Order::CanAllocateItem()) {
/* Insert new automatic order */
Order *auto_order = new Order();
auto_order->MakeAutomatic(this->last_station_visited);
InsertOrder(this, auto_order, this->cur_auto_order_index);
if (this->cur_auto_order_index > 0) --this->cur_auto_order_index;
/* InsertOrder disabled creation of automatic orders for all vehicles with the same automatic order.
} else if (!suppress_implicit_orders && this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID && Order::CanAllocateItem()) {
/* Insert new implicit order */
Order *implicit_order = new Order();
implicit_order->MakeImplicit(this->last_station_visited);
InsertOrder(this, implicit_order, this->cur_implicit_order_index);
if (this->cur_implicit_order_index > 0) --this->cur_implicit_order_index;
/* InsertOrder disabled creation of implicit orders for all vehicles with the same implicit order.
* Reenable it for this vehicle */
uint16 &gv_flags = this->GetGroundVehicleFlags();
ClrBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
ClrBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
}
}
}
@ -1990,9 +1990,9 @@ void Vehicle::HandleLoading(bool mode)
this->LeaveStation();
/* Only advance to next order if we just loaded at the current one */
const Order *order = this->GetOrder(this->cur_auto_order_index);
const Order *order = this->GetOrder(this->cur_implicit_order_index);
if (order == NULL ||
(!order->IsType(OT_AUTOMATIC) && !order->IsType(OT_GOTO_STATION)) ||
(!order->IsType(OT_IMPLICIT) && !order->IsType(OT_GOTO_STATION)) ||
order->GetDestination() != this->last_station_visited) {
return;
}
@ -2004,7 +2004,7 @@ void Vehicle::HandleLoading(bool mode)
default: return;
}
this->IncrementAutoOrderIndex();
this->IncrementImplicitOrderIndex();
}
/**
@ -2043,7 +2043,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (this->IsGroundVehicle()) {
uint16 &gv_flags = this->GetGroundVehicleFlags();
SetBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
}
this->current_order.MakeDummy();
@ -2063,7 +2063,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (this->IsGroundVehicle()) {
uint16 &gv_flags = this->GetGroundVehicleFlags();
SetBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
}
this->dest_tile = location;

@ -220,8 +220,8 @@ public:
byte vehstatus; ///< Status
Order current_order; ///< The current order (+ status, like: loading)
VehicleOrderID cur_real_order_index;///< The index to the current real (non-automatic) order
VehicleOrderID cur_auto_order_index;///< The index to the current automatic order
VehicleOrderID cur_real_order_index;///< The index to the current real (non-implicit) order
VehicleOrderID cur_implicit_order_index;///< The index to the current implicit order
union {
OrderList *list; ///< Pointer to the order list for this vehicle
@ -252,7 +252,7 @@ public:
uint16 &GetGroundVehicleFlags();
const uint16 &GetGroundVehicleFlags() const;
void DeleteUnreachedAutoOrders();
void DeleteUnreachedImplicitOrders();
void HandleLoading(bool mode = false);
@ -552,7 +552,7 @@ public:
this->unitnumber = src->unitnumber;
this->cur_real_order_index = src->cur_real_order_index;
this->cur_auto_order_index = src->cur_auto_order_index;
this->cur_implicit_order_index = src->cur_implicit_order_index;
this->current_order = src->current_order;
this->dest_tile = src->dest_tile;
@ -605,7 +605,7 @@ public:
private:
/**
* Advance cur_real_order_index to the next real order.
* cur_auto_order_index is not touched.
* cur_implicit_order_index is not touched.
*/
void SkipToNextRealOrderIndex()
{
@ -614,7 +614,7 @@ private:
do {
this->cur_real_order_index++;
if (this->cur_real_order_index >= this->GetNumOrders()) this->cur_real_order_index = 0;
} while (this->GetOrder(this->cur_real_order_index)->IsType(OT_AUTOMATIC));
} while (this->GetOrder(this->cur_real_order_index)->IsType(OT_IMPLICIT));
} else {
this->cur_real_order_index = 0;
}
@ -622,39 +622,39 @@ private:
public:
/**
* Increments cur_auto_order_index, keeps care of the wrap-around and invalidates the GUI.
* Increments cur_implicit_order_index, keeps care of the wrap-around and invalidates the GUI.
* cur_real_order_index is incremented as well, if needed.
* Note: current_order is not invalidated.
*/
void IncrementAutoOrderIndex()
void IncrementImplicitOrderIndex()
{
if (this->cur_auto_order_index == this->cur_real_order_index) {
if (this->cur_implicit_order_index == this->cur_real_order_index) {
/* Increment real order index as well */
this->SkipToNextRealOrderIndex();
}
assert(this->cur_real_order_index == 0 || this->cur_real_order_index < this->GetNumOrders());
/* Advance to next automatic order */
/* Advance to next implicit order */
do {
this->cur_auto_order_index++;
if (this->cur_auto_order_index >= this->GetNumOrders()) this->cur_auto_order_index = 0;
} while (this->cur_auto_order_index != this->cur_real_order_index && !this->GetOrder(this->cur_auto_order_index)->IsType(OT_AUTOMATIC));
this->cur_implicit_order_index++;
if (this->cur_implicit_order_index >= this->GetNumOrders()) this->cur_implicit_order_index = 0;
} while (this->cur_implicit_order_index != this->cur_real_order_index && !this->GetOrder(this->cur_implicit_order_index)->IsType(OT_IMPLICIT));
InvalidateVehicleOrder(this, 0);
}
/**
* Advanced cur_real_order_index to the next real order, keeps care of the wrap-around and invalidates the GUI.
* cur_auto_order_index is incremented as well, if it was equal to cur_real_order_index, i.e. cur_real_order_index is skipped
* but not any automatic orders.
* cur_implicit_order_index is incremented as well, if it was equal to cur_real_order_index, i.e. cur_real_order_index is skipped
* but not any implicit orders.
* Note: current_order is not invalidated.
*/
void IncrementRealOrderIndex()
{
if (this->cur_auto_order_index == this->cur_real_order_index) {
/* Increment both real and auto order */
this->IncrementAutoOrderIndex();
if (this->cur_implicit_order_index == this->cur_real_order_index) {
/* Increment both real and implicit order */
this->IncrementImplicitOrderIndex();
} else {
/* Increment real order only */
this->SkipToNextRealOrderIndex();
@ -663,7 +663,7 @@ public:
}
/**
* Skip automatic orders until cur_real_order_index is a non-automatic order.
* Skip implicit orders until cur_real_order_index is a non-implicit order.
*/
void UpdateRealOrderIndex()
{
@ -672,7 +672,7 @@ public:
if (this->GetNumManualOrders() > 0) {
/* Advance to next real order */
while (this->GetOrder(this->cur_real_order_index)->IsType(OT_AUTOMATIC)) {
while (this->GetOrder(this->cur_real_order_index)->IsType(OT_IMPLICIT)) {
this->cur_real_order_index++;
if (this->cur_real_order_index >= this->GetNumOrders()) this->cur_real_order_index = 0;
}

@ -118,7 +118,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_AUTOMATIC))
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT))
&& order->GetDestination() == vli.index) {
*list->Append() = v;
break;

Loading…
Cancel
Save