rnd-20050724-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 24 Jul 2005 21:37:09 +0000 (23:37 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:49:13 +0000 (10:49 +0200)
* added recognition of "trigger element" for "change digged element to"
  (this is not really what the "trigger element" was made for, but its
  use may seem obvious for leaving back digged elements unchanged)
* fixed multiple warnings about failed joystick device initialization

ChangeLog
src/conftime.h
src/game.c
src/libgame/joystick.c
src/libgame/sdl.c

index bbc96b9d4ee86cbc07d644dd543edc69b6c7b2bc..6ea090be957d4b0c069b956d9658dbd6c7462893 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-24
+       * added recognition of "trigger element" for "change digged element to"
+         (this is not really what the "trigger element" was made for, but its
+         use may seem obvious for leaving back digged elements unchanged)
+
+2005-07-23
+       * fixed multiple warnings about failed joystick device initialization
+
 2005-06-27
        * fixed bug with dynamite dropped on top of just dropped custom element
          (collect dynamite, collect CE, drop CE => dynamite was also dropped);
index cee54f4d3db06f4c5919542c3742508d487f845d..0cedaf281fa754879514175563021d218c31eaa4 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2005-06-30 00:18]"
+#define COMPILE_DATE_STRING "[2005-07-24 14:45]"
index 34a57f74728c6790ddf24442678b4ece5feb90aa..ba4c8f9d9ed8a7fe78d01489b9c511907eb882e1 100644 (file)
@@ -56,6 +56,8 @@
 
 #define USE_DROP_BUGFIX                        (TRUE   * USE_NEW_STUFF         * 1)
 
+#define USE_CHANGE_TO_TRIGGERED                (TRUE   * USE_NEW_STUFF         * 1)
+
 
 /* for DigField() */
 #define DF_NO_PUSH             0
@@ -6219,7 +6221,16 @@ void StartMoving(int x, int y)
 #if 1
       Store[newx][newy] = EL_EMPTY;
       if (IS_EQUAL_OR_IN_GROUP(new_element, MOVE_ENTER_EL(element)))
+      {
+#if USE_CHANGE_TO_TRIGGERED
+       int move_leave_element = element_info[element].move_leave_element;
+
+       Store[newx][newy] = (move_leave_element == EL_TRIGGER_ELEMENT ?
+                            new_element : move_leave_element);
+#else
        Store[newx][newy] = element_info[element].move_leave_element;
+#endif
+      }
 #else
       Store[newx][newy] = EL_EMPTY;
       if (IS_EQUAL_OR_IN_GROUP(new_element, MOVE_ENTER_EL(element)) ||
@@ -6629,6 +6640,12 @@ void ContinueMoving(int x, int y)
   {
     int move_leave_element = ei->move_leave_element;
 
+#if USE_CHANGE_TO_TRIGGERED
+    if (ei->move_leave_type == LEAVE_TYPE_LIMITED &&
+        ei->move_leave_element == EL_TRIGGER_ELEMENT)
+      move_leave_element = stored;
+#endif
+
     Feld[x][y] = move_leave_element;
 
 #if USE_PREVIOUS_MOVE_DIR
index d9cad1289ddd7d9fbabd79f76219bb4be0c5e91d..c2d0c192cc0d6323458f7d698eb0d4bfcf0f4f1c 100644 (file)
@@ -26,6 +26,8 @@
 #if defined(PLATFORM_UNIX) && !defined(TARGET_SDL)
 void UnixInitJoysticks()
 {
+  static boolean unix_joystick_subsystem_initialized = FALSE;
+  boolean print_warning = !unix_joystick_subsystem_initialized;
   int i;
 
   for (i = 0; i < MAX_PLAYERS; i++)
@@ -44,18 +46,24 @@ void UnixInitJoysticks()
 
     if (access(device_name, R_OK) != 0)
     {
-      Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
+      if (print_warning)
+       Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
+
       continue;
     }
 
     if ((joystick.fd[i] = open(device_name, O_RDONLY)) < 0)
     {
-      Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
+      if (print_warning)
+       Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
+
       continue;
     }
 
     joystick.status = JOYSTICK_ACTIVATED;
   }
+
+  unix_joystick_subsystem_initialized = TRUE;
 }
 
 boolean UnixReadJoystick(int fd, int *x, int *y, boolean *b1, boolean *b2)
index 1bc222a958c49c227bfc9fa9a6a23bf853cd8a33..b127c7844055152de46fc5f8474abd93c5be1237 100644 (file)
@@ -1440,6 +1440,7 @@ void HandleJoystickEvent(Event *event)
 void SDLInitJoysticks()
 {
   static boolean sdl_joystick_subsystem_initialized = FALSE;
+  boolean print_warning = !sdl_joystick_subsystem_initialized;
   int i;
 
   if (!sdl_joystick_subsystem_initialized)
@@ -1459,11 +1460,19 @@ void SDLInitJoysticks()
     int joystick_nr = getJoystickNrFromDeviceName(device_name);
 
     if (joystick_nr >= SDL_NumJoysticks())
+    {
+      if (setup.input[i].use_joystick && print_warning)
+       Error(ERR_WARN, "cannot find joystick %d", joystick_nr);
+
       joystick_nr = -1;
+    }
 
     /* misuse joystick file descriptor variable to store joystick number */
     joystick.fd[i] = joystick_nr;
 
+    if (joystick_nr == -1)
+      continue;
+
     /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
     if (SDLCheckJoystickOpened(joystick_nr))
       SDLCloseJoystick(joystick_nr);
@@ -1473,7 +1482,9 @@ void SDLInitJoysticks()
 
     if (!SDLOpenJoystick(joystick_nr))
     {
-      Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
+      if (print_warning)
+       Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
+
       continue;
     }