]> granicus.if.org Git - nethack/commitdiff
melting ice follow up (trunk only)
authornethack.allison <nethack.allison>
Sun, 12 Oct 2003 14:49:42 +0000 (14:49 +0000)
committernethack.allison <nethack.allison>
Sun, 12 Oct 2003 14:49:42 +0000 (14:49 +0000)
(now + 50) < (melting time) < (now + 50 + 2000)
with the chance approaching 100% the longer the time passed

src/zap.c

index f4eaa9ea4da81f9de171011795c288a0ed2e15be..4b807eff1068fbe27df614a2f8bdb94198f33bc8 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -3518,6 +3518,8 @@ const char *msg;
                spoteffects(TRUE);      /* possibly drown, notice objects */
 }
 
+#define MIN_ICE_TIME 50
+#define MAX_ICE_TIME 2000
 /*
  * Start a melt_ice timer.
  */
@@ -3525,13 +3527,16 @@ void
 start_melt_ice_timeout(x,y)
 xchar x,y;
 {
-       long when, where;
+       int when;
+       long where;
        short action = MELT_ICE_AWAY;
-       for (when = 50L; when < 2000L; when++)
-               if (!rn2(3)) break;
+       for (when = MIN_ICE_TIME; when < (MAX_ICE_TIME + MIN_ICE_TIME); when++)
+               if (!rn2((MAX_ICE_TIME - when) + MIN_ICE_TIME)) break;
        where = (((long)x << 16) | ((long)y));
-       (void) start_timer(when, TIMER_LEVEL, action, (genericptr_t)where);
+       (void) start_timer((long)when, TIMER_LEVEL, action, (genericptr_t)where);
 }
+#undef MIN_ICE_TIME
+#undef MAX_ICE_TIME
 
 /*
  * Called when ice has melted completely away.