While testing multiple AIs on a 4096x4096 map, some kind of limit has been reached. I was seeing vehicles with no orders and AIs struggling to insert orders to their vehicles. ShipAI hinted me with the error message ERR_ORDER_TOO_MANY
I decided to play and right on my first bus service, I could only insert the first order. When attempting to insert the 2nd order it failed with this:
Steps to reproduce:
(An autoclicker is helpful for this)
Start new game
Give yourself a few million so you can then...
buy a road vehicle.
Put down a bus station ("A").
Give your road vehicle 254 of the same order to go to station A. If you see "Too many orders", this step is done.
Clone your road vehicle 251 more times. 250 of those times it will work, but the 251th time the vehicle will copy, but the orders won't.
On the road vehicle with no orders, give it 246 of the same order to go to station A. If you see "No more space for orders", this step is done.
To calculate the max number of orders, punch in the equation [your road vehicles - 1] * [254 orders per vehicle] + [# of orders on last vehicle]. I got  *  +  = 64,000 orders total across all my road vehicles.
If you attempt to insert more orders on any of your vehicles, you will see the message "No more space for orders" or ERR_ORDER_TOO_MANY.
Result: The limit for how many orders you can have across all vehicles of all companies is 64,000 orders total.
That indeed is a hardcoded limit in the game code itself.
src/order_base.h:typedef Pool<Order, OrderID, 256, 64000> OrderPool;
src/order_base.h:typedef Pool<OrderList, OrderListID, 128, 64000> OrderListPool;
My testing with 14 AIs started in 1935 and I've spotted the first vehicles with no orders in 1952. It could have been earlier. Still, it only took 17 years to reach the limit. Could the order limit be increased? Is it feasible?
At 64,000 orders max and a full game of 15 companies, that gives 4266 order entries to each company. The hard limit is 5000 vehicles of each type, so less than a quarter order per vehicle. However, sensible players use order sharing, and usually don't use all types of transport, so in practice you're probably up to 2-3 orders per vehicle, more if you only use trains or only road vehicles. That's reasonable, especially when playing on sensible map sizes and not 4096 sized maps.