diff options
author | tron <tron@openttd.org> | 2006-02-13 21:15:00 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-02-13 21:15:00 +0000 |
commit | ea73b466844a048f9f55b933f243ec19bdaaa18c (patch) | |
tree | 19340b96ef341c9784a27b719a1a90c2c691ca56 /industry_gui.c | |
parent | 235e72829e55cbb1e7632fe1b2d1429f6f3be054 (diff) | |
download | openttd-ea73b466844a048f9f55b933f243ec19bdaaa18c.tar.xz |
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
Diffstat (limited to 'industry_gui.c')
-rw-r--r-- | industry_gui.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/industry_gui.c b/industry_gui.c index 6449aa880..08c743f29 100644 --- a/industry_gui.c +++ b/industry_gui.c @@ -392,19 +392,11 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) break; case WE_ON_EDIT_TEXT: - if (*e->edittext.str) { - Industry *i; - int val; - int line; + if (e->edittext.str[0] != '\0') { + Industry* i = GetIndustry(w->window_number); + int line = WP(w,vp2_d).data_1; - i = GetIndustry(w->window_number); - line = WP(w,vp2_d).data_1; - val = atoi(e->edittext.str); - if (!IS_INT_INSIDE(val, 32, 2040)) { - if (val < 32) val = 32; - else val = 2040; - } - i->production_rate[line] = (byte)(val / 8); + i->production_rate[line] = clamp(atoi(e->edittext.str), 32, 2040) / 8; UpdateIndustryProduction(i); SetWindowDirty(w); } |