src/industry_gui.cpp
changeset 8972 420a826a4f88
parent 8932 989fe2280933
child 9255 22da20a012ba
child 10657 fedc1923d40e
--- a/src/industry_gui.cpp	Sun Feb 03 03:37:33 2008 +0000
+++ b/src/industry_gui.cpp	Sun Feb 03 12:41:06 2008 +0000
@@ -57,6 +57,9 @@
 	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 @@
 			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;