# HG changeset patch # User tron # Date 1099952474 0 # Node ID 518d84a8372327108a96ab5a7bfe0fef22f6c85a # Parent 3345a78d37e4a5c2447e6a5709c5f73872b478df (svn r532) Disable date change buttons in scenario editor if date limit is reached. Note: It's a /bit/ ugly, need to find a cleaner way While I'm here enlarge the start date window to 1920-2000 (was 1950-1975). diff -r 3345a78d37e4 -r 518d84a83723 main_gui.c --- a/main_gui.c Mon Nov 08 21:24:48 2004 +0000 +++ b/main_gui.c Mon Nov 08 22:21:14 2004 +0000 @@ -16,6 +16,10 @@ #include "table/animcursors.h" +/* Min/Max date for scenario editor */ +static const uint MinDate = 0; // 1920-01-01 +static const uint MaxDate = 29220; // 2000-01-01 + extern void DoTestSave(); extern void DoTestLoad(); @@ -859,9 +863,8 @@ HandleButtonClick(w, 6); InvalidateWidget(w, 5); - if (_date > 0x2ACE) { + if (_date > MinDate) SetDate(ConvertYMDToDay(_cur_year - 1, 0, 1)); - } } _left_button_clicked = false; } @@ -873,9 +876,8 @@ HandleButtonClick(w, 7); InvalidateWidget(w, 5); - if (_date < 0x4E79) { + if (_date < MaxDate) SetDate(ConvertYMDToDay(_cur_year + 1, 0, 1)); - } } _left_button_clicked = false; } @@ -1864,6 +1866,16 @@ { switch(e->event) { case WE_PAINT: + /* XXX look for better place for these */ + if (_date <= MinDate) + SETBIT(w->disabled_state, 6); + else + CLRBIT(w->disabled_state, 6); + if (_date >= MaxDate) + SETBIT(w->disabled_state, 7); + else + CLRBIT(w->disabled_state, 7); + // Draw brown-red toolbar bg. GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); GfxFillRect(0, 0, w->width-1, w->height-1, 0x80B4);