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).
This commit is contained in:
Pasi Kallinen
2017-09-14 21:04:56 +03:00
parent cfedd8659d
commit f8bd77ae03
7 changed files with 20 additions and 14 deletions

View 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,

View File

@@ -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);

View 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))

View 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) {

View 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 */

View 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) */

View File

@@ -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);