MCPcopy Create free account
hub / github.com/NetHack/NetHack / waterbody_name

Function waterbody_name

src/pager.c:560–611  ·  view source on GitHub ↗

describe a pool location's contents; might return a static buffer so caller should use it or copy it before calling waterbody_name() again [5.0: moved here from mkmaze.c] */

Source from the content-addressed store, hash-verified

558 caller should use it or copy it before calling waterbody_name() again
559 [5.0: moved here from mkmaze.c] */
560const char *
561waterbody_name(coordxy x, coordxy y)
562{
563 static char pooltype[40];
564 schar ltyp;
565 boolean hallucinate = Hallucination && !program_state.gameover;
566
567 if (!isok(x, y))
568 return "drink"; /* should never happen */
569 ltyp = SURFACE_AT(x, y);
570
571 if (ltyp == LAVAPOOL) {
572 Snprintf(pooltype, sizeof pooltype, "molten %s", hliquid("lava"));
573 return pooltype;
574 } else if (ltyp == ICE) {
575 if (!hallucinate)
576 return "ice";
577 Snprintf(pooltype, sizeof pooltype, "frozen %s", hliquid("water"));
578 return pooltype;
579 } else if (ltyp == POOL) {
580 Snprintf(pooltype, sizeof pooltype, "pool of %s", hliquid("water"));
581 return pooltype;
582 } else if (ltyp == MOAT) {
583 /* a bit of extra flavor over general moat */
584 if (hallucinate) {
585 Snprintf(pooltype, sizeof pooltype, "deep %s", hliquid("water"));
586 return pooltype;
587 } else if (Is_medusa_level(&u.uz)) {
588 /* somewhat iffy since ordinary stairs can take you beneath,
589 but previous generic "water" was rather anti-climactic */
590 return "shallow sea";
591 } else if (Is_juiblex_level(&u.uz)) {
592 return "swamp";
593 } else if (Role_if(PM_SAMURAI) && Is_qstart(&u.uz)) {
594 /* samurai quest home level has two isolated moat spots;
595 they sound silly if farlook describes them as such */
596 return "pond";
597 } else {
598 return "moat";
599 }
600 } else if (IS_WATERWALL(ltyp)) {
601 if (Is_waterlevel(&u.uz))
602 return "limitless water"; /* even if hallucinating */
603 Snprintf(pooltype, sizeof pooltype, "wall of %s", hliquid("water"));
604 return pooltype;
605 } else if (ltyp == LAVAWALL) {
606 Snprintf(pooltype, sizeof pooltype, "wall of %s", hliquid("lava"));
607 return pooltype;
608 }
609 /* default; should be unreachable */
610 return "water"; /* don't hallucinate this as some other liquid */
611}
612
613char *
614ice_descr(coordxy x, coordxy y, char *outbuf)

Callers 12

dodipFunction · 0.85
boulder_hits_poolFunction · 0.85
wizterrainwishFunction · 0.85
swim_move_dangerFunction · 0.85
describe_decorFunction · 0.85
drownFunction · 0.85
lava_effectsFunction · 0.85
zap_over_floorFunction · 0.85
ice_descrFunction · 0.85
lookatFunction · 0.85
add_cmap_descrFunction · 0.85
youhidingFunction · 0.85

Calls 2

isokFunction · 0.85
hliquidFunction · 0.85

Tested by

no test coverage detected