Skip to content

Instantly share code, notes, and snippets.

@timvisher
Created January 21, 2016 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timvisher/fc655a50f36b7c70f375 to your computer and use it in GitHub Desktop.
Save timvisher/fc655a50f36b7c70f375 to your computer and use it in GitHub Desktop.
diff --git a/libnethack/src/hack.c b/libnethack/src/hack.c
index 2b9858b..0022186 100644
--- a/libnethack/src/hack.c
+++ b/libnethack/src/hack.c
@@ -206,7 +206,12 @@ resolve_uim(enum u_interaction_mode uim, boolean weird_attack, xchar x, xchar y)
case the correct reaction is to bump into it, but sobj_at will return
true). Note that mem_obj has an offset of 1. */
if (l->mem_obj == BOULDER + 1) {
- return uia_pushboulder;
+ if (!travelling()) {
+ return uia_pushboulder;
+ } else {
+ pline("A boulder blocks your way!");
+ return uia_halt;
+ }
}
/* We automatically open doors in most modes too (not counting nointeraction
@@ -903,9 +908,10 @@ test_move(int ux, int uy, int dx, int dy, int dz, int mode,
}
/* Can we be blocked by a boulder? */
- if (!throws_rocks(youmonst.data) &&
- !(verysmall(youmonst.data) && !u.usteed) &&
- !((!invent || inv_weight() <= -850) && !u.usteed)) {
+ if (travelling() ||
+ (!throws_rocks(youmonst.data) &&
+ !(verysmall(youmonst.data) && !u.usteed) &&
+ !((!invent || inv_weight() <= -850) && !u.usteed))) {
/* We assume we can move boulders when we're at a distance from them.
When it comes to actually do the move, resolve_uim() may replace the
move with a #pushboulder command. If it doesn't, the move fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment