schedule a timer that will shrink the target glob by 1 unit of weight */
| 1470 | |
| 1471 | /* schedule a timer that will shrink the target glob by 1 unit of weight */ |
| 1472 | void |
| 1473 | start_glob_timeout( |
| 1474 | struct obj *obj, /* glob */ |
| 1475 | long when) /* when to shrink; if 0L, use random value close to 25 */ |
| 1476 | { |
| 1477 | if (!obj->globby) { |
| 1478 | impossible("start_glob_timeout for non-glob [%d: %s]?", |
| 1479 | obj->otyp, simpleonames(obj)); |
| 1480 | return; /* skip timer creation */ |
| 1481 | } |
| 1482 | /* sanity precaution */ |
| 1483 | if (obj->timed) |
| 1484 | (void) stop_timer(SHRINK_GLOB, obj_to_any(obj)); |
| 1485 | |
| 1486 | if (when < 1L) /* caller usually passes 0L; should never be negative */ |
| 1487 | when = 25L + (long) rn2(5) - 2L; /* 25+[0..4]-2 => 23..27, avg 25 */ |
| 1488 | /* 1 new glob weighs 20 units and loses 1 unit every 25 turns, |
| 1489 | so lasts for 500 turns, twice as long as the average corpse */ |
| 1490 | (void) start_timer(when, TIMER_OBJECT, SHRINK_GLOB, obj_to_any(obj)); |
| 1491 | } |
| 1492 | |
| 1493 | /* globs have quantity 1 and size which varies by multiples of 20 in owt; |
| 1494 | they don't become tainted with age, but every 25 turns this timer runs |
no test coverage detected