From e3658ff2f02fcc7e680645386e69848659321554 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 12 Feb 2008 07:10:33 +0100 Subject: [PATCH] Remove hard-coded differences between highways and bridge heads Let highways build and support bridges. Allow bridge heads anywhere, not just on the coast. --- include/sect.h | 3 +++ src/lib/commands/buil.c | 10 ++++------ src/lib/commands/desi.c | 7 ++----- src/lib/subs/bridgefall.c | 11 +++++------ 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/sect.h b/include/sect.h index da0e9cb1c..60fb72b7a 100644 --- a/include/sect.h +++ b/include/sect.h @@ -170,6 +170,9 @@ extern struct dchrstr dchr[SCT_TYPE_MAX + 2]; extern struct dchrstr bigcity_dchr; #define IS_BIG_CITY(type) (dchr[(type)].d_pkg == UPKG) +#define IS_BRIDGE_HEAD(type) \ + ((type) == SCT_BHEAD || (type) == SCT_HIWAY || (type) == SCT_BTOWER) + /* Minimal efficiency of sectors that can be knocked down (bridges) */ #define SCT_MINEFF 20 diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index c9ea788a3..bb3d2d6e8 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -528,12 +528,10 @@ build_bridge(struct sctstr *sp, short *vec) char buf[1024]; if (opt_EASY_BRIDGES == 0) { /* must have a bridge head or tower */ - if (sp->sct_type != SCT_BTOWER) { - if (sp->sct_type != SCT_BHEAD) - return 0; - if (sp->sct_newtype != SCT_BHEAD) - return 0; - } + if (!IS_BRIDGE_HEAD(sp->sct_type)) + return 0; + if (sp->sct_newtype != sp->sct_type) + return 0; } if (sp->sct_effic < 60 && !player->god) { diff --git a/src/lib/commands/desi.c b/src/lib/commands/desi.c index cee4e2d83..ce14be615 100644 --- a/src/lib/commands/desi.c +++ b/src/lib/commands/desi.c @@ -97,7 +97,7 @@ desi(void) continue; if (sect.sct_type == SCT_SANCT) breaksanct++; - if ((des == SCT_HARBR || des == SCT_BHEAD) && !sect.sct_coastal) { + if (des == SCT_HARBR && !sect.sct_coastal) { pr("%s does not border on water.\n", xyas(nstr.x, nstr.y, player->cnum)); if (player->god) @@ -129,11 +129,8 @@ desi(void) if (sect.sct_x == cap_x && sect.sct_y == cap_y && des != SCT_CAPIT && des != SCT_SANCT && des != SCT_MOUNT) pr("You have redesignated your capital!\n"); - if (opt_EASY_BRIDGES == 0) { /* may cause a bridge fall */ - if (n != SCT_BHEAD) - continue; + if (!opt_EASY_BRIDGES && IS_BRIDGE_HEAD(n)) bridgefall(§); - } } if (changed) writemap(player->cnum); diff --git a/src/lib/subs/bridgefall.c b/src/lib/subs/bridgefall.c index f407f32f0..624b0a957 100644 --- a/src/lib/subs/bridgefall.c +++ b/src/lib/subs/bridgefall.c @@ -70,7 +70,7 @@ bridge_damaged(struct sctstr *sp) des = sp->sct_type; if (des == SCT_BSPAN || des == SCT_BTOWER) knockdown(sp); - if ((des == SCT_BHEAD || des == SCT_BTOWER) && !opt_EASY_BRIDGES) + if (IS_BRIDGE_HEAD(des) && !opt_EASY_BRIDGES) bridgefall(sp); } @@ -98,17 +98,16 @@ bridgefall(struct sctstr *sp) if (nnx == sp->sct_x && nny == sp->sct_y) continue; getsect(nnx, nny, &bh_sect); - if (bh_sect.sct_type == SCT_BHEAD && - bh_sect.sct_newtype == SCT_BHEAD) - break; - if (bh_sect.sct_type == SCT_BTOWER) - break; /* With EASY_BRIDGES, it just has to be next to any land */ if (opt_EASY_BRIDGES) { if (bh_sect.sct_type != SCT_WATER && bh_sect.sct_type != SCT_BSPAN) break; + } else { + if (IS_BRIDGE_HEAD(bh_sect.sct_type) + && bh_sect.sct_newtype == bh_sect.sct_type) + break; } } if (j > 6) { -- 2.43.0