| 163 | } |
| 164 | |
| 165 | staticfn void |
| 166 | dopush( |
| 167 | coordxy sx, |
| 168 | coordxy sy, |
| 169 | coordxy rx, |
| 170 | coordxy ry, |
| 171 | struct obj *otmp, |
| 172 | boolean costly) |
| 173 | { |
| 174 | struct monst *shkp; |
| 175 | |
| 176 | { |
| 177 | const char *what; |
| 178 | boolean givemesg, easypush; |
| 179 | /* give boulder pushing feedback if this is a different |
| 180 | boulder than the last one pushed or if it's been at |
| 181 | least 2 turns since we last pushed this boulder; |
| 182 | unlike with Norep(), intervening messages don't cause |
| 183 | it to repeat, only doing something else in the meantime */ |
| 184 | if (otmp->o_id != gb.bldrpush_oid) { |
| 185 | gb.bldrpushtime = svm.moves + 1L; |
| 186 | gb.bldrpush_oid = otmp->o_id; |
| 187 | } |
| 188 | givemesg = (svm.moves > gb.bldrpushtime + 2L |
| 189 | || svm.moves < gb.bldrpushtime); |
| 190 | what = givemesg ? the(xname(otmp)) : 0; |
| 191 | if (!u.usteed) { |
| 192 | easypush = throws_rocks(gy.youmonst.data); |
| 193 | if (givemesg) |
| 194 | pline("With %s effort you move %s.", |
| 195 | easypush ? "little" : "great", what); |
| 196 | if (!easypush) |
| 197 | exercise(A_STR, TRUE); |
| 198 | } else { |
| 199 | if (givemesg) |
| 200 | pline("%s moves %s.", YMonnam(u.usteed), what); |
| 201 | } |
| 202 | gb.bldrpushtime = svm.moves; |
| 203 | } |
| 204 | |
| 205 | /* Move the boulder *after* the message. */ |
| 206 | if (glyph_is_invisible(levl[rx][ry].glyph)) |
| 207 | unmap_object(rx, ry); |
| 208 | otmp->next_boulder = 0; |
| 209 | movobj(otmp, rx, ry); /* does newsym(rx,ry) */ |
| 210 | if (Blind) { |
| 211 | feel_location(rx, ry); |
| 212 | feel_location(sx, sy); |
| 213 | } else { |
| 214 | newsym(sx, sy); |
| 215 | } |
| 216 | /* maybe adjust bill if boulder was pushed across shop boundary; |
| 217 | normally otmp->unpaid would not apply because otmp isn't in |
| 218 | hero's inventory, but addtobill() sets it and subfrombill() |
| 219 | clears it */ |
| 220 | if (costly && !costly_spot(rx, ry)) { |
| 221 | /* pushing from inside shop to its boundary (or free spot) */ |
| 222 | addtobill(otmp, FALSE, FALSE, FALSE); |
no test coverage detected