We can now switch between companies to get a view of what they are doing.
Here you see we can switch over to the CPU player and see what airports they have.
The airport details window auto updates to show the info for the current company, and also buttons will disable to stop people breaking things by giving orders for other companies. (TODO: Make sure we have a test to confirm the server will also disallow that!)
If the player already has a window up that could make an action, like create route, that will close automatically if they switch to a company they don't have control over.
Previously each screen was either updating every label on every render (wasteful) or having a partial check to see if something had changed before refreshing. This broke pretty quickly with company switching so I've setup a more centralized system.
There's a single "dirty index" that will increment whenever anything notable changes, such as player taking an action or switching current company. Then individual screens can just watch that single value to see if they are out of date. Rather than tracking a more narrow set of things that specifically affect them.
It will lead to more updates than a very specific system, but it is much simpler and less likely to have stale screens. And it will still be hundreds of times of times better than updating every frame.
Previous: Slot bidding