Source:SLASH'EM 0.0.7E7F2/steed.c

From NetHackWiki
Revision as of 19:47, 7 March 2008 by Kernigh bot (talk | contribs) (SLASH'EM 0.0.7E7F2/steed.c moved to Source:SLASH'EM 0.0.7E7F2/steed.c: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to steed.c from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/steed.c#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)steed.c	3.4	2003/01/10	*/
2.    /* Copyright (c) Kevin Hugo, 1998-1999. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #include "hack.h"
6.    
7.    
8.    #ifdef STEED
9.    
10.   /* Monsters that might be ridden */
11.   static NEARDATA const char steeds[] = {
12.   	S_QUADRUPED, S_UNICORN, S_ANGEL, S_CENTAUR, S_DRAGON, S_JABBERWOCK, '\0'
13.   };
14.   
15.   STATIC_DCL boolean FDECL(landing_spot, (coord *, int, int));
16.   
17.   /* caller has decided that hero can't reach something while mounted */
18.   void
19.   rider_cant_reach()
20.   {
21.        You("aren't skilled enough to reach from %s.", y_monnam(u.usteed));
22.   }
23.   
24.   /*** Putting the saddle on ***/
25.   
26.   /* Can this monster wear a saddle? */
27.   boolean
28.   can_saddle(mtmp)
29.   	struct monst *mtmp;
30.   {
31.   	struct permonst *ptr = mtmp->data;
32.   
33.   	return (index(steeds, ptr->mlet) && (ptr->msize >= MZ_MEDIUM) &&
34.   			(!humanoid(ptr) || ptr->mlet == S_CENTAUR) &&
35.   			!amorphous(ptr) && !noncorporeal(ptr) &&
36.   			!is_whirly(ptr) && !unsolid(ptr));
37.   }
38.   
39.   
40.   int
41.   use_saddle(otmp)
42.   	struct obj *otmp;
43.   {
44.   	struct monst *mtmp;
45.   	struct permonst *ptr;
46.   	int chance;
47.   	const char *s;
48.   
49.   
50.   	/* Can you use it? */
51.   	if (nohands(youmonst.data)) {
52.   		You("have no hands!");	/* not `body_part(HAND)' */
53.   		return 0;
54.   	} else if (!freehand()) {
55.   		You("have no free %s.", body_part(HAND));
56.   		return 0;
57.   	}
58.   
59.   	/* Select an animal */
60.   	if (u.uswallow || Underwater || !getdir((char *)0)) {
61.   	    pline(Never_mind);
62.   	    return 0;
63.   	}
64.   	if (!u.dx && !u.dy) {
65.   	    pline("Saddle yourself?  Very funny...");
66.   	    return 0;
67.   	}
68.   	if (!isok(u.ux+u.dx, u.uy+u.dy) ||
69.   			!(mtmp = m_at(u.ux+u.dx, u.uy+u.dy)) ||
70.   			!canspotmon(mtmp)) {
71.   	    pline("I see nobody there.");
72.   	    return 1;
73.   	}
74.   
75.   	/* Is this a valid monster? */
76.   	if (mtmp->misc_worn_check & W_SADDLE ||
77.   			which_armor(mtmp, W_SADDLE)) {
78.   	    pline("%s doesn't need another one.", Monnam(mtmp));
79.   	    return 1;
80.   	}
81.   	ptr = mtmp->data;
82.   	if (touch_petrifies(ptr) && !uarmg && !Stone_resistance) {
83.   	    char kbuf[BUFSZ];
84.   
85.   	    You("touch %s.", mon_nam(mtmp));
86.    	    if (!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
87.   		Sprintf(kbuf, "attempting to saddle %s", an(mtmp->data->mname));
88.   		instapetrify(kbuf);
89.    	    }
90.   	}
91.   	if (ptr == &mons[PM_INCUBUS] || ptr == &mons[PM_SUCCUBUS]) {
92.   	    pline("Shame on you!");
93.   	    exercise(A_WIS, FALSE);
94.   	    return 1;
95.   	}
96.   	if (mtmp->isminion || mtmp->isshk || mtmp->ispriest ||
97.   			mtmp->isgd || mtmp->iswiz) {
98.   	    pline("I think %s would mind.", mon_nam(mtmp));
99.   	    return 1;
100.  	}
101.  	if (!can_saddle(mtmp)) {
102.  		You_cant("saddle such a creature.");
103.  		return 1;
104.  	}
105.  
106.  	/* Calculate your chance */
107.  	chance = ACURR(A_DEX) + ACURR(A_CHA)/2 + 2*mtmp->mtame;
108.  	chance += u.ulevel * (mtmp->mtame ? 20 : 5);
109.  	if (!mtmp->mtame) chance -= 10*mtmp->m_lev;
110.  	if (Role_if(PM_KNIGHT))
111.  	    chance += 20;
112.  	switch (P_SKILL(P_RIDING)) {
113.  	case P_ISRESTRICTED:
114.  	case P_UNSKILLED:
115.  	default:
116.  	    chance -= 20;	break;
117.  	case P_BASIC:
118.  	    break;
119.  	case P_SKILLED:
120.  	    chance += 15;	break;
121.  	case P_EXPERT:
122.  	    chance += 30;	break;
123.  	}
124.  	if (Confusion || Fumbling || Glib)
125.  	    chance -= 20;
126.  	else if (uarmg &&
127.  		(s = OBJ_DESCR(objects[uarmg->otyp])) != (char *)0 &&
128.  		!strncmp(s, "riding ", 7))
129.  	    /* Bonus for wearing "riding" (but not fumbling) gloves */
130.  	    chance += 10;
131.  	else if (uarmf &&
132.  		(s = OBJ_DESCR(objects[uarmf->otyp])) != (char *)0 &&
133.  		!strncmp(s, "riding ", 7))
134.  	    /* ... or for "riding boots" */
135.  	    chance += 10;
136.  	if (otmp->cursed)
137.  	    chance -= 50;
138.  
139.  	/* Make the attempt */
140.  	if (rn2(100) < chance) {
141.  	    You("put the saddle on %s.", mon_nam(mtmp));
142.  	    if (otmp->owornmask) remove_worn_item(otmp, FALSE);
143.  	    freeinv(otmp);
144.  	    /* mpickobj may free otmp it if merges, but we have already
145.  	       checked for a saddle above, so no merger should happen */
146.  	    (void) mpickobj(mtmp, otmp);
147.  	    mtmp->misc_worn_check |= W_SADDLE;
148.  	    otmp->owornmask = W_SADDLE;
149.  	    otmp->leashmon = mtmp->m_id;
150.  	    update_mon_intrinsics(mtmp, otmp, TRUE, FALSE);
151.  	} else
152.  	    pline("%s resists!", Monnam(mtmp));
153.  	return 1;
154.  }
155.  
156.  
157.  /*** Riding the monster ***/
158.  
159.  /* Can we ride this monster?  Caller should also check can_saddle() */
160.  boolean
161.  can_ride(mtmp)
162.  	struct monst *mtmp;
163.  {
164.  	return (mtmp->mtame && humanoid(youmonst.data) &&
165.  			!verysmall(youmonst.data) && !bigmonst(youmonst.data) &&
166.  			(!Underwater || is_swimmer(mtmp->data)));
167.  }
168.  
169.  
170.  int
171.  doride()
172.  {
173.  	boolean forcemount = FALSE;
174.  
175.  	if (u.usteed)
176.  	    dismount_steed(DISMOUNT_BYCHOICE);
177.  	else if (getdir((char *)0) && isok(u.ux+u.dx, u.uy+u.dy)) {
178.  #ifdef WIZARD
179.  	if (wizard && yn("Force the mount to succeed?") == 'y')
180.  		forcemount = TRUE;
181.  #endif
182.  	    return (mount_steed(m_at(u.ux+u.dx, u.uy+u.dy), forcemount));
183.  	} else
184.  	    return 0;
185.  	return 1;
186.  }
187.  
188.  
189.  /* Start riding, with the given monster */
190.  boolean
191.  mount_steed(mtmp, force)
192.  	struct monst *mtmp;	/* The animal */
193.  	boolean force;		/* Quietly force this animal */
194.  {
195.  	struct obj *otmp;
196.  	char buf[BUFSZ];
197.  	struct permonst *ptr;
198.  
199.  	/* Sanity checks */
200.  	if (u.usteed) {
201.  	    You("are already riding %s.", mon_nam(u.usteed));
202.  	    return (FALSE);
203.  	}
204.  
205.  	/* Is the player in the right form? */
206.  	if (Hallucination && !force) {
207.  	    pline("Maybe you should find a designated driver.");
208.  	    return (FALSE);
209.  	}
210.  	/* While riding Wounded_legs refers to the steed's,
211.  	 * not the hero's legs.
212.  	 * That opens up a potential abuse where the player
213.  	 * can mount a steed, then dismount immediately to
214.  	 * heal leg damage, because leg damage is always
215.  	 * healed upon dismount (Wounded_legs context switch).
216.  	 * By preventing a hero with Wounded_legs from
217.  	 * mounting a steed, the potential for abuse is
218.  	 * minimized, if not eliminated altogether.
219.  	 */
220.  	if (Wounded_legs) {
221.  	    Your("%s are in no shape for riding.", makeplural(body_part(LEG)));
222.  #ifdef WIZARD
223.  	    if (force && wizard && yn("Heal your legs?") == 'y')
224.  		HWounded_legs = EWounded_legs = 0;
225.  	    else
226.  #endif
227.  	    return (FALSE);
228.  	}
229.  
230.  	if (Upolyd && (!humanoid(youmonst.data) || verysmall(youmonst.data) ||
231.  			bigmonst(youmonst.data) || slithy(youmonst.data))) {
232.  	    You("won't fit on a saddle.");
233.  	    return (FALSE);
234.  	}
235.  	if(!force && (near_capacity() > SLT_ENCUMBER)) {
236.  	    You_cant("do that while carrying so much stuff.");
237.  	    return (FALSE);
238.  	}
239.  
240.  	/* Can the player reach and see the monster? */
241.  	if (!mtmp || (!force && ((Blind && !Blind_telepat) ||
242.  		mtmp->mundetected ||
243.  		mtmp->m_ap_type == M_AP_FURNITURE ||
244.  		mtmp->m_ap_type == M_AP_OBJECT))) {
245.  	    pline("I see nobody there.");
246.  	    return (FALSE);
247.  	}
248.  	if (u.uswallow || u.ustuck || u.utrap || Punished ||
249.  	    !test_move(u.ux, u.uy, mtmp->mx-u.ux, mtmp->my-u.uy, TEST_MOVE)) {
250.  	    if (Punished || !(u.uswallow || u.ustuck || u.utrap))
251.  		You("are unable to swing your %s over.", body_part(LEG)); 
252.  	    else
253.  		You("are stuck here for now.");
254.  	    return (FALSE);
255.  	}
256.  
257.  	/* Is this a valid monster? */
258.  	otmp = which_armor(mtmp, W_SADDLE);
259.  	if (!otmp) {
260.  	    pline("%s is not saddled.", Monnam(mtmp));
261.  	    return (FALSE);
262.  	}
263.  	ptr = mtmp->data;
264.  	if (touch_petrifies(ptr) && !Stone_resistance) {
265.  	    char kbuf[BUFSZ];
266.  
267.  	    You("touch %s.", mon_nam(mtmp));
268.  	    Sprintf(kbuf, "attempting to ride %s", an(mtmp->data->mname));
269.  	    instapetrify(kbuf);
270.  	}
271.  	if (!mtmp->mtame || mtmp->isminion) {
272.  	    pline("I think %s would mind.", mon_nam(mtmp));
273.  	    return (FALSE);
274.  	}
275.  	if (mtmp->mtrapped) {
276.  	    struct trap *t = t_at(mtmp->mx, mtmp->my);
277.  
278.  	    You_cant("mount %s while %s's trapped in %s.",
279.  		     mon_nam(mtmp), mhe(mtmp),
280.  		     an(defsyms[trap_to_defsym(t->ttyp)].explanation));
281.  	    return (FALSE);
282.  	}
283.  
284.  	if (!force && !Role_if(PM_KNIGHT) && !(--mtmp->mtame)) {
285.  	    /* no longer tame */
286.  	    newsym(mtmp->mx, mtmp->my);
287.  	    pline("%s resists%s!", Monnam(mtmp),
288.  		  mtmp->mleashed ? " and its leash comes off" : "");
289.  	    if (mtmp->mleashed) m_unleash(mtmp, FALSE);
290.  	    return (FALSE);
291.  	}
292.  	if (!force && Underwater && !is_swimmer(ptr)) {
293.  	    You_cant("ride that creature while under water.");
294.  	    return (FALSE);
295.  	}
296.  	if (!can_saddle(mtmp) || !can_ride(mtmp)) {
297.  	    You_cant("ride such a creature.");
298.  	    return (0);
299.  	}
300.  
301.  	/* Is the player impaired? */
302.  	if (!force && !is_floater(ptr) && !is_flyer(ptr) &&
303.  			Levitation && !Lev_at_will) {
304.  	    You("cannot reach %s.", mon_nam(mtmp));
305.  	    return (FALSE);
306.  	}
307.  	if (!force && uarm && is_metallic(uarm) &&
308.  			greatest_erosion(uarm)) {
309.  	    Your("%s armor is too stiff to be able to mount %s.",
310.  			uarm->oeroded ? "rusty" : "corroded",
311.  			mon_nam(mtmp));
312.  	    return (FALSE);
313.  	}
314.  	if (!force && (Confusion || Fumbling || Glib || Wounded_legs ||
315.  		otmp->cursed || (u.ulevel+mtmp->mtame < rnd(MAXULEV/2+5)))) {
316.  	    if (Levitation) {
317.  		pline("%s slips away from you.", Monnam(mtmp));
318.  		return FALSE;
319.  	    }
320.  	    You("slip while trying to get on %s.", mon_nam(mtmp));
321.  
322.  	    Sprintf(buf, "slipped while mounting %s",
323.  		    /* "a saddled mumak" or "a saddled pony called Dobbin" */
324.  		    x_monnam(mtmp, ARTICLE_A, (char *)0,
325.  			SUPPRESS_IT|SUPPRESS_INVISIBLE|SUPPRESS_HALLUCINATION,
326.  			     TRUE));
327.  	    losehp(rn1(5,10), buf, NO_KILLER_PREFIX);
328.  	    return (FALSE);
329.  	}
330.  
331.  	/* Success */
332.  	if (!force) {
333.  	    if (Levitation && !is_floater(ptr) && !is_flyer(ptr))
334.  	    	/* Must have Lev_at_will at this point */
335.  	    	pline("%s magically floats up!", Monnam(mtmp));
336.  	    You("mount %s.", mon_nam(mtmp));
337.  	}
338.  	/* setuwep handles polearms differently when you're mounted */
339.  	if (uwep && is_pole(uwep)) unweapon = FALSE;
340.  	u.usteed = mtmp;
341.  	remove_monster(mtmp->mx, mtmp->my);
342.  	teleds(mtmp->mx, mtmp->my, TRUE);
343.  	return (TRUE);
344.  }
345.  
346.  
347.  /* You and your steed have moved */
348.  void
349.  exercise_steed()
350.  {
351.  	if (!u.usteed)
352.  		return;
353.  
354.  	/* It takes many turns of riding to exercise skill */
355.  	if (u.urideturns++ >= 100) {
356.  	    u.urideturns = 0;
357.  	    use_skill(P_RIDING, 1);
358.  	}
359.  	return;
360.  }
361.  
362.  /*
363.   * Try to find a dismount point adjacent to the steed's location.
364.   * If all else fails, try enexto().  Use enexto() as a last resort because
365.   * enexto() chooses its point randomly, possibly even outside the
366.   * room's walls, which is not what we want.
367.   * Adapted from mail daemon code.
368.   */
369.  STATIC_OVL boolean
370.  landing_spot(spot, reason, forceit)
371.  coord *spot;	/* landing position (we fill it in) */
372.  int reason;
373.  int forceit;
374.  {
375.      int i = 0, x, y, distance, min_distance = -1;
376.      boolean found = FALSE;
377.      struct trap *t;
378.  
379.      /* avoid known traps (i == 0) and boulders, but allow them as a backup */
380.      if (reason != DISMOUNT_BYCHOICE || Stunned || Confusion || Fumbling) i = 1;
381.      for (; !found && i < 2; ++i) {
382.  	for (x = u.ux-1; x <= u.ux+1; x++)
383.  	    for (y = u.uy-1; y <= u.uy+1; y++) {
384.  		if (!isok(x, y) || (x == u.ux && y == u.uy)) continue;
385.  
386.  		if (ACCESSIBLE(levl[x][y].typ) &&
387.  			    !MON_AT(x,y) && !closed_door(x,y)) {
388.  		    distance = distu(x,y);
389.  		    if (min_distance < 0 || distance < min_distance ||
390.  			    (distance == min_distance && rn2(2))) {
391.  			if (i > 0 || (((t = t_at(x, y)) == 0 || !t->tseen) &&
392.  				      (!sobj_at(BOULDER, x, y) ||
393.  				       throws_rocks(youmonst.data)))) {
394.  			    spot->x = x;
395.  			    spot->y = y;
396.  			    min_distance = distance;
397.  			    found = TRUE;
398.  			}
399.  		    }
400.  		}
401.  	    }
402.      }
403.  
404.      /* If we didn't find a good spot and forceit is on, try enexto(). */
405.      if (forceit && min_distance < 0 &&
406.  		!enexto(spot, u.ux, u.uy, youmonst.data))
407.  	return FALSE;
408.  
409.      return found;
410.  }
411.  
412.  /* The player kicks or whips the steed */
413.  void
414.  kick_steed()
415.  {
416.  	char He[4];
417.  	if (!u.usteed)
418.  	    return;
419.  
420.  	/* [ALI] Various effects of kicking sleeping/paralyzed steeds */
421.  	if (u.usteed->msleeping || !u.usteed->mcanmove) {
422.  	    /* We assume a message has just been output of the form
423.  	     * "You kick <steed>."
424.  	     */
425.  	    Strcpy(He, mhe(u.usteed));
426.  	    *He = highc(*He);
427.  	    if ((u.usteed->mcanmove || u.usteed->mfrozen) && !rn2(2)) {
428.  		if (u.usteed->mcanmove)
429.  		    u.usteed->msleeping = 0;
430.  		else if (u.usteed->mfrozen > 2)
431.  		    u.usteed->mfrozen -= 2;
432.  		else {
433.  		    u.usteed->mfrozen = 0;
434.  		    u.usteed->mcanmove = 1;
435.  		}
436.  		if (u.usteed->msleeping || !u.usteed->mcanmove)
437.  		    pline("%s stirs.", He);
438.  		else
439.  		    pline("%s rouses %sself!", He, mhim(u.usteed));
440.  	    } else
441.  		pline("%s does not respond.", He);
442.  	    return;
443.  	}
444.  
445.  	/* Make the steed less tame and check if it resists */
446.  	if (u.usteed->mtame) u.usteed->mtame--;
447.  	if (!u.usteed->mtame && u.usteed->mleashed) m_unleash(u.usteed, TRUE);
448.  	if (!u.usteed->mtame || (u.ulevel+u.usteed->mtame < rnd(MAXULEV/2+5))) {
449.  	    newsym(u.usteed->mx, u.usteed->my);
450.  	    dismount_steed(DISMOUNT_THROWN);
451.  	    return;
452.  	}
453.  
454.  	pline("%s gallops!", Monnam(u.usteed));
455.  	u.ugallop += rn1(20, 30);
456.  	return;
457.  }
458.  
459.  /* Stop riding the current steed */
460.  void
461.  dismount_steed(reason)
462.  	int reason;		/* Player was thrown off etc. */
463.  {
464.  	struct monst *mtmp;
465.  	struct obj *otmp;
466.  	coord cc;
467.  	const char *verb = "fall";
468.  	boolean repair_leg_damage = TRUE;
469.  	unsigned save_utrap = u.utrap;
470.  	boolean have_spot = landing_spot(&cc,reason,0);
471.  	
472.  	mtmp = u.usteed;		/* make a copy of steed pointer */
473.  	/* Sanity check */
474.  	if (!mtmp)		/* Just return silently */
475.  	    return;
476.  
477.  	/* Check the reason for dismounting */
478.  	otmp = which_armor(mtmp, W_SADDLE);
479.  	switch (reason) {
480.  	    case DISMOUNT_THROWN:
481.  		verb = "are thrown";
482.  	    case DISMOUNT_FELL:
483.  		You("%s off of %s!", verb, mon_nam(mtmp));
484.  		if (!have_spot) have_spot = landing_spot(&cc,reason,1);
485.  		losehp(rn1(10,10), "riding accident", KILLED_BY_AN);
486.  		set_wounded_legs(BOTH_SIDES, (int)HWounded_legs + rn1(5,5));
487.  		repair_leg_damage = FALSE;
488.  		break;
489.  	    case DISMOUNT_POLY:
490.  		You("can no longer ride %s.", mon_nam(u.usteed));
491.  		if (!have_spot) have_spot = landing_spot(&cc,reason,1);
492.  		break;
493.  	    case DISMOUNT_ENGULFED:
494.  		/* caller displays message */
495.  		break;
496.  	    case DISMOUNT_BONES:
497.  		/* hero has just died... */
498.  		break;
499.  	    case DISMOUNT_GENERIC:
500.  		/* no messages, just make it so */
501.  		break;
502.  	    case DISMOUNT_BYCHOICE:
503.  	    default:
504.  		if (otmp && otmp->cursed) {
505.  		    You("can't.  The saddle %s cursed.",
506.  			otmp->bknown ? "is" : "seems to be");
507.  		    otmp->bknown = TRUE;
508.  		    return;
509.  		}
510.  		if (!have_spot) {
511.  		    You("can't. There isn't anywhere for you to stand.");
512.  		    return;
513.  		}
514.  		if (!mtmp->mnamelth) {
515.  			pline("You've been through the dungeon on %s with no name.",
516.  				an(mtmp->data->mname));
517.  			if (Hallucination)
518.  				pline("It felt good to get out of the rain.");
519.  		} else
520.  			You("dismount %s.", mon_nam(mtmp));
521.  	}
522.  	/* While riding these refer to the steed's legs
523.  	 * so after dismounting they refer to the player's
524.  	 * legs once again.
525.  	 */
526.  	if (repair_leg_damage) HWounded_legs = EWounded_legs = 0;
527.  
528.  	/* Release the steed and saddle */
529.  	u.usteed = 0;
530.  	u.ugallop = 0L;
531.  
532.  	/* Set player and steed's position.  Try moving the player first
533.  	   unless we're in the midst of creating a bones file. */
534.  	if (reason == DISMOUNT_BONES) {
535.  	    /* move the steed to an adjacent square */
536.  	    if (enexto(&cc, u.ux, u.uy, mtmp->data))
537.  		rloc_to(mtmp, cc.x, cc.y);
538.  	    else	/* evidently no room nearby; move steed elsewhere */
539.  		(void) rloc(mtmp, FALSE);
540.  	    return;
541.  	}
542.  	if (!DEADMONSTER(mtmp)) {
543.  	    place_monster(mtmp, u.ux, u.uy);
544.  	    if (!u.uswallow && !u.ustuck && have_spot) {
545.  		struct permonst *mdat = mtmp->data;
546.  
547.  		/* The steed may drop into water/lava */
548.  		if (!is_flyer(mdat) && !is_floater(mdat) && !is_clinger(mdat)) {
549.  		    if (is_pool(u.ux, u.uy)) {
550.  			if (!Underwater)
551.  			    pline("%s falls into the %s!", Monnam(mtmp),
552.  							surface(u.ux, u.uy));
553.  			if (!is_swimmer(mdat) && !amphibious(mdat)) {
554.  			    killed(mtmp);
555.  			    adjalign(-1);
556.  			}
557.  		    } else if (is_lava(u.ux, u.uy)) {
558.  			pline("%s is pulled into the lava!", Monnam(mtmp));
559.  			if (!likes_lava(mdat)) {
560.  			    killed(mtmp);
561.  			    adjalign(-1);
562.  			}
563.  		    }
564.  		}
565.  	    /* Steed dismounting consists of two steps: being moved to another
566.  	     * square, and descending to the floor.  We have functions to do
567.  	     * each of these activities, but they're normally called
568.  	     * individually and include an attempt to look at or pick up the
569.  	     * objects on the floor:
570.  	     * teleds() --> spoteffects() --> pickup()
571.  	     * float_down() --> pickup()
572.  	     * We use this kludge to make sure there is only one such attempt.
573.  	     *
574.  	     * Clearly this is not the best way to do it.  A full fix would
575.  	     * involve having these functions not call pickup() at all, instead
576.  	     * calling them first and calling pickup() afterwards.  But it
577.  	     * would take a lot of work to keep this change from having any
578.  	     * unforseen side effects (for instance, you would no longer be
579.  	     * able to walk onto a square with a hole, and autopickup before
580.  	     * falling into the hole).
581.  	     */
582.  		/* [ALI] No need to move the player if the steed died. */
583.  		if (!DEADMONSTER(mtmp)) {
584.  		    /* Keep steed here, move the player to cc;
585.  		     * teleds() clears u.utrap
586.  		     */
587.  		    in_steed_dismounting = TRUE;
588.  		    teleds(cc.x, cc.y, TRUE);
589.  		    in_steed_dismounting = FALSE;
590.  
591.  		    /* Put your steed in your trap */
592.  		    if (save_utrap)
593.  			(void) mintrap(mtmp);
594.  		}
595.  	    /* Couldn't... try placing the steed */
596.  	    } else if (enexto(&cc, u.ux, u.uy, mtmp->data)) {
597.  		/* Keep player here, move the steed to cc */
598.  		rloc_to(mtmp, cc.x, cc.y);
599.  		/* Player stays put */
600.  	    /* Otherwise, kill the steed */
601.  	    } else {
602.  		killed(mtmp);
603.  		adjalign(-1);
604.  	    }
605.  	}
606.  
607.  	/* Return the player to the floor */
608.  	if (reason != DISMOUNT_ENGULFED) {
609.  	    in_steed_dismounting = TRUE;
610.  	    (void) float_down(0L, W_SADDLE);
611.  	    in_steed_dismounting = FALSE;
612.  	    flags.botl = 1;
613.  	    (void)encumber_msg();
614.  	    vision_full_recalc = 1;
615.  	} else
616.  	    flags.botl = 1;
617.  	/* polearms behave differently when not mounted */
618.  	if (uwep && is_pole(uwep)) unweapon = TRUE;
619.  	return;
620.  }
621.  
622.  void
623.  place_monster(mon, x, y)
624.  struct monst *mon;
625.  int x, y;
626.  {
627.      if (mon == u.usteed ||
628.  	    /* special case is for convoluted vault guard handling */
629.  	    (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
630.  	impossible("placing %s onto map?",
631.  		   (mon == u.usteed) ? "steed" : "defunct monster");
632.  	return;
633.      }
634.      mon->mx = x, mon->my = y;
635.      level.monsters[x][y] = mon;
636.  }
637.  
638.  #endif /* STEED */
639.  
640.  /*steed.c*/