From: Pasi Kallinen Date: Thu, 14 Sep 2017 18:04:56 +0000 (+0300) Subject: Use symbolic names for shop repair costs X-Git-Tag: NetHack-3.6.1_RC01~362 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8bd77ae03b9f78c9f4b7ce5daa0fe0854cf020a;p=nethack Use symbolic names for shop repair costs ...and add costs to two places where the door you touched blew up (picking the lock and opening the door). --- diff --git a/include/hack.h b/include/hack.h index c4691ae26..b3a05ca67 100644 --- a/include/hack.h +++ b/include/hack.h @@ -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, diff --git a/src/dig.c b/src/dig.c index 4407c4c15..364d1cce6 100644 --- 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); diff --git a/src/dokick.c b/src/dokick.c index 2cb485472..a6a34898f 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -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)) diff --git a/src/hack.c b/src/hack.c index 8683fda77..a196b44f5 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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) { diff --git a/src/lock.c b/src/lock.c index 121310630..94073f3ae 100644 --- a/src/lock.c +++ b/src/lock.c @@ -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 */ diff --git a/src/trap.c b/src/trap.c index ddf065a0c..33aedca38 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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) */ diff --git a/src/zap.c b/src/zap.c index 9cf38e030..fb5dd857a 100644 --- 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);