Unify putting a saddle on steed
This commit is contained in:
@@ -2235,6 +2235,7 @@ E struct obj *FDECL(findgold, (struct obj *));
|
||||
E void NDECL(rider_cant_reach);
|
||||
E boolean FDECL(can_saddle, (struct monst *));
|
||||
E int FDECL(use_saddle, (struct obj *));
|
||||
E void FDECL(put_saddle_on_mon, (struct obj *, struct monst *));
|
||||
E boolean FDECL(can_ride, (struct monst *));
|
||||
E int NDECL(doride);
|
||||
E boolean FDECL(mount_steed, (struct monst *, BOOLEAN_P));
|
||||
|
||||
@@ -187,13 +187,8 @@ makedog()
|
||||
context.startingpet_mid = mtmp->m_id;
|
||||
/* Horses already wear a saddle */
|
||||
if (pettype == PM_PONY && !!(otmp = mksobj(SADDLE, TRUE, FALSE))) {
|
||||
if (mpickobj(mtmp, otmp))
|
||||
panic("merged saddle?");
|
||||
mtmp->misc_worn_check |= W_SADDLE;
|
||||
otmp->dknown = otmp->bknown = otmp->rknown = 1;
|
||||
otmp->owornmask = W_SADDLE;
|
||||
otmp->leashmon = mtmp->m_id;
|
||||
update_mon_intrinsics(mtmp, otmp, TRUE, TRUE);
|
||||
put_saddle_on_mon(otmp, mtmp);
|
||||
}
|
||||
|
||||
if (!petname_used++ && *petname)
|
||||
|
||||
@@ -2457,11 +2457,7 @@ create_particular()
|
||||
}
|
||||
if (saddled && can_saddle(mtmp) && !which_armor(mtmp, W_SADDLE)) {
|
||||
struct obj *otmp = mksobj(SADDLE, TRUE, FALSE);
|
||||
(void) mpickobj(mtmp, otmp);
|
||||
mtmp->misc_worn_check |= W_SADDLE;
|
||||
otmp->owornmask = W_SADDLE;
|
||||
otmp->leashmon = mtmp->m_id;
|
||||
update_mon_intrinsics(mtmp, otmp, TRUE, FALSE);
|
||||
put_saddle_on_mon(otmp, mtmp);
|
||||
}
|
||||
if (invisible)
|
||||
mon_set_minvis(mtmp);
|
||||
|
||||
23
src/steed.c
23
src/steed.c
@@ -134,18 +134,27 @@ struct obj *otmp;
|
||||
if (otmp->owornmask)
|
||||
remove_worn_item(otmp, FALSE);
|
||||
freeinv(otmp);
|
||||
/* mpickobj may free otmp it if merges, but we have already
|
||||
checked for a saddle above, so no merger should happen */
|
||||
(void) mpickobj(mtmp, otmp);
|
||||
mtmp->misc_worn_check |= W_SADDLE;
|
||||
otmp->owornmask = W_SADDLE;
|
||||
otmp->leashmon = mtmp->m_id;
|
||||
update_mon_intrinsics(mtmp, otmp, TRUE, FALSE);
|
||||
put_saddle_on_mon(otmp, mtmp);
|
||||
} else
|
||||
pline("%s resists!", Monnam(mtmp));
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
put_saddle_on_mon(saddle, mtmp)
|
||||
struct obj *saddle;
|
||||
struct monst *mtmp;
|
||||
{
|
||||
if (!can_saddle(mtmp) || which_armor(mtmp, W_SADDLE))
|
||||
return;
|
||||
if (mpickobj(mtmp, saddle))
|
||||
panic("merged saddle?");
|
||||
mtmp->misc_worn_check |= W_SADDLE;
|
||||
saddle->owornmask = W_SADDLE;
|
||||
saddle->leashmon = mtmp->m_id;
|
||||
update_mon_intrinsics(mtmp, saddle, TRUE, FALSE);
|
||||
}
|
||||
|
||||
/*** Riding the monster ***/
|
||||
|
||||
/* Can we ride this monster? Caller should also check can_saddle() */
|
||||
|
||||
Reference in New Issue
Block a user