]> granicus.if.org Git - nethack/commitdiff
Use symbolic names for shop repair costs
authorPasi Kallinen <paxed@alt.org>
Thu, 14 Sep 2017 18:04:56 +0000 (21:04 +0300)
committerPasi Kallinen <paxed@alt.org>
Thu, 14 Sep 2017 18:07:18 +0000 (21:07 +0300)
...and add costs to two places where the door you touched
blew up (picking the lock and opening the door).

include/hack.h
src/dig.c
src/dokick.c
src/hack.c
src/lock.c
src/trap.c
src/zap.c

index c4691ae269dfbe5d45b0687bdacc0d0d130a1cfd..b3a05ca677dbe64179ff230541e6b440733257bf 100644 (file)
@@ -37,6 +37,12 @@ enum encumbrance_types {
 /* number of turns it takes for vault guard to show up */
 #define VAULT_GUARD_TIME 30
 
+#define SHOP_DOOR_COST 400L /* cost of a destroyed shop door */
+#define SHOP_BARS_COST 300L /* cost of iron bars */
+#define SHOP_HOLE_COST 200L /* cost of making hole/trapdoor */
+#define SHOP_WALL_COST 200L /* cost of destroying a wall */
+#define SHOP_WALL_DMG  (10L * ACURRSTR) /* damaging a wall */
+
 /* hunger states - see hu_stat in eat.c */
 enum hunger_state_types {
     SATIATED = 0,
index 4407c4c152dc749b2ee7945e61a0ecf910b46c40..364d1cce6c1308804907c6819a60b42c6eb99eee 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -404,7 +404,7 @@ dig(VOID_ARGS)
             }
         } else if (IS_WALL(lev->typ)) {
             if (shopedge) {
-                add_damage(dpx, dpy, 10L * ACURRSTR);
+                add_damage(dpx, dpy, SHOP_WALL_DMG);
                 dmgtxt = "damage";
             }
             if (level.flags.is_maze_lev) {
@@ -424,7 +424,7 @@ dig(VOID_ARGS)
         } else if (closed_door(dpx, dpy)) {
             digtxt = "You break through the door.";
             if (shopedge) {
-                add_damage(dpx, dpy, 400L);
+                add_damage(dpx, dpy, SHOP_DOOR_COST);
                 dmgtxt = "break";
             }
             if (!(lev->doormask & D_TRAPPED))
@@ -1485,7 +1485,7 @@ zap_dig()
             }
         } else if (closed_door(zx, zy) || room->typ == SDOOR) {
             if (*in_rooms(zx, zy, SHOPBASE)) {
-                add_damage(zx, zy, 400L);
+                add_damage(zx, zy, SHOP_DOOR_COST);
                 shopdoor = TRUE;
             }
             if (room->typ == SDOOR)
@@ -1502,7 +1502,7 @@ zap_dig()
             if (IS_WALL(room->typ)) {
                 if (!(room->wall_info & W_NONDIGGABLE)) {
                     if (*in_rooms(zx, zy, SHOPBASE)) {
-                        add_damage(zx, zy, 200L);
+                        add_damage(zx, zy, SHOP_WALL_COST);
                         shopwall = TRUE;
                     }
                     room->typ = ROOM;
@@ -1530,7 +1530,7 @@ zap_dig()
                 break;
             if (IS_WALL(room->typ) || room->typ == SDOOR) {
                 if (*in_rooms(zx, zy, SHOPBASE)) {
-                    add_damage(zx, zy, 200L);
+                    add_damage(zx, zy, SHOP_WALL_COST);
                     shopwall = TRUE;
                 }
                 watch_dig((struct monst *) 0, zx, zy, TRUE);
index 2cb485472d4beaa98e865edbeffab19fe021f021..a6a34898f58c43f8c7a3c914e93019afa432e2b4 100644 (file)
@@ -1278,7 +1278,7 @@ dokick()
         feel_newsym(x, y); /* we know we broke it */
         unblock_point(x, y); /* vision */
         if (shopdoor) {
-            add_damage(x, y, 400L);
+            add_damage(x, y, SHOP_DOOR_COST);
             pay_for_damage("break", FALSE);
         }
         if (in_town(x, y))
index 8683fda774143b9373f73fe4ec7d99f0a15733ee..a196b44f57cd11ac04a26308a6e5f0f49449ce1c 100644 (file)
@@ -442,7 +442,7 @@ xchar x, y;
 
     } else if (IS_WALL(lev->typ)) {
         if (*in_rooms(x, y, SHOPBASE)) {
-            add_damage(x, y, 10L * ACURRSTR);
+            add_damage(x, y, SHOP_WALL_DMG);
             dmgtxt = "damage";
         }
         digtxt = "chew a hole in the wall.";
@@ -472,7 +472,7 @@ xchar x, y;
 
     } else if (IS_DOOR(lev->typ)) {
         if (*in_rooms(x, y, SHOPBASE)) {
-            add_damage(x, y, 400L);
+            add_damage(x, y, SHOP_DOOR_COST);
             dmgtxt = "break";
         }
         if (lev->doormask & D_TRAPPED) {
index 12131063091a7ad97a035a65cfa370a16e1fba3e..94073f3ae401b88613cc759806acafee82579b61 100644 (file)
@@ -112,7 +112,7 @@ picklock(VOID_ARGS)
             xlock.door->doormask = D_NODOOR;
             unblock_point(u.ux + u.dx, u.uy + u.dy);
             if (*in_rooms(u.ux + u.dx, u.uy + u.dy, SHOPBASE))
-                add_damage(u.ux + u.dx, u.uy + u.dy, 0L);
+                add_damage(u.ux + u.dx, u.uy + u.dy, SHOP_DOOR_COST);
             newsym(u.ux + u.dx, u.uy + u.dy);
         } else if (xlock.door->doormask & D_LOCKED)
             xlock.door->doormask = D_CLOSED;
@@ -659,7 +659,7 @@ int x, y;
             b_trapped("door", FINGER);
             door->doormask = D_NODOOR;
             if (*in_rooms(cc.x, cc.y, SHOPBASE))
-                add_damage(cc.x, cc.y, 0L);
+                add_damage(cc.x, cc.y, SHOP_DOOR_COST);
         } else
             door->doormask = D_ISOPEN;
         feel_newsym(cc.x, cc.y); /* the hero knows she opened it */
index ddf065a0ccc43d670fb249075e1626521e8da6f8..33aedca38ccd2af6f9f340dc3ebe1655f2298b72 100644 (file)
@@ -409,7 +409,7 @@ int x, y, typ;
             add_damage(x, y, /* schedule repair */
                        ((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
                         && !context.mon_moving)
-                           ? 200L
+                           ? SHOP_HOLE_COST
                            : 0L);
         lev->doormask = 0;     /* subsumes altarmask, icedpool... */
         if (IS_ROOM(lev->typ)) /* && !IS_AIR(lev->typ) */
index 9cf38e0302d9c96e223a483ac5e6498bbf4894a1..fb5dd857a0f7cf967a3e9efe7663d7e05a83110c 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -3300,7 +3300,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
                     if (levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN
                         && *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE)) {
                         shopdoor = TRUE;
-                        add_damage(bhitpos.x, bhitpos.y, 400L);
+                        add_damage(bhitpos.x, bhitpos.y, SHOP_DOOR_COST);
                     }
                 }
                 break;
@@ -4410,7 +4410,7 @@ short exploding_wand_typ;
                     lev->typ = ROOM;
                     if (see_it)
                         newsym(x, y);
-                    add_damage(x, y, (type >= 0) ? 300L : 0L);
+                    add_damage(x, y, (type >= 0) ? SHOP_BARS_COST : 0L);
                     if (type >= 0)
                         *shopdamage = TRUE;
                 } else {
@@ -4508,7 +4508,7 @@ short exploding_wand_typ;
         if (new_doormask >= 0) { /* door gets broken */
             if (*in_rooms(x, y, SHOPBASE)) {
                 if (type >= 0) {
-                    add_damage(x, y, 400L);
+                    add_damage(x, y, SHOP_DOOR_COST);
                     *shopdamage = TRUE;
                 } else /* caused by monster */
                     add_damage(x, y, 0L);