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

Function down_gate

src/dokick.c:1942–1969  ·  view source on GitHub ↗

migration destination for objects which fall down to next level */

Source from the content-addressed store, hash-verified

1940
1941/* migration destination for objects which fall down to next level */
1942schar
1943down_gate(coordxy x, coordxy y)
1944{
1945 struct trap *ttmp;
1946 stairway *stway = stairway_at(x, y);
1947
1948 gg.gate_str = 0;
1949 /* this matches the player restriction in goto_level() */
1950 if (on_level(&u.uz, &qstart_level) && !ok_to_quest()) {
1951 return MIGR_NOWHERE;
1952 }
1953 if (stway && !stway->up && !stway->isladder) {
1954 gg.gate_str = "down the stairs";
1955 return (stway->tolev.dnum == u.uz.dnum) ? MIGR_STAIRS_UP
1956 : MIGR_SSTAIRS;
1957 }
1958 if (stway && !stway->up && stway->isladder) {
1959 gg.gate_str = "down the ladder";
1960 return MIGR_LADDER_UP;
1961 }
1962 /* hole will always be flagged as seen; trap drop might or might not */
1963 if ((ttmp = t_at(x, y)) != 0 && ttmp->tseen && is_hole(ttmp->ttyp)) {
1964 gg.gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
1965 : "through the hole";
1966 return MIGR_RANDOM;
1967 }
1968 return MIGR_NOWHERE;
1969}
1970
1971/*dokick.c*/

Callers 4

launch_objFunction · 0.85
impact_dropFunction · 0.85
ship_objectFunction · 0.85
drop_throwFunction · 0.85

Calls 4

stairway_atFunction · 0.85
on_levelFunction · 0.85
ok_to_questFunction · 0.85
t_atFunction · 0.85

Tested by

no test coverage detected