summaryrefslogtreecommitdiff
path: root/settings_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-12-18 08:01:05 +0000
committertron <tron@openttd.org>2005-12-18 08:01:05 +0000
commit7dc1e23845528e538091de34db539a0b7e480da6 (patch)
tree12fb065c62ef1ffc637991f8ffdc249585d78330 /settings_gui.c
parent8e43cdd0c0effe9a3de90a3cdf3a2517d34af602 (diff)
downloadopenttd-7dc1e23845528e538091de34db539a0b7e480da6.tar.xz
(svn r3311) Remove the unnecessary global variable _grffile_count: It's just the scroll count of a list and furthermore only used in one file
Diffstat (limited to 'settings_gui.c')
-rw-r--r--settings_gui.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/settings_gui.c b/settings_gui.c
index 319d1a5c8..6f4430f39 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -1221,7 +1221,7 @@ static void NewgrfWndProc(Window *w, WindowEvent *e)
y += w->vscroll.pos;
- if (y >= _grffile_count) return;
+ if (y >= w->vscroll.count) return;
_sel_grffile = _first_grffile;
// get selected grf-file
@@ -1281,20 +1281,18 @@ static const WindowDesc _newgrf_desc = {
void ShowNewgrf(void)
{
+ const GRFFile* c;
Window *w;
+ uint count;
+
DeleteWindowById(WC_GAME_OPTIONS, 0);
w = AllocateWindowDesc(&_newgrf_desc);
- { // little helper function to calculate _grffile_count
- // should be REMOVED once _grffile_count is calculated at loading
- const GRFFile* c;
-
- _grffile_count = 0;
- for (c = _first_grffile; c != NULL; c = c->next) _grffile_count++;
- }
+ count = 0;
+ for (c = _first_grffile; c != NULL; c = c->next) count++;
w->vscroll.cap = 12;
- w->vscroll.count = _grffile_count;
+ w->vscroll.count = count;
w->vscroll.pos = 0;
w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7);
}