2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * buil.c: Build ships, nukes, bridges, planes, land units, bridge towers
30 * Known contributors to this file:
31 * Steve McClure, 1998-2000
32 * Markus Armbruster, 2004-2005
56 static int build_nuke(struct sctstr *sp,
57 struct nchrstr *np, short *vec);
58 static int build_ship(struct sctstr *sp,
59 struct mchrstr *mp, short *vec,
61 static int build_land(struct sctstr *sp,
62 struct lchrstr *lp, short *vec,
64 static int build_bridge(struct sctstr *sp, short *vec);
65 static int build_tower(struct sctstr *sp, short *vec);
66 static int build_plane(struct sctstr *sp,
67 struct plchrstr *pp, short *vec,
70 static int cash; /* static ok */
73 * build <WHAT> <SECTS> <TYPE|DIR|MEG> [NUMBER]
79 struct nstr_sect nstr;
97 natp = getnatp(player->cnum);
99 getstarg(player->argp[1],
100 "Build (ship, nuke, bridge, plane, land unit, tower)? ",
105 for (x = 0; x < number; x++) {
106 if (!snxtsct(&nstr, player->argp[2])) {
107 pr("Bad sector specification.\n");
110 tlev = (int)natp->nat_level[NAT_TLEV];
111 rlev = (int)natp->nat_level[NAT_RLEV];
115 p = getstarg(player->argp[3], "Plane type? ", buf);
116 if (p == 0 || *p == 0)
118 type = typematch(p, EF_PLANE);
121 rqtech = pp->pl_tech;
126 pr("You can't build that!\n");
127 pr("Use `show plane build %d' to show types you can build.\n", tlev);
132 p = getstarg(player->argp[3], "Ship type? ", buf);
133 if (p == 0 || *p == 0)
135 type = typematch(p, EF_SHIP);
141 if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
145 pr("You can't build that!\n");
146 pr("Use `show ship build %d' to show types you can build.\n", tlev);
151 p = getstarg(player->argp[3], "Land unit type? ", buf);
152 if (p == 0 || *p == 0)
154 type = typematch(p, EF_LAND);
160 if ((lp->l_flags & L_SPY) && !opt_LANDSPIES)
164 pr("You can't build that!\n");
165 pr("Use `show land build %d' to show types you can build.\n", tlev);
170 if (natp->nat_level[NAT_TLEV] + 0.005 < buil_bt) {
171 pr("Building a span requires a tech of %.0f\n", buil_bt);
176 if (!opt_BRIDGETOWERS) {
177 pr("Bridge tower building is disabled.\n");
180 if (natp->nat_level[NAT_TLEV] + 0.005 < buil_tower_bt) {
181 pr("Building a tower requires a tech of %.0f\n",
187 if (!ef_nelem(EF_NUKE_CHR)) {
188 pr("There are no nukes in this game.\n");
191 p = getstarg(player->argp[3], "Nuke type? ", buf);
192 if (p == 0 || *p == 0)
194 type = typematch(p, EF_NUKE);
199 || (drnuke_const > MIN_DRNUKE_CONST &&
200 np->n_tech * drnuke_const > rlev))
205 if (drnuke_const > MIN_DRNUKE_CONST)
206 tt = (tlev < (rlev / drnuke_const) ? (int)tlev :
207 (int)(rlev / drnuke_const));
208 pr("You can't build that!\n");
209 pr("Use `show nuke build %d' to show types you can build.\n", tt);
214 pr("You can't build that!\n");
217 if (what != 'b' && what != 't') {
218 if (player->argp[4]) {
219 if (atoi(player->argp[4]) > 20 && !asked) {
223 "Are you sure that you want to build %s of them? ",
225 p = getstarg(player->argp[6], bstr, buf);
226 if (p == 0 || *p != 'y')
229 number = atoi(player->argp[4]);
232 if (what != 'b' && what != 'n' && what != 't') {
233 if (player->argp[5]) {
234 tlev = atoi(player->argp[5]);
235 if (tlev > natp->nat_level[NAT_TLEV] && !player->god) {
236 pr("Your tech level is only %d.\n",
237 (int)natp->nat_level[NAT_TLEV]);
241 pr("Required tech is %d.\n", rqtech);
244 pr("building with tech level %d.\n", tlev);
246 tlev = (int)natp->nat_level[NAT_TLEV];
248 cash = natp->nat_money;
249 while (nxtsct(&nstr, §)) {
255 built = build_land(§, lp, sect.sct_item, tlev);
258 built = build_ship(§, mp, sect.sct_item, tlev);
261 built = build_bridge(§, sect.sct_item);
264 built = build_tower(§, sect.sct_item);
267 built = build_nuke(§, np, sect.sct_item);
270 built = build_plane(§, pp, sect.sct_item, tlev);
273 CANT_HAPPEN("Bad WHAT");
282 pr("Bad sector specification.\n");
288 build_ship(struct sctstr *sp, struct mchrstr *mp,
289 short *vec, int tlev)
292 struct nstr_item nstr;
294 float eff = SHIP_MINEFF / 100.0;
298 hcm = roundavg((double)mp->m_hcm * eff);
299 lcm = roundavg((double)mp->m_lcm * eff);
301 if (sp->sct_type != SCT_HARBR) {
302 pr("Ships must be built in harbours.\n");
305 if (sp->sct_effic < 60 && !player->god) {
306 pr("Sector %s is not 60%% efficient.\n",
307 xyas(sp->sct_x, sp->sct_y, player->cnum));
310 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
311 pr("Not enough materials in %s\n",
312 xyas(sp->sct_x, sp->sct_y, player->cnum));
315 avail = (SHP_BLD_WORK(mp->m_lcm, mp->m_hcm) * SHIP_MINEFF + 99) / 100;
316 if (sp->sct_avail < avail) {
317 pr("Not enough available work in %s to build a %s\n",
318 xyas(sp->sct_x, sp->sct_y, player->cnum), mp->m_name);
319 pr(" (%d available work required)\n", avail);
322 cost = mp->m_cost * SHIP_MINEFF / 100;
324 pr("Not enough money left to build a %s\n", mp->m_name);
327 if (!trechk(player->cnum, 0, NEWSHP))
329 if (!check_sect_ok(sp))
331 sp->sct_avail -= avail;
332 player->dolcost += cost;
334 snxtitem_all(&nstr, EF_SHIP);
335 while (nxtitem(&nstr, &ship)) {
336 if (ship.shp_own == 0) {
342 ef_extend(EF_SHIP, 50);
344 memset(&ship, 0, sizeof(struct shpstr));
345 ship.shp_x = sp->sct_x;
346 ship.shp_y = sp->sct_y;
347 ship.shp_destx[0] = sp->sct_x;
348 ship.shp_desty[0] = sp->sct_y;
349 ship.shp_destx[1] = sp->sct_x;
350 ship.shp_desty[1] = sp->sct_y;
351 ship.shp_autonav = 0;
352 /* new code for autonav, Chad Zabel 1-15-94 */
353 for (i = 0; i < TMAX; ++i) {
354 ship.shp_tstart[i] = I_NONE;
355 ship.shp_tend[i] = I_NONE;
356 ship.shp_lstart[i] = 0;
357 ship.shp_lend[i] = 0;
359 ship.shp_mission = 0;
360 ship.shp_own = player->cnum;
361 ship.shp_type = mp - mchr;
362 ship.shp_effic = SHIP_MINEFF;
363 if (opt_MOB_ACCESS) {
364 time(&ship.shp_access);
365 ship.shp_mobil = -(etu_per_update / sect_mob_neg_factor);
369 ship.shp_uid = nstr.cur;
372 ship.shp_nxlight = 0;
373 ship.shp_nchoppers = 0;
374 ship.shp_fleet = ' ';
375 memset(ship.shp_item, 0, sizeof(ship.shp_item));
376 ship.shp_pstage = PLG_HEALTHY;
378 ship.shp_mobquota = 0;
380 ship.shp_follow = nstr.cur;
381 ship.shp_name[0] = 0;
382 ship.shp_orig_own = player->cnum;
383 ship.shp_orig_x = sp->sct_x;
384 ship.shp_orig_y = sp->sct_y;
385 ship.shp_fuel = mchr[(int)ship.shp_type].m_fuelc;
387 memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
388 shp_set_tech(&ship, tlev);
393 if (sp->sct_pstage == PLG_INFECT)
394 ship.shp_pstage = PLG_EXPOSED;
395 makenotlost(EF_SHIP, ship.shp_own, ship.shp_uid, ship.shp_x,
397 putship(ship.shp_uid, &ship);
398 pr("%s", prship(&ship));
399 pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
404 build_land(struct sctstr *sp, struct lchrstr *lp,
405 short *vec, int tlev)
408 struct nstr_item nstr;
410 float eff = LAND_MINEFF / 100.0;
411 int mil, lcm, hcm, gun, shell;
415 mil = roundavg(((double)lp->l_mil * eff));
416 shell = roundavg(((double)lp->l_shell * eff));
417 gun = roundavg(((double)lp->l_gun * eff));
419 mil = shell = gun = 0;
421 hcm = roundavg(((double)lp->l_hcm * eff));
422 lcm = roundavg(((double)lp->l_lcm * eff));
424 if (sp->sct_type != SCT_HEADQ) {
425 pr("Land Units must be built in headquarters.\n");
428 if (sp->sct_effic < 60 && !player->god) {
429 pr("Sector %s is not 60%% efficient.\n",
430 xyas(sp->sct_x, sp->sct_y, player->cnum));
433 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
434 pr("Not enough materials in %s\n",
435 xyas(sp->sct_x, sp->sct_y, player->cnum));
439 if (vec[I_GUN] < gun || vec[I_GUN] == 0) {
440 pr("Not enough guns in %s\n",
441 xyas(sp->sct_x, sp->sct_y, player->cnum));
444 if (vec[I_SHELL] < shell) {
445 pr("Not enough shells in %s\n",
446 xyas(sp->sct_x, sp->sct_y, player->cnum));
449 if (vec[I_MILIT] < mil) {
450 pr("Not enough military in %s\n",
451 xyas(sp->sct_x, sp->sct_y, player->cnum));
455 if (!trechk(player->cnum, 0, NEWLND))
457 if (!check_sect_ok(sp))
459 avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * LAND_MINEFF + 99) / 100;
460 if (sp->sct_avail < avail) {
461 pr("Not enough available work in %s to build a %s\n",
462 xyas(sp->sct_x, sp->sct_y, player->cnum), lp->l_name);
463 pr(" (%d available work required)\n", avail);
466 cost = lp->l_cost * LAND_MINEFF / 100;
468 pr("Not enough money left to build a %s\n", lp->l_name);
471 sp->sct_avail -= avail;
472 player->dolcost += cost;
474 snxtitem_all(&nstr, EF_LAND);
475 while (nxtitem(&nstr, &land)) {
476 if (land.lnd_own == 0) {
482 ef_extend(EF_LAND, 50);
484 memset(&land, 0, sizeof(struct lndstr));
485 land.lnd_x = sp->sct_x;
486 land.lnd_y = sp->sct_y;
487 land.lnd_own = player->cnum;
488 land.lnd_mission = 0;
489 land.lnd_type = lp - lchr;
490 land.lnd_effic = LAND_MINEFF;
491 if (opt_MOB_ACCESS) {
492 time(&land.lnd_access);
493 land.lnd_mobil = -(etu_per_update / sect_mob_neg_factor);
497 land.lnd_uid = nstr.cur;
504 land.lnd_retreat = morale_base;
505 land.lnd_fuel = lp->l_fuelc;
506 land.lnd_nxlight = 0;
508 memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
509 land.lnd_rad_max = 0;
510 memset(land.lnd_item, 0, sizeof(land.lnd_item));
511 land.lnd_pstage = PLG_HEALTHY;
513 lnd_set_tech(&land, tlev);
519 vec[I_SHELL] -= shell;
521 if (sp->sct_pstage == PLG_INFECT)
522 land.lnd_pstage = PLG_EXPOSED;
523 putland(nstr.cur, &land);
524 makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
526 pr("%s", prland(&land));
527 pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
532 build_bridge(struct sctstr *sp, short *vec)
538 int nx, ny, i, good = 0;
542 if (opt_EASY_BRIDGES == 0) { /* must have a bridge head or tower */
543 if (sp->sct_type != SCT_BTOWER) {
544 if (sp->sct_type != SCT_BHEAD)
546 if (sp->sct_newtype != SCT_BHEAD)
551 if (sp->sct_effic < 60 && !player->god) {
552 pr("Sector %s is not 60%% efficient.\n",
553 xyas(sp->sct_x, sp->sct_y, player->cnum));
557 if (vec[I_HCM] < buil_bh) {
558 pr("%s only has %d unit%s of hcm,\n",
559 xyas(sp->sct_x, sp->sct_y, player->cnum),
560 vec[I_HCM], vec[I_HCM] > 1 ? "s" : "");
561 pr("(a bridge span requires %d)\n", buil_bh);
565 if (cash < buil_bc) {
566 pr("A span costs $%.2f to build; ", buil_bc);
567 pr("you only have %d.\n", cash);
570 avail = (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100;
571 if (sp->sct_avail < avail) {
572 pr("Not enough available work in %s to build a bridge\n",
573 xyas(sp->sct_x, sp->sct_y, player->cnum));
574 pr(" (%d available work required)\n", avail);
577 if (!player->argp[3]) {
578 pr("Bridge head at %s\n",
579 xyas(sp->sct_x, sp->sct_y, player->cnum));
580 nav_map(sp->sct_x, sp->sct_y, 1);
582 if (!(p = getstarg(player->argp[3], "build span in what direction? ", buf))
586 /* Sanity check time */
587 if (!check_sect_ok(sp))
590 if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
591 pr("'%c' is not a valid direction...\n", *p);
595 newx = sp->sct_x + diroff[val][0];
596 newy = sp->sct_y + diroff[val][1];
597 if (getsect(newx, newy, §) == 0 || sect.sct_type != SCT_WATER) {
598 pr("%s is not a water sector\n", xyas(newx, newy, player->cnum));
601 if (opt_EASY_BRIDGES) {
604 for (i = 1; i <= 6; i++) {
606 nx = sect.sct_x + diroff[i][0];
607 ny = sect.sct_y + diroff[i][1];
608 getsect(nx, ny, &s2);
609 if ((s2.sct_type != SCT_WATER) && (s2.sct_type != SCT_BSPAN))
613 pr("Bridges must be built adjacent to land or bridge towers.\n");
614 pr("That sector is not adjacent to land or a bridge tower.\n");
617 } /* end EASY_BRIDGES */
618 sp->sct_avail -= avail;
619 player->dolcost += buil_bc;
621 sect.sct_type = SCT_BSPAN;
622 sect.sct_newtype = SCT_BSPAN;
623 sect.sct_effic = SCT_MINEFF;
626 sect.sct_defense = 0;
627 if (!opt_DEFENSE_INFRA)
628 sect.sct_defense = sect.sct_effic;
629 if (opt_MOB_ACCESS) {
630 time(§.sct_access);
631 sect.sct_mobil = -(etu_per_update / sect_mob_neg_factor);
636 map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BSPAN].d_mnem, 2);
637 writemap(player->cnum);
639 pr("Bridge span built over %s\n",
640 xyas(sect.sct_x, sect.sct_y, player->cnum));
641 vec[I_HCM] -= buil_bh;
646 build_nuke(struct sctstr *sp, struct nchrstr *np,
651 if (sp->sct_type != SCT_NUKE && !player->god) {
652 pr("Nuclear weapons must be built in nuclear plants.\n");
655 if (sp->sct_effic < 60 && !player->god) {
656 pr("Sector %s is not 60%% efficient.\n",
657 xyas(sp->sct_x, sp->sct_y, player->cnum));
660 if (vec[I_HCM] < np->n_hcm || vec[I_LCM] < np->n_lcm ||
661 vec[I_OIL] < np->n_oil || vec[I_RAD] < np->n_rad) {
662 pr("Not enough materials for a %s bomb in %s\n",
663 np->n_name, xyas(sp->sct_x, sp->sct_y, player->cnum));
664 pr("(%d hcm, %d lcm, %d oil, & %d rads).\n",
665 np->n_hcm, np->n_lcm, np->n_oil, np->n_rad);
668 if (cash < np->n_cost) {
669 pr("You need $%d, you only have %d.\n", np->n_cost, cash);
672 avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
674 * XXX when nukes turn into units (or whatever), then
675 * make them start at 20%. Since they don't have efficiency
676 * now, we charge all the work right away.
678 if (sp->sct_avail < avail) {
679 pr("Not enough available work in %s to build a %s;\n",
680 xyas(sp->sct_x, sp->sct_y, player->cnum), np->n_name);
681 pr(" (%d available work required)\n", avail);
684 if (!trechk(player->cnum, 0, NEWNUK))
686 if (!check_sect_ok(sp))
688 sp->sct_avail -= avail;
689 player->dolcost += np->n_cost;
691 nuk_add(sp->sct_x, sp->sct_y, np - nchr, 1);
692 vec[I_HCM] -= np->n_hcm;
693 vec[I_LCM] -= np->n_lcm;
694 vec[I_OIL] -= np->n_oil;
695 vec[I_RAD] -= np->n_rad;
696 pr("%s warhead created in %s\n", np->n_name,
697 xyas(sp->sct_x, sp->sct_y, player->cnum));
702 build_plane(struct sctstr *sp, struct plchrstr *pp,
703 short *vec, int tlev)
707 struct nstr_item nstr;
708 float eff = PLANE_MINEFF / 100.0;
712 mil = roundavg(((double)pp->pl_crew * eff));
713 /* Always use at least 1 mil to build a plane */
714 if (mil == 0 && pp->pl_crew > 0)
716 hcm = roundavg(((double)pp->pl_hcm * eff));
717 lcm = roundavg(((double)pp->pl_lcm * eff));
718 if (sp->sct_type != SCT_AIRPT && !player->god) {
719 pr("Planes must be built in airports.\n");
722 if (sp->sct_effic < 60 && !player->god) {
723 pr("Sector %s is not 60%% efficient.\n",
724 xyas(sp->sct_x, sp->sct_y, player->cnum));
727 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
728 pr("Not enough materials in %s\n",
729 xyas(sp->sct_x, sp->sct_y, player->cnum));
732 avail = (PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm) * PLANE_MINEFF + 99) / 100;
733 if (sp->sct_avail < avail) {
734 pr("Not enough available work in %s to build a %s\n",
735 xyas(sp->sct_x, sp->sct_y, player->cnum), pp->pl_name);
736 pr(" (%d available work required)\n", avail);
739 cost = pp->pl_cost * PLANE_MINEFF / 100;
741 pr("Not enough money left to build a %s\n", pp->pl_name);
744 if (vec[I_MILIT] < mil || (vec[I_MILIT] == 0 && pp->pl_crew > 0)) {
745 pr("Not enough military for crew in %s\n",
746 xyas(sp->sct_x, sp->sct_y, player->cnum));
749 if (!trechk(player->cnum, 0, NEWPLN))
751 if (!check_sect_ok(sp))
753 sp->sct_avail -= avail;
754 player->dolcost += cost;
756 snxtitem_all(&nstr, EF_PLANE);
758 while (nxtitem(&nstr, &plane)) {
759 if (plane.pln_own == 0) {
764 if (freeplane == 0) {
765 ef_extend(EF_PLANE, 50);
767 memset(&plane, 0, sizeof(struct plnstr));
768 plane.pln_x = sp->sct_x;
769 plane.pln_y = sp->sct_y;
770 plane.pln_own = sp->sct_own;
771 plane.pln_type = pp - plchr;
772 plane.pln_effic = PLANE_MINEFF;
773 if (opt_MOB_ACCESS) {
774 time(&plane.pln_access);
775 plane.pln_mobil = -(etu_per_update / sect_mob_neg_factor);
779 plane.pln_mission = 0;
782 plane.pln_radius = 0;
783 plane.pln_range = UCHAR_MAX; /* will be adjusted by pln_set_tech() */
784 plane.pln_range_max = plane.pln_range;
785 plane.pln_wing = ' ';
788 plane.pln_uid = nstr.cur;
789 plane.pln_nuketype = -1;
790 plane.pln_harden = 0;
792 pln_set_tech(&plane, tlev);
798 makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid, plane.pln_x,
800 putplane(plane.pln_uid, &plane);
801 pr("%s built in sector %s\n", prplane(&plane),
802 xyas(sp->sct_x, sp->sct_y, player->cnum));
807 build_tower(struct sctstr *sp, short *vec)
820 if (sp->sct_type != SCT_BSPAN) {
821 pr("Bridge towers can only be built from bridge spans.\n");
825 if (sp->sct_effic < 60 && !player->god) {
826 pr("Sector %s is not 60%% efficient.\n",
827 xyas(sp->sct_x, sp->sct_y, player->cnum));
831 if (vec[I_HCM] < buil_tower_bh) {
832 pr("%s only has %d unit%s of hcm,\n",
833 xyas(sp->sct_x, sp->sct_y, player->cnum),
834 vec[I_HCM], vec[I_HCM] > 1 ? "s" : "");
835 pr("(a bridge tower requires %d)\n", buil_tower_bh);
839 if (cash < buil_tower_bc) {
840 pr("A bridge tower costs $%.2f to build; ", buil_tower_bc);
841 pr("you only have %d.\n", cash);
844 avail = (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100;
845 if (sp->sct_avail < avail) {
846 pr("Not enough available work in %s to build a bridge tower\n",
847 xyas(sp->sct_x, sp->sct_y, player->cnum));
848 pr(" (%d available work required)\n", avail);
851 if (!player->argp[3]) {
852 pr("Building from %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
853 nav_map(sp->sct_x, sp->sct_y, 1);
855 if (!(p = getstarg(player->argp[3], "build tower in what direction? ", buf))
859 /* Sanity check time */
860 if (!check_sect_ok(sp))
863 if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
864 pr("'%c' is not a valid direction...\n", *p);
868 newx = sp->sct_x + diroff[val][0];
869 newy = sp->sct_y + diroff[val][1];
870 if (getsect(newx, newy, §) == 0 || sect.sct_type != SCT_WATER) {
871 pr("%s is not a water sector\n", xyas(newx, newy, player->cnum));
875 /* Now, check. You aren't allowed to build bridge towers
878 for (i = 1; i <= 6; i++) {
880 nx = sect.sct_x + diroff[i][0];
881 ny = sect.sct_y + diroff[i][1];
882 getsect(nx, ny, &s2);
883 if ((s2.sct_type != SCT_WATER) &&
884 (s2.sct_type != SCT_BTOWER) && (s2.sct_type != SCT_BSPAN)) {
890 pr("Bridge towers cannot be built adjacent to land.\n");
891 pr("That sector is adjacent to land.\n");
895 sp->sct_avail -= avail;
896 player->dolcost += buil_tower_bc;
897 cash -= buil_tower_bc;
898 sect.sct_type = SCT_BTOWER;
899 sect.sct_newtype = SCT_BTOWER;
900 sect.sct_effic = SCT_MINEFF;
903 sect.sct_defense = 0;
904 if (opt_MOB_ACCESS) {
905 time(§.sct_access);
906 sect.sct_mobil = -(etu_per_update / sect_mob_neg_factor);
910 if (!opt_DEFENSE_INFRA)
911 sect.sct_defense = sect.sct_effic;
913 map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BTOWER].d_mnem, 2);
914 writemap(player->cnum);
916 pr("Bridge tower built in %s\n",
917 xyas(sect.sct_x, sect.sct_y, player->cnum));
918 vec[I_HCM] -= buil_tower_bh;