if hallucinating, return a random liquid instead of 'liquidpref' */
| 1490 | |
| 1491 | /* if hallucinating, return a random liquid instead of 'liquidpref' */ |
| 1492 | const char * |
| 1493 | hliquid( |
| 1494 | const char *liquidpref) /* use as-is when not hallucintg (unless empty) */ |
| 1495 | { |
| 1496 | boolean hallucinate = Hallucination && !program_state.gameover; |
| 1497 | |
| 1498 | if (hallucinate || !liquidpref || !*liquidpref) { |
| 1499 | int indx, count = SIZE(hliquids); |
| 1500 | |
| 1501 | /* if we have a non-hallucinatory default value, include it |
| 1502 | among the choices */ |
| 1503 | if (liquidpref && *liquidpref) |
| 1504 | ++count; |
| 1505 | indx = rn2_on_display_rng(count); |
| 1506 | if (IndexOk(indx, hliquids)) |
| 1507 | return hliquids[indx]; |
| 1508 | } |
| 1509 | return liquidpref; |
| 1510 | } |
| 1511 | |
| 1512 | /* Aliases for road-runner nemesis |
| 1513 | */ |
no test coverage detected