From 61e7a86bf1dad5f041802e539950185eb921bd68 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 7 Jan 2006 04:07:19 +0100 Subject: [PATCH] rnd-20060107-2-src * uploaded fixed pre-release version 3.2.0-6 binary and source code --- ChangeLog | 5 +++++ src/conftime.h | 2 +- src/editor.c | 9 ++++++--- src/game.c | 4 ++-- src/libgame/gadgets.c | 16 +++++++++++++--- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1ac350b..921fa6ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ +2006-01-07 + * uploaded fixed pre-release version 3.2.0-6 binary and source code + 2006-01-07 * fixed bug when using "CE can leave behind " * added new change condition "(after/when) creation of " * added new change condition "(after/when) digging " + * fixed bug accessing invalid gadget that caused crashes under Windows + * deactivated new possibility for multiple CE changes per frame 2006-01-04 * uploaded pre-release (test) version 3.2.0-6 binary and source code diff --git a/src/conftime.h b/src/conftime.h index aa297a36..96bddd7f 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-01-07 01:18]" +#define COMPILE_DATE_STRING "[2006-01-07 03:59]" diff --git a/src/editor.c b/src/editor.c index fe1c0301..1f75066a 100644 --- a/src/editor.c +++ b/src/editor.c @@ -4603,9 +4603,8 @@ static void ReinitializeElementList() } } - /* this function is also called before editor gadgets are initialized */ - if (level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL] != NULL) - AdjustElementListScrollbar(); + /* (this function is also called before editor gadgets are initialized!) */ + AdjustElementListScrollbar(); } void PrintEditorElementList() @@ -5754,7 +5753,11 @@ void FreeLevelEditorGadgets() int i; for (i = 0; i < NUM_EDITOR_GADGETS; i++) + { FreeGadget(level_editor_gadget[i]); + + level_editor_gadget[i] = NULL; + } } static void MapCounterButtons(int id) diff --git a/src/game.c b/src/game.c index 40e92ffe..1f4d8a01 100644 --- a/src/game.c +++ b/src/game.c @@ -607,10 +607,10 @@ static int playfield_scan_delta_x = 1; static int playfield_scan_delta_y = 1; #define SCAN_PLAYFIELD(x, y) for ((y) = playfield_scan_start_y; \ - (y) >= 0 && (y) <= lev_fieldy; \ + (y) >= 0 && (y) <= lev_fieldy - 1; \ (y) += playfield_scan_delta_y) \ for ((x) = playfield_scan_start_x; \ - (x) >= 0 && (x) <= lev_fieldx; \ + (x) >= 0 && (x) <= lev_fieldx - 1; \ (x) += playfield_scan_delta_x) \ static void InitPlayfieldScanModeVars() diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 2f980f3c..1b368c56 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -163,12 +163,16 @@ static void default_callback_action(void *ptr) static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) { + struct GadgetDesign *gd; int state = (pressed ? GD_BUTTON_PRESSED : GD_BUTTON_UNPRESSED); - struct GadgetDesign *gd = (!gi->active ? &gi->alt_design[state] : - gi->checked ? &gi->alt_design[state] : - &gi->design[state]); boolean redraw_selectbox = FALSE; + if (gi == NULL) + return; + + gd = (!gi->active ? &gi->alt_design[state] : + gi->checked ? &gi->alt_design[state] : &gi->design[state]); + switch (gi->type) { case GD_TYPE_NORMAL_BUTTON: @@ -686,6 +690,9 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) { int tag = first_tag; + if (gi == NULL) + return; + while (tag != GDI_END) { switch(tag) @@ -1149,6 +1156,9 @@ void ModifyGadget(struct GadgetInfo *gi, int first_tag, ...) void RedrawGadget(struct GadgetInfo *gi) { + if (gi == NULL) + return; + if (gi->mapped) DrawGadget(gi, gi->state, gi->direct_draw); } -- 2.34.1