|
|
|
@ -19,25 +19,34 @@ static int bcrestriction = 0;
|
|
|
|
|
static struct breadcrumbs bcpbreadcrumbs = {0}, bcubreadcrumbs = {0};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ballrelease(boolean showmsg)
|
|
|
|
|
void ballrelease(boolean showmsg)
|
|
|
|
|
{
|
|
|
|
|
if (carried(uball) && !welded(uball)) {
|
|
|
|
|
// 如果玩家正在携带铁球并且未被焊接
|
|
|
|
|
if (showmsg)
|
|
|
|
|
pline("Startled, you drop the iron ball.");
|
|
|
|
|
// 如果需要显示消息,打印提示信息"Startled, you drop the iron ball."
|
|
|
|
|
|
|
|
|
|
// 移除铁球作为武器、备用武器或弹药
|
|
|
|
|
if (uwep == uball)
|
|
|
|
|
setuwep((struct obj *) 0);
|
|
|
|
|
// 如果当前武器是铁球,将当前武器设为无
|
|
|
|
|
if (uswapwep == uball)
|
|
|
|
|
setuswapwep((struct obj *) 0);
|
|
|
|
|
// 如果备用武器是铁球,将备用武器设为无
|
|
|
|
|
if (uquiver == uball)
|
|
|
|
|
setuqwep((struct obj *) 0);
|
|
|
|
|
/* [this used to test 'if (uwep != uball)' but that always passes
|
|
|
|
|
after the setuwep() above] */
|
|
|
|
|
freeinv(uball); /* remove from inventory but don't place on floor */
|
|
|
|
|
// 如果弹药是铁球,将弹药设为无
|
|
|
|
|
|
|
|
|
|
// 从物品栏中移除铁球,但不放置到地面上
|
|
|
|
|
freeinv(uball);
|
|
|
|
|
|
|
|
|
|
// 更新负重状态并显示相关信息
|
|
|
|
|
(void) encumber_msg();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ball&chain might hit hero when falling through a trap door */
|
|
|
|
|
void
|
|
|
|
|
ballfall(void)
|
|
|
|
@ -176,16 +185,20 @@ unplacebc_core(void)
|
|
|
|
|
u.bc_felt = 0; /* feel nothing */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static boolean
|
|
|
|
|
check_restriction(int restriction)
|
|
|
|
|
static boolean check_restriction(int restriction)
|
|
|
|
|
{
|
|
|
|
|
boolean ret = FALSE;
|
|
|
|
|
|
|
|
|
|
// 检查是否没有限制或者当前限制与覆盖限制相同
|
|
|
|
|
if (!bcrestriction || (restriction == override_restriction))
|
|
|
|
|
ret = TRUE;
|
|
|
|
|
// 如果满足条件,则设置返回值为TRUE
|
|
|
|
|
else
|
|
|
|
|
ret = (bcrestriction == restriction) ? TRUE : FALSE;
|
|
|
|
|
// 否则,检查当前限制是否与传入的限制相同,并设置返回值为TRUE或者FALSE
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
// 返回结果
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef BREADCRUMBS
|
|
|
|
@ -283,22 +296,28 @@ Placebc(const char *funcnm, int linenum)
|
|
|
|
|
placebc_core();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Unplacebc(const char *funcnm, int linenum)
|
|
|
|
|
void Unplacebc(const char *funcnm, int linenum)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// 如果存在限制
|
|
|
|
|
if (bcrestriction) {
|
|
|
|
|
char panicbuf[BUFSZ];
|
|
|
|
|
|
|
|
|
|
// 创建错误消息字符串
|
|
|
|
|
Sprintf(panicbuf, "Unplacebc from %s:%d, when restricted to %s:%d",
|
|
|
|
|
funcnm, linenum,
|
|
|
|
|
bcubreadcrumbs.funcnm, bcubreadcrumbs.linenum);
|
|
|
|
|
|
|
|
|
|
// 将错误消息记录到日志中
|
|
|
|
|
paniclog("Unplacebc", panicbuf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 禁用当前限制,启用上一个限制,并更新函数名和行号
|
|
|
|
|
bcpbreadcrumbs.in_effect = FALSE;
|
|
|
|
|
bcubreadcrumbs.in_effect = TRUE;
|
|
|
|
|
bcubreadcrumbs.funcnm = funcnm;
|
|
|
|
|
bcubreadcrumbs.linenum = linenum;
|
|
|
|
|
|
|
|
|
|
// 执行unplacebc_core函数
|
|
|
|
|
unplacebc_core();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|