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

Function place_monster

src/steed.c:897–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897void
898place_monster(struct monst *mon, coordxy x, coordxy y)
899{
900 struct monst *othermon;
901 const char *monnm, *othnm;
902 char buf[QBUFSZ];
903
904 buf[0] = '\0';
905 /* normal map bounds are <1..COLNO-1,0..ROWNO-1> but sometimes
906 vault guards (either living or dead) are parked at <0,0> */
907 if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) {
908 describe_level(buf, 0);
909 impossible("trying to place %s at <%d,%d> mstate:%lx on %s",
910 minimal_monnam(mon, TRUE), x, y, mon->mstate, buf);
911 x = y = 0;
912 }
913 if ((mon == u.usteed && !gi.in_steed_dismounting)
914 /* special case is for convoluted vault guard handling */
915 || (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
916 describe_level(buf, 0);
917 impossible("placing %s onto map, mstate:%lx, on %s?",
918 (mon == u.usteed) ? "steed" : "defunct monster",
919 mon->mstate, buf);
920 return;
921 }
922 if ((othermon = svl.level.monsters[x][y]) != 0) {
923 describe_level(buf, 0);
924 monnm = minimal_monnam(mon, FALSE);
925 othnm = (mon != othermon) ? minimal_monnam(othermon, TRUE) : "itself";
926 impossible("placing %s over %s at <%d,%d>, mstates:%lx %lx on %s?",
927 monnm, othnm, x, y, othermon->mstate, mon->mstate, buf);
928 }
929 mon->mx = x, mon->my = y;
930 svl.level.monsters[x][y] = mon;
931 mon->mstate = MON_FLOOR;
932}
933
934/*steed.c*/

Callers 15

dismount_steedFunction · 0.85
rloc_to_coreFunction · 0.85
getlevFunction · 0.85
domove_swap_with_petFunction · 0.85
domove_coreFunction · 0.85
md_rushFunction · 0.85
mdisplacemFunction · 0.85
gulpmmFunction · 0.85
mdamagemFunction · 0.85
mhurtle_stepFunction · 0.85
parkguardFunction · 0.85
gd_pick_corridor_goldFunction · 0.85

Calls 4

isokFunction · 0.85
describe_levelFunction · 0.85
minimal_monnamFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected