rnd-20060407-2-src
[rocksndiamonds.git] / src / events.c
index f478a86bee482edd481952a5cee3325d92fcb776..1ae5caa917de49834af8f4cfaa5e05ba14bea906 100644 (file)
@@ -171,7 +171,9 @@ void EventLoop(void)
        has its own synchronization and is CPU friendly, too */
 
     if (game_status == GAME_MODE_PLAYING)
+    {
       HandleGameActions();
+    }
     else
     {
       SyncDisplay();
@@ -466,7 +468,7 @@ static boolean is_string_suffix(char *string, char *suffix)
   if (suffix_len > string_len)
     return FALSE;
 
-  return (strcmp(&string[string_len - suffix_len], suffix) == 0);
+  return (strEqual(&string[string_len - suffix_len], suffix));
 }
 
 #define MAX_CHEAT_INPUT_LEN    32
@@ -544,10 +546,7 @@ static void HandleKeysSpecial(Key key)
   {
 #ifdef DEBUG
     if (is_string_suffix(cheat_input, ".q"))
-      for (i = 0; i < MAX_INVENTORY_SIZE; i++)
-       if (local_player->inventory_size < MAX_INVENTORY_SIZE)
-         local_player->inventory_element[local_player->inventory_size++] =
-           EL_DYNAMITE;
+      DEBUG_SetMaximumDynamite();
 #endif
   }
   else if (game_status == GAME_MODE_EDITOR)
@@ -698,14 +697,28 @@ void HandleKey(Key key, int key_status)
       TapeTogglePause(TAPE_TOGGLE_MANUAL);
   }
 
-  if (game_status == GAME_MODE_PLAYING)
+  if (game_status == GAME_MODE_PLAYING && !network_playing)
   {
-    if (key == KSYM_5)
-      game.centered_player_nr_next = -1;
+    int centered_player_nr_next = -999;
+
+    if (key == setup.shortcut.focus_player_all)
+      centered_player_nr_next = -1;
     else
       for (i = 0; i < MAX_PLAYERS; i++)
-       if (key == KSYM_1 + i)
-         game.centered_player_nr_next = i;
+       if (key == setup.shortcut.focus_player[i])
+         centered_player_nr_next = i;
+
+    if (centered_player_nr_next != -999)
+    {
+      game.centered_player_nr_next = centered_player_nr_next;
+      game.set_centered_player = TRUE;
+
+      if (tape.recording)
+      {
+       tape.centered_player_nr_next = game.centered_player_nr_next;
+       tape.set_centered_player = TRUE;
+      }
+    }
   }
 
   HandleKeysSpecial(key);