rnd-20060828-1-src
[rocksndiamonds.git] / src / libgame / misc.c
index f9ec87fe5b15cf9c1206f7f6b83bade9c302e0df..916ce2bdc4a3fff781f9b546f339adecf39e3443 100644 (file)
@@ -328,8 +328,17 @@ void WaitUntilDelayReached(unsigned long *counter_var, unsigned long delay)
 /* random generator functions                                                */
 /* ------------------------------------------------------------------------- */
 
+#if 0
+static int foo = -1;
+#endif
+
 unsigned int init_random_number(int nr, long seed)
 {
+#if 0
+  if (nr == 0)
+    foo = 0;
+#endif
+
   if (seed == NEW_RANDOMIZE)
   {
 #if defined(TARGET_SDL)
@@ -349,7 +358,26 @@ unsigned int init_random_number(int nr, long seed)
 
 unsigned int get_random_number(int nr, int max)
 {
+#if 0
+  if (max > 0)
+  {
+    long int rnd_raw = random_linux_libc(nr);
+    unsigned int rnd = rnd_raw % max;
+
+    if (nr == 0)
+    {
+      printf("::: %d: %d [%d MOD %d]\n", foo++, rnd, rnd_raw, max);
+    }
+
+    return rnd;
+  }
+  else
+  {
+    return 0;
+  }
+#else
   return (max > 0 ? random_linux_libc(nr) % max : 0);
+#endif
 }
 
 
@@ -1544,7 +1572,7 @@ void deleteNodeFromList(ListNode **node_first, char *key,
 
   if (strEqual((*node_first)->key, key))
   {
-    free((*node_first)->key);
+    checked_free((*node_first)->key);
     if (destructor_function)
       destructor_function((*node_first)->content);
     *node_first = (*node_first)->next;