* Usually start a melt_ice timer; sometimes the ice will become * permanent instead. */
| 5085 | * permanent instead. |
| 5086 | */ |
| 5087 | void |
| 5088 | start_melt_ice_timeout( |
| 5089 | coordxy x, coordxy y, |
| 5090 | long min_time) /* <x,y>'s old melt timeout (deleted by time we get here) */ |
| 5091 | { |
| 5092 | int when; |
| 5093 | long where; |
| 5094 | |
| 5095 | when = (int) min_time; |
| 5096 | if (when < MIN_ICE_TIME - 1) |
| 5097 | when = MIN_ICE_TIME - 1; |
| 5098 | |
| 5099 | /* random timeout; surrounding ice locations ought to be a factor... */ |
| 5100 | while (++when <= MAX_ICE_TIME) |
| 5101 | if (!rn2((MAX_ICE_TIME - when) + MIN_ICE_TIME)) |
| 5102 | break; |
| 5103 | |
| 5104 | /* if we're within MAX_ICE_TIME, install a melt timer; |
| 5105 | otherwise, omit it to leave this ice permanent */ |
| 5106 | if (when <= MAX_ICE_TIME) { |
| 5107 | where = ((long) x << 16) | (long) y; |
| 5108 | (void) start_timer((long) when, TIMER_LEVEL, MELT_ICE_AWAY, |
| 5109 | long_to_any(where)); |
| 5110 | } |
| 5111 | } |
| 5112 | #undef MIN_ICE_TIME |
| 5113 | #undef MAX_ICE_TIME |
| 5114 |
no test coverage detected