Remove hard-coded differences between highways and bridge heads

Let highways build and support bridges.  Allow bridge heads anywhere,
not just on the coast.
This commit is contained in:
Markus Armbruster 2008-02-12 07:10:33 +01:00 committed by Markus Armbruster
parent 9f1b4e2c81
commit e3658ff2f0
4 changed files with 14 additions and 17 deletions

View file

@ -170,6 +170,9 @@ extern struct dchrstr dchr[SCT_TYPE_MAX + 2];
extern struct dchrstr bigcity_dchr; extern struct dchrstr bigcity_dchr;
#define IS_BIG_CITY(type) (dchr[(type)].d_pkg == UPKG) #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) */ /* Minimal efficiency of sectors that can be knocked down (bridges) */
#define SCT_MINEFF 20 #define SCT_MINEFF 20

View file

@ -528,12 +528,10 @@ build_bridge(struct sctstr *sp, short *vec)
char buf[1024]; char buf[1024];
if (opt_EASY_BRIDGES == 0) { /* must have a bridge head or tower */ if (opt_EASY_BRIDGES == 0) { /* must have a bridge head or tower */
if (sp->sct_type != SCT_BTOWER) { if (!IS_BRIDGE_HEAD(sp->sct_type))
if (sp->sct_type != SCT_BHEAD) return 0;
return 0; if (sp->sct_newtype != sp->sct_type)
if (sp->sct_newtype != SCT_BHEAD) return 0;
return 0;
}
} }
if (sp->sct_effic < 60 && !player->god) { if (sp->sct_effic < 60 && !player->god) {

View file

@ -97,7 +97,7 @@ desi(void)
continue; continue;
if (sect.sct_type == SCT_SANCT) if (sect.sct_type == SCT_SANCT)
breaksanct++; 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", pr("%s does not border on water.\n",
xyas(nstr.x, nstr.y, player->cnum)); xyas(nstr.x, nstr.y, player->cnum));
if (player->god) if (player->god)
@ -129,11 +129,8 @@ desi(void)
if (sect.sct_x == cap_x && sect.sct_y == cap_y if (sect.sct_x == cap_x && sect.sct_y == cap_y
&& des != SCT_CAPIT && des != SCT_SANCT && des != SCT_MOUNT) && des != SCT_CAPIT && des != SCT_SANCT && des != SCT_MOUNT)
pr("You have redesignated your capital!\n"); pr("You have redesignated your capital!\n");
if (opt_EASY_BRIDGES == 0) { /* may cause a bridge fall */ if (!opt_EASY_BRIDGES && IS_BRIDGE_HEAD(n))
if (n != SCT_BHEAD)
continue;
bridgefall(&sect); bridgefall(&sect);
}
} }
if (changed) if (changed)
writemap(player->cnum); writemap(player->cnum);

View file

@ -70,7 +70,7 @@ bridge_damaged(struct sctstr *sp)
des = sp->sct_type; des = sp->sct_type;
if (des == SCT_BSPAN || des == SCT_BTOWER) if (des == SCT_BSPAN || des == SCT_BTOWER)
knockdown(sp); knockdown(sp);
if ((des == SCT_BHEAD || des == SCT_BTOWER) && !opt_EASY_BRIDGES) if (IS_BRIDGE_HEAD(des) && !opt_EASY_BRIDGES)
bridgefall(sp); bridgefall(sp);
} }
@ -98,17 +98,16 @@ bridgefall(struct sctstr *sp)
if (nnx == sp->sct_x && nny == sp->sct_y) if (nnx == sp->sct_x && nny == sp->sct_y)
continue; continue;
getsect(nnx, nny, &bh_sect); 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 /* With EASY_BRIDGES, it just has to be next to any
land */ land */
if (opt_EASY_BRIDGES) { if (opt_EASY_BRIDGES) {
if (bh_sect.sct_type != SCT_WATER && if (bh_sect.sct_type != SCT_WATER &&
bh_sect.sct_type != SCT_BSPAN) bh_sect.sct_type != SCT_BSPAN)
break; break;
} else {
if (IS_BRIDGE_HEAD(bh_sect.sct_type)
&& bh_sect.sct_newtype == bh_sect.sct_type)
break;
} }
} }
if (j > 6) { if (j > 6) {