summaryrefslogtreecommitdiff
path: root/src/group.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-27 21:33:26 +0000
committerrubidium <rubidium@openttd.org>2007-08-27 21:33:26 +0000
commit45900925c3036882ec6eb9b993b2271844b27ca6 (patch)
tree547b6661ba325dd3a5f5a287a7202ee034590910 /src/group.h
parent759255df1227f8b1e74c82ae40d2ddc3b1496335 (diff)
downloadopenttd-45900925c3036882ec6eb9b993b2271844b27ca6.tar.xz
(svn r10992) -Fix [FS#1132]: huge amount of vehicles in the "ungrouped" group. Patch by frosch.
Diffstat (limited to 'src/group.h')
-rw-r--r--src/group.h8
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;
}