BP2022-AP1 / bp2022-ap1

https://bp2022-ap1.github.io/bp2022-ap1/
5 stars 1 forks source link

redundant queues #567

Closed Lietze closed 1 year ago

Lietze commented 1 year ago

Fixes #563

Description (what might a PO or reviewer want to know?)

PR checklist

Lietze commented 1 year ago

Why don't you need this queue anymore? 😇 Does the logic never apply, or does another list the same job?

There are two reasons a queue like that could be needed for reservations. The first is whether the reservation itself is possible. If not, next tick that needs to be tried again. The other is if the SUMO-Route, the train will drive on is reserved in first position for the train. If that is not the case yet, it needs to wait. By moving the reserving of the route right in front of the check if it is reserved as first, both of those cases can now be handled by the same queue. This has the downside, that if a train is waiting for it's reservation to be first on the route, each tick it will be checked, if the route is reserved at all. Two seperate queues prevented that. however I don't think the impact on performance is noticable and I want the code to look better.