New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #6574: Remove go to hangar orders when rebuilding airport #7100
Fix #6574: Remove go to hangar orders when rebuilding airport #7100
Conversation
When replacing an airport with another, cancel current orders of type 'go to depot' from aircraft still heading to it if the rebuilt airport doesn't have a hangar (helicopter vs heliport), or if the airplane can't land on the rebuilt airport (airplane vs helistation). Removes 'go to hangar' orders from all aircraft when replacing an airport with hangar with another without hangar (heliport).
You can perhaps remove the vehicle's current order, but orders defined in the order list should not be automatically removed. Maybe they can be marked as invalid like when a destination is removed. |
#7051 should solve this? |
{ | ||
OrderBackup *ob; | ||
FOR_ALL_ORDER_BACKUPS(ob) { | ||
for (Order *order = ob->orders; order != NULL; order = order->next) { | ||
OrderType ot = order->GetType(); | ||
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue; | ||
if (ot == OT_IMPLICIT || (IsHangarTile(ob->tile) && ot == OT_GOTO_DEPOT)) ot = OT_GOTO_STATION; | ||
if (ot == OT_IMPLICIT || (IsHangarTile(ob->tile) && ot == OT_GOTO_DEPOT && !hangar)) ot = OT_GOTO_STATION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the hangar argument needed? Isn't that already implied by ot == OT_GOTO_DEPOT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is to clear up (invalidate) the 'to go hangar' orders when replacing an airport with hangar with another without hangar, while still keeping the 'go to same airport' orders. Since I couldn't invalidate only the 'go to hangar' orders, I had to change this part of the code to let me keep the 'go to airport' orders. Otherwise, both 'go to hangar' and 'go to same airport' would be made invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hanger argument is in fact needed, if not present order backups with service/goto depot orders are not deleted. A newly built helicopter will then have orders referring to a non-existing hangar.
This pull request has been automatically marked as stale because it has not had any activity in the last month. |
When replacing an airport with another, cancel current orders of type 'go to depot' from aircraft still heading to it if the rebuilt airport doesn't have a hangar (helicopter vs heliport), or if the airplane can't land on the rebuilt airport (airplane vs helistation).
Invalidates 'go to hangar' orders from all aircraft when replacing an airport with hangar with another without hangar (heliport).