diff options
Diffstat (limited to 'src/group.h')
-rw-r--r-- | src/group.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/group.h b/src/group.h index e5c10a59f..7c0e1c9ac 100644 --- a/src/group.h +++ b/src/group.h @@ -76,15 +76,17 @@ static inline uint GetGroupArraySize(void) * @param id_e The EngineID of the engine to count * @return The number of engines with EngineID id_e in the group */ -static inline uint GetGroupNumEngines(GroupID id_g, EngineID id_e) +static inline uint GetGroupNumEngines(PlayerID p, GroupID id_g, EngineID id_e) { if (IsValidGroupID(id_g)) return GetGroup(id_g)->num_engines[id_e]; - uint num = GetPlayer(_local_player)->num_engines[id_e]; + uint num = GetPlayer(p)->num_engines[id_e]; if (!IsDefaultGroupID(id_g)) return num; const Group *g; - FOR_ALL_GROUPS(g) num -= g->num_engines[id_e]; + FOR_ALL_GROUPS(g) { + if (g->owner == p) num -= g->num_engines[id_e]; + } return num; } |