To facilitate better build management, we should be able to link factories together and / or with armies.
UI: Simply select a factory and Shift + (Right?) Click another factory or army. Unlink by Shift + Control + (Right?) Click
Factories that are linked together (it can be more than two) share a common waypoint for their units. In addition, they share their build queue. That is, if any of the factories is selected, the build order will be added to a common queue, and each factory will start building the next unit in the queue when it finishes its current order. Repeats work the same way.
Example (3 linked factories):
1. Build order is Archer, Bruiser, Hermes, Medic.
2. Factory 1 will build an Archer, Factory 2 will build a Bruiser, Factory 3 will build a Hermes.
3. The first factory to finish will start on the Medic.
Example (3 linked factories):
1. Build order is Archer, Bruiser, Hermes, Medic, set to Repeat.
2. Factory 1 will build an Archer, Factory 2 will build a Bruiser, Factory 3 will build a Hermes.
3. The first factory to finish will start on the Medic.
4. The second factory to finish will start on the Archer.
5. ...
When an army has factories linked to it, ONLY those factories are considered when trying to issue build orders for its reinforcements.
Linking a factory to an army will assign priority (move to front of THIS FACTORY's queue) to units ordered as reinforcements from the army. Other factories linked to the same factory will NOT change.
Implementation suggestion:
1. Each factory is originally (and by default) part of a factory chain that contains only this factory.
2. Each army CAN have an (extra) factory chain associated with it or not.
3. Linking factories together joins their factory chains.
4. Linking factories to an army adds them to that army's chain. Thus factories can be part of one factory chain (with linked factories) and many army chains.
5. Each factory chain serves a single queue.
6. Each FACTORY will serve orders from an army's queue or (if it is not part of an army's factory chain or thoses queues are empty), from the queue for the associated factory chain.