| 1316 | } |
| 1317 | |
| 1318 | staticfn void |
| 1319 | use_candelabrum(struct obj *obj) |
| 1320 | { |
| 1321 | const char *s = (obj->spe != 1) ? "candles" : "candle"; |
| 1322 | |
| 1323 | if (obj->lamplit) { |
| 1324 | You("snuff the %s.", s); |
| 1325 | end_burn(obj, TRUE); |
| 1326 | return; |
| 1327 | } |
| 1328 | if (obj->spe <= 0) { |
| 1329 | struct obj *otmp; |
| 1330 | |
| 1331 | pline("This %s has no %s.", xname(obj), s); |
| 1332 | /* only output tip if candles are in inventory */ |
| 1333 | for (otmp = gi.invent; otmp; otmp = otmp->nobj) |
| 1334 | if (Is_candle(otmp)) |
| 1335 | break; |
| 1336 | if (otmp) |
| 1337 | pline("To attach candles, apply them instead of the %s.", |
| 1338 | xname(obj)); |
| 1339 | return; |
| 1340 | } |
| 1341 | if (Underwater) { |
| 1342 | You("cannot make fire under water."); |
| 1343 | return; |
| 1344 | } |
| 1345 | if (u.uswallow || obj->cursed) { |
| 1346 | if (!Blind) |
| 1347 | pline_The("%s %s for a moment, then %s.", s, vtense(s, "flicker"), |
| 1348 | vtense(s, "die")); |
| 1349 | return; |
| 1350 | } |
| 1351 | if (obj->spe < 7) { |
| 1352 | There("%s only %d %s in %s.", vtense(s, "are"), obj->spe, s, |
| 1353 | the(xname(obj))); |
| 1354 | if (!Blind) |
| 1355 | pline("%s lit. %s dimly.", obj->spe == 1 ? "It is" : "They are", |
| 1356 | Tobjnam(obj, "shine")); |
| 1357 | } else { |
| 1358 | pline("%s's %s burn%s", The(xname(obj)), s, |
| 1359 | (Blind ? "." : " brightly!")); |
| 1360 | } |
| 1361 | if (!invocation_pos(u.ux, u.uy) || On_stairs(u.ux, u.uy)) { |
| 1362 | pline_The("%s %s being rapidly consumed!", s, vtense(s, "are")); |
| 1363 | /* this used to be obj->age /= 2, rounding down; an age of |
| 1364 | 1 would yield 0, confusing begin_burn() and producing an |
| 1365 | unlightable, unrefillable candelabrum; round up instead */ |
| 1366 | obj->age = (obj->age + 1L) / 2L; |
| 1367 | |
| 1368 | /* to make absolutely sure the game doesn't become unwinnable as |
| 1369 | a consequence of a broken candelabrum */ |
| 1370 | if (obj->age == 0) { |
| 1371 | impossible("Candelabrum with candles but no fuel?"); |
| 1372 | obj->age = 1; |
| 1373 | } |
| 1374 | } else { |
| 1375 | if (obj->spe == 7) { |
no test coverage detected