diff options
author | ludde <ludde@openttd.org> | 2005-07-15 14:53:44 +0000 |
---|---|---|
committer | ludde <ludde@openttd.org> | 2005-07-15 14:53:44 +0000 |
commit | 275e2f477a2b1b7fca2b52722ce042aec01c1866 (patch) | |
tree | ae57d82a4f417509705d577ea29c99c80b9e579b /misc_gui.c | |
parent | 462b0d6686df8b34b535144e06bcbe52a9b8fb8e (diff) | |
download | openttd-275e2f477a2b1b7fca2b52722ce042aec01c1866.tar.xz |
(svn r2572) - Codechange: [string] Changed string system so it's not as dependent on decode_parameters
- Feature: [strgen] Allow changing the order of parameters in translated strings.
- Use {1:TOWN} syntax to set the order.
- Codechange: [strgen] Rewrote lots of strgen internals.
Diffstat (limited to 'misc_gui.c')
-rw-r--r-- | misc_gui.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/misc_gui.c b/misc_gui.c index c6606fad7..e6ef308c3 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -75,23 +75,33 @@ static void LandInfoWndProc(Window *w, WindowEvent *e) } DrawStringCentered(140,60, STR_01A8_LOCAL_AUTHORITY, 0); - str = STR_01CE_CARGO_ACCEPTED - 1; - - /* XXX if a tile accepts more cargo types than there are template strings - * this breaks */ - for (i = 0; i < NUM_CARGO; ++i) { - if (lid->ac[i] > 0) { - if (lid->ac[i] < 8) { - SetDParam(idx++, STR_01D1_8); - SetDParam(idx++, lid->ac[i]); + { + char buf[512]; + char *p = GetString(buf, STR_01CE_CARGO_ACCEPTED); + bool found = false; + + for (i = 0; i < NUM_CARGO; ++i) { + if (lid->ac[i] > 0) { + // Add a comma between each item. + if (found) { *p++ = ','; *p++ = ' '; } + found = true; + + // If the accepted value is less than 8, show it in 1/8:ths + if (lid->ac[i] < 8) { + int32 argv[2] = { + lid->ac[i], + _cargoc.names_s[i] + }; + p = GetStringWithArgs(p, STR_01D1_8, argv); + } else { + p = GetString(p, _cargoc.names_s[i]); + } } - SetDParam(idx++, _cargoc.names_s[i]); - str++; } - } - if (str != (STR_01CE_CARGO_ACCEPTED - 1)) - DrawStringMultiCenter(140, 76, str, 276); + if (found) + DrawStringMultiCenter(140, 76, BindCString(buf), 276); + } if (lid->td.build_date != 0) { SetDParam(0,lid->td.build_date); |