| 895 | } |
| 896 | |
| 897 | void |
| 898 | place_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*/ |
no test coverage detected