summaryrefslogtreecommitdiff
path: root/src/autoreplace_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-14 23:10:27 +0000
committerrubidium <rubidium@openttd.org>2007-07-14 23:10:27 +0000
commit7aec26887cfc0f40c54a147d566b737cdbbf9451 (patch)
tree8e0bc57b2b06b68cd87f0cd9d2168ec3eb7ed227 /src/autoreplace_gui.cpp
parent197245eefe096da8008ce8d4772ab51fd2fb5cf4 (diff)
downloadopenttd-7aec26887cfc0f40c54a147d566b737cdbbf9451.tar.xz
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
Diffstat (limited to 'src/autoreplace_gui.cpp')
-rw-r--r--src/autoreplace_gui.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 159c21824..d8bfd11cf 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -48,7 +48,7 @@ void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
{
Player *p = GetPlayer(_local_player);
byte type = GetEngine(e)->type;
- uint num_engines = IsDefaultGroupID(id_g) ? p->num_engines[e] : GetGroup(id_g)->num_engines[e];
+ uint num_engines = GetGroupNumEngines(id_g, e);
if (num_engines == 0 || p->num_engines[e] == 0) {
/* We don't have any of this engine type.
@@ -140,7 +140,6 @@ static bool EnginesGotCargoInCommon(EngineID engine_a, EngineID engine_b)
*/
static void GenerateReplaceVehList(Window *w, bool draw_left)
{
- Player *p = GetPlayer(_local_player);
EngineID e;
EngineID selected_engine = INVALID_ENGINE;
byte type = w->window_number;
@@ -154,7 +153,7 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
if (draw_left) {
const GroupID selected_group = WP(w, replaceveh_d).sel_group;
- const uint num_engines = IsDefaultGroupID(selected_group) ? p->num_engines[e] : GetGroup(selected_group)->num_engines[e];
+ const uint num_engines = GetGroupNumEngines(selected_group, e);
/* Skip drawing the engines we don't have any of and haven't set for replacement */
if (num_engines == 0 && EngineReplacementForPlayer(GetPlayer(_local_player), e, selected_group) == INVALID_ENGINE) continue;