From bb401fcb3865c3a94162fb75e8408f3e45dc9929 Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Fri, 25 Oct 2024 12:30:01 +0900 Subject: [PATCH] split a message of a rock disappearing into a separate function ... to prepare further refactoring --- src/hack.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/hack.c b/src/hack.c index 4c636910d..e3290da7e 100644 --- a/src/hack.c +++ b/src/hack.c @@ -13,6 +13,7 @@ staticfn void dopush(coordxy, coordxy, coordxy, coordxy, struct obj *, boolean); staticfn void cannot_push_msg(struct obj *, coordxy, coordxy); staticfn int cannot_push(struct obj *, coordxy, coordxy); +staticfn void rock_disappear_msg(struct obj *); staticfn void moverock_done(coordxy, coordxy); staticfn int moverock(void); staticfn int moverock_core(coordxy, coordxy); @@ -308,6 +309,18 @@ cannot_push(struct obj *otmp, coordxy sx, coordxy sy) } } +staticfn void +rock_disappear_msg(struct obj *otmp) +{ + if (u.usteed) + pline("%s pushes %s and suddenly it disappears!", + YMonnam(u.usteed), the(xname(otmp))); + else + You("push %s and suddenly it disappears!", + the(xname(otmp))); + +} + staticfn void moverock_done(coordxy sx, coordxy sy) { @@ -560,12 +573,7 @@ moverock_core(coordxy sx, coordxy sy) } /*FALLTHRU*/ case TELEP_TRAP: - if (u.usteed) - pline("%s pushes %s and suddenly it disappears!", - YMonnam(u.usteed), the(xname(otmp))); - else - You("push %s and suddenly it disappears!", - the(xname(otmp))); + rock_disappear_msg(otmp); otmp->next_boulder = 0; /* reset before moving it */ if (ttmp->ttyp == TELEP_TRAP) { (void) rloco(otmp);