summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2012-05-06 15:03:45 +0000
committeralberth <alberth@openttd.org>2012-05-06 15:03:45 +0000
commit88224d001d640eb6bf3f4a0215a63b44dbe34cb9 (patch)
tree028e041d1c21c3271c45fc37e90eeb70b949d841
parent8c585e5ad6d0d115c48fbc4f11a5a70f9f997f24 (diff)
downloadopenttd-88224d001d640eb6bf3f4a0215a63b44dbe34cb9.tar.xz
(svn r24210) -Feature: Split the renew-months setting text in two string values (one before life time and one after).
-rw-r--r--src/lang/english.txt4
-rw-r--r--src/settings_gui.cpp3
-rw-r--r--src/settings_internal.h1
-rw-r--r--src/table/company_settings.ini3
4 files changed, 9 insertions, 2 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 2986e6f56..53904e266 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1185,7 +1185,9 @@ STR_CONFIG_SETTING_ORDER_REVIEW_ON :of all vehicles
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}
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index a0529b05d..dbf80d7a7 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1289,6 +1289,9 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
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));
}
diff --git a/src/settings_internal.h b/src/settings_internal.h
index 587366f3d..b4f87f819 100644
--- a/src/settings_internal.h
+++ b/src/settings_internal.h
@@ -40,6 +40,7 @@ enum SettingGuiFlagLong {
* 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
diff --git a/src/table/company_settings.ini b/src/table/company_settings.ini
index e19004dd4..78d7579e5 100644
--- a/src/table/company_settings.ini
+++ b/src/table/company_settings.ini
@@ -41,11 +41,12 @@ str = STR_CONFIG_SETTING_AUTORENEW_VEHICLE
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