changeset 19321:ae0a3cee1c61 draft

(svn r24210) -Feature: Split the renew-months setting text in two string values (one before life time and one after).
author alberth <alberth@openttd.org>
date Sun, 06 May 2012 15:03:45 +0000
parents 2c8b1243bbba
children 0b7a41105439
files src/lang/english.txt src/settings_gui.cpp src/settings_internal.h src/table/company_settings.ini
diffstat 4 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1185,7 +1185,9 @@
 STR_CONFIG_SETTING_WARN_INCOME_LESS                             :Warn if a vehicle's income is negative: {STRING2}
 STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES                        :Vehicles never expire: {STRING2}
 STR_CONFIG_SETTING_AUTORENEW_VEHICLE                            :Autorenew vehicle when it gets old: {STRING2}
-STR_CONFIG_SETTING_AUTORENEW_MONTHS                             :Autorenew when vehicle is {STRING2} month{P 0:2 "" s} before/after max age
+STR_CONFIG_SETTING_AUTORENEW_MONTHS                             :Autorenew when vehicle is {STRING2} max age
+STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE                :{COMMA} month{P 0 "" s} before
+STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_AFTER                 :{COMMA} month{P 0 "" s} after
 STR_CONFIG_SETTING_AUTORENEW_MONEY                              :Autorenew minimum needed money for renew: {STRING2}
 STR_CONFIG_SETTING_ERRMSG_DURATION                              :Duration of error message: {STRING2}
 STR_CONFIG_SETTING_ERRMSG_DURATION_VALUE                        :{COMMA} second{P 0 "" s}
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1289,6 +1289,9 @@
 
 		if ((sdb->flags & SGF_MULTISTRING) != 0) {
 			SetDParam(1, sdb->val_str - sdb->min + value);
+		} else if ((sdb->flags & SGF_DISPLAY_ABS) != 0) {
+			SetDParam(1, sdb->val_str + ((value >= 0) ? 1 : 0));
+			value = abs(value);
 		} else {
 			SetDParam(1, sdb->val_str + ((value == 0 && (sdb->flags & SGF_0ISDISABLED) != 0) ? 1 : 0));
 		}
--- a/src/settings_internal.h
+++ b/src/settings_internal.h
@@ -40,6 +40,7 @@
 	 * Flags directing saving/loading of a variable */
 	SGF_NONE = 0,
 	SGF_0ISDISABLED  = 1 << 0, ///< a value of zero means the feature is disabled
+	SGF_DISPLAY_ABS  = 1 << 1, ///< display absolute value of the setting
 	SGF_MULTISTRING  = 1 << 2, ///< the value represents a limited number of string-options (internally integer)
 	SGF_NETWORK_ONLY = 1 << 3, ///< this setting only applies to network games
 	SGF_CURRENCY     = 1 << 4, ///< the number represents money, so when reading value multiply by exchange rate
--- a/src/table/company_settings.ini
+++ b/src/table/company_settings.ini
@@ -41,11 +41,12 @@
 base     = CompanySettings
 var      = engine_renew_months
 type     = SLE_INT16
+guiflags = SGF_PER_COMPANY | SGF_DISPLAY_ABS
 def      = 6
 min      = -12
 max      = 12
 str      = STR_CONFIG_SETTING_AUTORENEW_MONTHS
-strval   = STR_JUST_COMMA
+strval   = STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE
 
 [SDT_VAR]
 base     = CompanySettings