removed redundant and unused code
authorHolger Schemel <info@artsoft.org>
Thu, 20 Oct 2022 18:00:39 +0000 (20:00 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 20 Oct 2022 18:00:39 +0000 (20:00 +0200)
src/editor.c

index 0bc70107027007a97e789a2d298299c379afb4f2..631c57f6e32fb32671231433ddf9cc6ccdbb3a40 100644 (file)
@@ -12904,8 +12904,6 @@ static void CopyLevelTemplateToUserLevelSet(char *levelset_subdir)
 static void HandleDrawingAreas(struct GadgetInfo *gi)
 {
   static boolean started_inside_drawing_area = FALSE;
 static void HandleDrawingAreas(struct GadgetInfo *gi)
 {
   static boolean started_inside_drawing_area = FALSE;
-  static int last_sx = -1, last_sy = -1;
-  static int last_sx2 = -1, last_sy2 = -1;
   int id = gi->custom_id;
   int type_id = gi->custom_type_id;
   boolean button_press_event;
   int id = gi->custom_id;
   int type_id = gi->custom_type_id;
   boolean button_press_event;
@@ -12967,15 +12965,12 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
     sy2 = sy * 2 + dy;
   }
 
     sy2 = sy * 2 + dy;
   }
 
-  if (button_release_event)
-  {
-    last_sx = -1;
-    last_sy = -1;
-    last_sx2 = -1;
-    last_sy2 = -1;
-  }
-  else if (!button_press_event)
+  if (!button_press_event && !button_release_event)
   {
   {
+    static int last_sx = -1;
+    static int last_sy = -1;
+    static int last_sx2 = -1;
+    static int last_sy2 = -1;
     int old_element = (IN_LEV_FIELD(lx, ly) ? Tile[lx][ly] : EL_UNDEFINED);
     boolean hires_drawing = (level.game_engine_type == GAME_ENGINE_TYPE_MM &&
                             isHiresTileElement(old_element) &&
     int old_element = (IN_LEV_FIELD(lx, ly) ? Tile[lx][ly] : EL_UNDEFINED);
     boolean hires_drawing = (level.game_engine_type == GAME_ENGINE_TYPE_MM &&
                             isHiresTileElement(old_element) &&
@@ -12985,12 +12980,12 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
     if ((sx == last_sx && sy == last_sy && !hires_drawing) ||
        (sx2 == last_sx2 && sy2 == last_sy2))
       return;
     if ((sx == last_sx && sy == last_sy && !hires_drawing) ||
        (sx2 == last_sx2 && sy2 == last_sy2))
       return;
-  }
 
 
-  last_sx = sx;
-  last_sy = sy;
-  last_sx2 = sx2;
-  last_sy2 = sy2;
+    last_sx = sx;
+    last_sy = sy;
+    last_sx2 = sx2;
+    last_sy2 = sy2;
+  }
 
   if (button_press_event)
     started_inside_drawing_area = inside_drawing_area;
 
   if (button_press_event)
     started_inside_drawing_area = inside_drawing_area;
@@ -13123,22 +13118,19 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
        if (button_release_event)
          CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
 
        if (button_release_event)
          CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
 
-       if (button)
-       {
-         SetDrawModeHiRes(new_element);
+       SetDrawModeHiRes(new_element);
 
 
-         if (getDrawModeHiRes())
-         {
-           sx = sx2;
-           sy = sy2;
-         }
+       if (getDrawModeHiRes())
+       {
+         sx = sx2;
+         sy = sy2;
+       }
 
 
-         if (!button_press_event)
-           DrawLine(last_sx, last_sy, sx, sy, new_element, TRUE);
+       if (!button_press_event)
+         DrawLine(last_sx, last_sy, sx, sy, new_element, TRUE);
 
 
-         last_sx = sx;
-         last_sy = sy;
-       }
+       last_sx = sx;
+       last_sy = sy;
       }
       break;
 
       }
       break;