summaryrefslogtreecommitdiff
path: root/src/cheat_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-12-04 21:36:36 +0000
committeralberth <alberth@openttd.org>2010-12-04 21:36:36 +0000
commit2baa9f2c5d2188ab75fc0f767dc7357b25fb2d91 (patch)
tree4b1824bc920876c31540e15bb53fd6471207e10c /src/cheat_gui.cpp
parentfd1c95342eaf7316f4f67321f2bb726e7a05ade0 (diff)
downloadopenttd-2baa9f2c5d2188ab75fc0f767dc7357b25fb2d91.tar.xz
(svn r21386) -Codechange: Use updated value to decide year to cheat to, instead of increment/decrement.
Diffstat (limited to 'src/cheat_gui.cpp')
-rw-r--r--src/cheat_gui.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index f44c9d453..97da1b668 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -117,9 +117,10 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
YearMonthDay ymd;
ConvertDateToYMD(_date, &ymd);
- if ((ymd.year == MIN_YEAR && p2 == -1) || (ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
+ p1 = Clamp(p1, MIN_YEAR, MAX_YEAR);
+ if (p1 == _cur_year) return _cur_year;
- SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day), _date_fract);
+ SetDate(ConvertYMDToDate(p1, ymd.month, ymd.day), _date_fract);
EnginesMonthlyLoop();
SetWindowDirty(WC_STATUS_BAR, 0);
InvalidateWindowClassesData(WC_BUILD_STATION, 0);