summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-08-22 15:25:36 +0000
committerdominik <dominik@openttd.org>2004-08-22 15:25:36 +0000
commitf4c026d8d11768be1af99cd0323a595ff5087c7b (patch)
treeb0f7d8d6addfe4b92292303cda6a75e8c4442193
parent99253905bb147f19142ab61172b22962f41c48bc (diff)
downloadopenttd-f4c026d8d11768be1af99cd0323a595ff5087c7b.tar.xz
(svn r109) added/heavily modified patch by truesatan: cheat change date
-rw-r--r--lang/english.txt1
-rw-r--r--misc_gui.c23
-rw-r--r--variables.h1
3 files changed, 24 insertions, 1 deletions
diff --git a/lang/english.txt b/lang/english.txt
index bd3c5c018..d999370a8 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -1040,6 +1040,7 @@ STR_CHEAT_CROSSINGTUNNELS :{LTBLUE}Tunnels may cross each other: {ORANGE}{STRI
STR_CHEAT_BUILD_IN_PAUSE :{LTBLUE}Build while in pause mode: {ORANGE}{STRING}
STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetplanes will not crash (frequently) on small airports: {ORANGE} {STRING}
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Switch climate: {ORANGE} {STRING}
+STR_CHEAT_CHANGE_DATE :{LTBLUE}Change date: {ORANGE} {DATE_SHORT}
STR_SORT_BY_POPULATION :{BLACK}Population
diff --git a/misc_gui.c b/misc_gui.c
index 7017d2dd6..8180f1998 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -1356,11 +1356,27 @@ int32 ClickChangeClimateCheat(int32 p1, int32 p2)
return _opt.landscape;
}
+extern void EnginesMonthlyLoop();
+
+// p2 1 (increase) or -1 (decrease)
+int32 ClickChangeDateCheat(int32 p1, int32 p2)
+{
+ YearMonthDay ymd;
+ ConvertDayToYMD(&ymd, _date);
+
+ if((ymd.year==0 && p2==-1) || (ymd.year==170 && p2==1)) return _cur_year;
+
+ SetDate(ConvertYMDToDay(_cur_year + p2, ymd.month, ymd.day));
+ EnginesMonthlyLoop();
+ SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0));
+ return _cur_year;
+}
typedef int32 CheckButtonClick(int32, int32);
static CheckButtonClick * const _cheat_button_proc[] = {
ClickMoneyCheat,
ClickChangePlayerCheat,
+ ClickChangeDateCheat,
};
@@ -1429,7 +1445,8 @@ static const CheatEntry _cheats_ui[] = {
{CE_BOOL, 0, STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value,&_cheats.crossing_tunnels.been_used},
{CE_BOOL, 0, STR_CHEAT_BUILD_IN_PAUSE, &_cheats.build_in_pause.value, &_cheats.build_in_pause.been_used},
{CE_BOOL, 0, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used},
- {CE_UINT8, 0, STR_CHEAT_SWITCH_CLIMATE, &_opt.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat, -1, 4, 1},
+ {CE_UINT8, 0, STR_CHEAT_SWITCH_CLIMATE, &_opt.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat, -1, 4, 1},
+ {CE_UINT8, 0, STR_CHEAT_CHANGE_DATE, &_cur_year, &_cheats.change_date.been_used, &ClickChangeDateCheat, -1,1,1},
};
@@ -1489,6 +1506,10 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
val += STR_TEMPERATE_LANDSCAPE;
SET_DPARAM16(0, val);
+
+ // display date for change date cheat
+ if(ce->str==STR_CHEAT_CHANGE_DATE)
+ SET_DPARAM16(0, _date);
// draw colored flag for change player cheat
if(ce->str==STR_CHEAT_CHANGE_PLAYER)
diff --git a/variables.h b/variables.h
index 21e60e71d..f26255263 100644
--- a/variables.h
+++ b/variables.h
@@ -180,6 +180,7 @@ typedef struct Cheats {
Cheat build_in_pause; // build while in pause mode
Cheat no_jetcrash; // no jet will crash on small airports anymore
Cheat switch_climate;
+ Cheat change_date; //changes date ingame
} Cheats;
VARDEF Cheats _cheats;