forked from mirror/OpenTTD
(svn r10992) -Fix [FS#1132]: huge amount of vehicles in the "ungrouped" group. Patch by frosch.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user