diff options
author | smatz <smatz@openttd.org> | 2008-02-03 12:41:06 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-02-03 12:41:06 +0000 |
commit | 70a6179b3b44d1a27d1b711a662a3c00e1440a39 (patch) | |
tree | dba6a1107955b02ecd4558b0639c2867964e1a01 /src | |
parent | 260b32e736c043521fae17780590a8b17f5359b4 (diff) | |
download | openttd-70a6179b3b44d1a27d1b711a662a3c00e1440a39.tar.xz |
(svn r12049) -Fix (r10496)(r10619): memset on multibyte array with wrong byte count
Diffstat (limited to 'src')
-rw-r--r-- | src/industry_gui.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 23cef6229..48efeba3a 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -57,6 +57,9 @@ static struct IndustryData { bool enabled[NUM_INDUSTRYTYPES + 1]; ///< availability state, coming from CBID_INDUSTRY_AVAILABLE (if ever) } _fund_gui; +assert_compile(lengthof(_fund_gui.index) == lengthof(_fund_gui.text)); +assert_compile(lengthof(_fund_gui.index) == lengthof(_fund_gui.enabled)); + static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) { switch (e->event) { @@ -79,11 +82,14 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) WP(w, fnd_d).timer_enabled = _loaded_newgrf_features.has_newindustries; /* Initilialize structures */ - memset(&_fund_gui.index, 0xFF, NUM_INDUSTRYTYPES); - memset(&_fund_gui.text, STR_NULL, NUM_INDUSTRYTYPES); - memset(&_fund_gui.enabled, false, NUM_INDUSTRYTYPES); _fund_gui.count = 0; + for (uint i = 0; i < lengthof(_fund_gui.index); i++) { + _fund_gui.index[i] = 0xFF; + _fund_gui.text[i] = STR_NULL; + _fund_gui.enabled[i] = false; + } + w->vscroll.cap = 8; // rows in grid, same in scroller w->resize.step_height = 13; |