With one or more production buildings selected, right-clicking on the map should set the gather point for the selected buildings.
The gather point should be stored in the ClientBuilding and should be displayed graphically with a flag sprite when this building is selected. Notice that gather points could be set to a map coordinate, but can in some cases (for town centers) also be set on a resource, for example.
The gather point should be sent to the server with a new message type.
The server checks the validity of the message and stores the gather point in the corresponding ServerBuilding(s) if valid.
If a building that has a gather point set produces a new unit, its target should be automatically set to the gather point (ServerUnit::SetTarget()) or it should attempt to move there in case it is a map coordinate.
The building should also attempt to spawn the unit at the point where it is closest to the gather point. This could be done somewhat intelligently; for example, it is possible that a building is built next to a forest, and there is a single free tile between the building and the forest. Spawning a unit on this tile would trap it, which may cause frustration for the player. To prevent this, pathfinding could be used to figure out whether there is a valid path between the gather point and the spawn location. However, care should be taken not to cause too many pathfinding requests in order not to slow the server down too much.
With one or more production buildings selected, right-clicking on the map should set the gather point for the selected buildings.
ClientBuilding
and should be displayed graphically with a flag sprite when this building is selected. Notice that gather points could be set to a map coordinate, but can in some cases (for town centers) also be set on a resource, for example.ServerBuilding
(s) if valid.ServerUnit::SetTarget()
) or it should attempt to move there in case it is a map coordinate.