mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r12049) -Fix (r10496)(r10619): memset on multibyte array with wrong byte count
This commit is contained in:
parent
1e51090e74
commit
0ca3977af8
|
@ -57,6 +57,9 @@ static struct IndustryData {
|
||||||
bool enabled[NUM_INDUSTRYTYPES + 1]; ///< availability state, coming from CBID_INDUSTRY_AVAILABLE (if ever)
|
bool enabled[NUM_INDUSTRYTYPES + 1]; ///< availability state, coming from CBID_INDUSTRY_AVAILABLE (if ever)
|
||||||
} _fund_gui;
|
} _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)
|
static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
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;
|
WP(w, fnd_d).timer_enabled = _loaded_newgrf_features.has_newindustries;
|
||||||
|
|
||||||
/* Initilialize structures */
|
/* 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;
|
_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->vscroll.cap = 8; // rows in grid, same in scroller
|
||||||
w->resize.step_height = 13;
|
w->resize.step_height = 13;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue