Currently, when one wants to send a message to several entities (both from JS and C++) one iterates over the entities and sends all the message.
From JS, this means useless work is done by converting the message often.
This patch aims at introducing a function that would allow to distribute a message to several entities at once, thus reducing the amount of conversions that ought to be done.
Then, after sending all those messages to the specific entities, one global message is sent, instead of a global message for all PostMessages.
This can be used for cmpGuard (GuardAttacked) and cmpFoundation (ConstructionFinished), but perhaps more kandidates can be found.