2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2005, 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 the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * 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
53 static int build_nuke(struct sctstr *sp,
54 struct nchrstr *np, short *vec);
55 static int build_ship(struct sctstr *sp,
56 struct mchrstr *mp, short *vec,
58 static int build_land(struct sctstr *sp,
59 struct lchrstr *lp, short *vec,
61 static int build_bridge(struct sctstr *sp, short *vec);
62 static int build_tower(struct sctstr *sp, short *vec);
63 static int build_plane(struct sctstr *sp,
64 struct plchrstr *pp, short *vec,
67 static int cash; /* static ok */
70 * build <WHAT> <SECTS> <TYPE|DIR|MEG> [NUMBER]
76 struct nstr_sect nstr;
94 natp = getnatp(player->cnum);
96 getstarg(player->argp[1],
97 "Build (ship, nuke, bridge, plane, land unit, tower)? ",
102 for (x = 0; x < number; x++) {
103 if (!snxtsct(&nstr, player->argp[2])) {
104 pr("Bad sector specification.\n");
107 tlev = (int)natp->nat_level[NAT_TLEV];
108 rlev = (int)natp->nat_level[NAT_RLEV];
112 p = getstarg(player->argp[3], "Plane type? ", buf);
113 if (p == 0 || *p == 0)
115 type = typematch(p, EF_PLANE);
118 rqtech = pp->pl_tech;
123 pr("You can't build that!\n");
124 pr("Use `show plane build %d' to show types you can build.\n", tlev);
129 p = getstarg(player->argp[3], "Ship type? ", buf);
130 if (p == 0 || *p == 0)
132 type = typematch(p, EF_SHIP);
138 if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
142 pr("You can't build that!\n");
143 pr("Use `show ship build %d' to show types you can build.\n", tlev);
148 p = getstarg(player->argp[3], "Land unit type? ", buf);
149 if (p == 0 || *p == 0)
151 type = typematch(p, EF_LAND);
157 if ((lp->l_flags & L_SPY) && !opt_LANDSPIES)
161 pr("You can't build that!\n");
162 pr("Use `show land build %d' to show types you can build.\n", tlev);
167 if (natp->nat_level[NAT_TLEV] + 0.005 < buil_bt) {
168 pr("Building a span requires a tech of %.0f\n", buil_bt);
173 if (!opt_BRIDGETOWERS) {
174 pr("Bridge tower building is disabled.\n");
177 if (natp->nat_level[NAT_TLEV] + 0.005 < buil_tower_bt) {
178 pr("Building a tower requires a tech of %.0f\n",
184 if (!ef_nelem(EF_NUKE_CHR)) {
185 pr("There are no nukes in this game.\n");
188 p = getstarg(player->argp[3], "Nuke type? ", buf);
189 if (p == 0 || *p == 0)
191 type = typematch(p, EF_NUKE);
196 || (opt_DRNUKE && np->n_tech * drnuke_const > rlev))
202 tt = (tlev < (rlev / drnuke_const) ? (int)tlev :
203 (int)(rlev / drnuke_const));
204 pr("You can't build that!\n");
205 pr("Use `show nuke build %d' to show types you can build.\n", tlev);
210 pr("You can't build that!\n");
213 if (what != 'b' && what != 't') {
214 if (player->argp[4]) {
215 if (atoi(player->argp[4]) > 20 && !asked) {
219 "Are you sure that you want to build %s of them? ",
221 p = getstarg(player->argp[6], bstr, buf);
222 if (p == 0 || *p != 'y')
225 number = atoi(player->argp[4]);
228 if (what != 'b' && what != 'n' && what != 't') {
229 if (player->argp[5]) {
230 tlev = atoi(player->argp[5]);
231 if (tlev > natp->nat_level[NAT_TLEV] && !player->god) {
232 pr("Your tech level is only %d.\n",
233 (int)natp->nat_level[NAT_TLEV]);
237 pr("Required tech is %d.\n", rqtech);
240 pr("building with tech level %d.\n", tlev);
242 tlev = (int)natp->nat_level[NAT_TLEV];
244 cash = natp->nat_money;
245 while (nxtsct(&nstr, §)) {
251 built = build_land(§, lp, sect.sct_item, tlev);
254 built = build_ship(§, mp, sect.sct_item, tlev);
257 built = build_bridge(§, sect.sct_item);
260 built = build_tower(§, sect.sct_item);
263 built = build_nuke(§, np, sect.sct_item);
266 built = build_plane(§, pp, sect.sct_item, tlev);
269 CANT_HAPPEN("Bad WHAT");
278 pr("Bad sector specification.\n");
284 build_ship(struct sctstr *sp, struct mchrstr *mp,
285 short *vec, int tlev)
288 struct nstr_item nstr;
290 float eff = SHIP_MINEFF / 100.0;
294 hcm = roundavg((double)mp->m_hcm * eff);
295 lcm = roundavg((double)mp->m_lcm * eff);
297 if (sp->sct_type != SCT_HARBR) {
298 pr("Ships must be built in harbours.\n");
301 if (sp->sct_effic < 60 && !player->god) {
302 pr("Sector %s is not 60%% efficient.\n",
303 xyas(sp->sct_x, sp->sct_y, player->cnum));
306 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
307 pr("Not enough materials in %s\n",
308 xyas(sp->sct_x, sp->sct_y, player->cnum));
311 avail = (SHP_BLD_WORK(mp->m_lcm, mp->m_hcm) * SHIP_MINEFF + 99) / 100;
312 if (sp->sct_avail < avail) {
313 pr("Not enough available work in %s to build a %s\n",
314 xyas(sp->sct_x, sp->sct_y, player->cnum), mp->m_name);
315 pr(" (%d available work required)\n", avail);
318 cost = mp->m_cost * SHIP_MINEFF / 100;
320 pr("Not enough money left to build a %s\n", mp->m_name);
323 if (!trechk(player->cnum, 0, NEWSHP))
325 if (!check_sect_ok(sp))
327 sp->sct_avail -= avail;
328 player->dolcost += cost;
330 snxtitem_all(&nstr, EF_SHIP);
331 while (nxtitem(&nstr, &ship)) {
332 if (ship.shp_own == 0) {
338 ef_extend(EF_SHIP, 50);
340 memset(&ship, 0, sizeof(struct shpstr));
341 ship.shp_x = sp->sct_x;
342 ship.shp_y = sp->sct_y;
343 ship.shp_destx[0] = sp->sct_x;
344 ship.shp_desty[0] = sp->sct_y;
345 ship.shp_destx[1] = sp->sct_x;
346 ship.shp_desty[1] = sp->sct_y;
347 ship.shp_autonav = 0;
348 /* new code for autonav, Chad Zabel 1-15-94 */
349 for (i = 0; i < TMAX; ++i) {
350 ship.shp_tstart[i] = I_NONE;
351 ship.shp_tend[i] = I_NONE;
352 ship.shp_lstart[i] = 0;
353 ship.shp_lend[i] = 0;
355 ship.shp_mission = 0;
356 ship.shp_own = player->cnum;
357 ship.shp_type = mp - mchr;
358 ship.shp_effic = SHIP_MINEFF;
359 if (opt_MOB_ACCESS) {
360 time(&ship.shp_access);
361 ship.shp_mobil = -(etu_per_update / sect_mob_neg_factor);
365 ship.shp_uid = nstr.cur;
368 ship.shp_nxlight = 0;
369 ship.shp_nchoppers = 0;
370 ship.shp_fleet = ' ';
371 memset(ship.shp_item, 0, sizeof(ship.shp_item));
372 ship.shp_pstage = PLG_HEALTHY;
374 ship.shp_mobquota = 0;
376 ship.shp_follow = nstr.cur;
377 ship.shp_name[0] = 0;
378 ship.shp_orig_own = player->cnum;
379 ship.shp_orig_x = sp->sct_x;
380 ship.shp_orig_y = sp->sct_y;
381 ship.shp_fuel = mchr[(int)ship.shp_type].m_fuelc;
383 memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
384 shp_set_tech(&ship, tlev);
389 if (sp->sct_pstage == PLG_INFECT)
390 ship.shp_pstage = PLG_EXPOSED;
391 makenotlost(EF_SHIP, ship.shp_own, ship.shp_uid, ship.shp_x,
393 putship(ship.shp_uid, &ship);
394 pr("%s", prship(&ship));
395 pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
400 build_land(struct sctstr *sp, struct lchrstr *lp,
401 short *vec, int tlev)
404 struct nstr_item nstr;
406 float eff = LAND_MINEFF / 100.0;
407 int mil, lcm, hcm, gun, shell;
411 mil = roundavg(((double)lp->l_mil * eff));
412 shell = roundavg(((double)lp->l_shell * eff));
413 gun = roundavg(((double)lp->l_gun * eff));
415 mil = shell = gun = 0;
417 hcm = roundavg(((double)lp->l_hcm * eff));
418 lcm = roundavg(((double)lp->l_lcm * eff));
420 if (sp->sct_type != SCT_HEADQ) {
421 pr("Land Units must be built in headquarters.\n");
424 if (sp->sct_effic < 60 && !player->god) {
425 pr("Sector %s is not 60%% efficient.\n",
426 xyas(sp->sct_x, sp->sct_y, player->cnum));
429 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
430 pr("Not enough materials in %s\n",
431 xyas(sp->sct_x, sp->sct_y, player->cnum));
435 if (vec[I_GUN] < gun || vec[I_GUN] == 0) {
436 pr("Not enough guns in %s\n",
437 xyas(sp->sct_x, sp->sct_y, player->cnum));
440 if (vec[I_SHELL] < shell) {
441 pr("Not enough shells in %s\n",
442 xyas(sp->sct_x, sp->sct_y, player->cnum));
445 if (vec[I_MILIT] < mil) {
446 pr("Not enough military in %s\n",
447 xyas(sp->sct_x, sp->sct_y, player->cnum));
451 if (!trechk(player->cnum, 0, NEWLND))
453 if (!check_sect_ok(sp))
455 avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * LAND_MINEFF + 99) / 100;
456 if (sp->sct_avail < avail) {
457 pr("Not enough available work in %s to build a %s\n",
458 xyas(sp->sct_x, sp->sct_y, player->cnum), lp->l_name);
459 pr(" (%d available work required)\n", avail);
462 cost = lp->l_cost * LAND_MINEFF / 100;
464 pr("Not enough money left to build a %s\n", lp->l_name);
467 sp->sct_avail -= avail;
468 player->dolcost += cost;
470 snxtitem_all(&nstr, EF_LAND);
471 while (nxtitem(&nstr, &land)) {
472 if (land.lnd_own == 0) {
478 ef_extend(EF_LAND, 50);
480 memset(&land, 0, sizeof(struct lndstr));
481 land.lnd_x = sp->sct_x;
482 land.lnd_y = sp->sct_y;
483 land.lnd_own = player->cnum;
484 land.lnd_mission = 0;
485 land.lnd_type = lp - lchr;
486 land.lnd_effic = LAND_MINEFF;
487 if (opt_MOB_ACCESS) {
488 time(&land.lnd_access);
489 land.lnd_mobil = -(etu_per_update / sect_mob_neg_factor);
493 land.lnd_uid = nstr.cur;
500 land.lnd_retreat = morale_base;
501 land.lnd_fuel = lp->l_fuelc;
502 land.lnd_nxlight = 0;
504 memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
505 land.lnd_rad_max = 0;
506 memset(land.lnd_item, 0, sizeof(land.lnd_item));
507 land.lnd_pstage = PLG_HEALTHY;
509 lnd_set_tech(&land, tlev);
515 vec[I_SHELL] -= shell;
517 if (sp->sct_pstage == PLG_INFECT)
518 land.lnd_pstage = PLG_EXPOSED;
519 putland(nstr.cur, &land);
520 makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
522 pr("%s", prland(&land));
523 pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
528 build_bridge(struct sctstr *sp, short *vec)
534 int nx, ny, i, good = 0;
538 if (opt_EASY_BRIDGES == 0) { /* must have a bridge head or tower */
539 if (sp->sct_type != SCT_BTOWER) {
540 if (sp->sct_type != SCT_BHEAD)
542 if (sp->sct_newtype != SCT_BHEAD)
547 if (sp->sct_effic < 60 && !player->god) {
548 pr("Sector %s is not 60%% efficient.\n",
549 xyas(sp->sct_x, sp->sct_y, player->cnum));
553 if (vec[I_HCM] < buil_bh) {
554 pr("%s only has %d unit%s of hcm,\n",
555 xyas(sp->sct_x, sp->sct_y, player->cnum),
556 vec[I_HCM], vec[I_HCM] > 1 ? "s" : "");
557 pr("(a bridge span requires %d)\n", buil_bh);
561 if (cash < buil_bc) {
562 pr("A span costs $%.2f to build; ", buil_bc);
563 pr("you only have %d.\n", cash);
566 avail = (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100;
567 if (sp->sct_avail < avail) {
568 pr("Not enough available work in %s to build a bridge\n",
569 xyas(sp->sct_x, sp->sct_y, player->cnum));
570 pr(" (%d available work required)\n", avail);
573 if (!player->argp[3]) {
574 pr("Bridge head at %s\n",
575 xyas(sp->sct_x, sp->sct_y, player->cnum));
576 nav_map(sp->sct_x, sp->sct_y, 1);
578 if (!(p = getstarg(player->argp[3], "build span in what direction? ", buf))
582 /* Sanity check time */
583 if (!check_sect_ok(sp))
586 if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
587 pr("'%c' is not a valid direction...\n", *p);
591 newx = sp->sct_x + diroff[val][0];
592 newy = sp->sct_y + diroff[val][1];
593 if (getsect(newx, newy, §) == 0 || sect.sct_type != SCT_WATER) {
594 pr("%s is not a water sector\n", xyas(newx, newy, player->cnum));
597 if (opt_EASY_BRIDGES) {
600 for (i = 1; i <= 6; i++) {
602 nx = sect.sct_x + diroff[i][0];
603 ny = sect.sct_y + diroff[i][1];
604 getsect(nx, ny, &s2);
605 if ((s2.sct_type != SCT_WATER) && (s2.sct_type != SCT_BSPAN))
609 pr("Bridges must be built adjacent to land or bridge towers.\n");
610 pr("That sector is not adjacent to land or a bridge tower.\n");
613 } /* end EASY_BRIDGES */
614 sp->sct_avail -= avail;
615 player->dolcost += buil_bc;
617 sect.sct_type = SCT_BSPAN;
618 sect.sct_newtype = SCT_BSPAN;
619 sect.sct_effic = SCT_MINEFF;
622 sect.sct_defense = 0;
623 if (!opt_DEFENSE_INFRA)
624 sect.sct_defense = sect.sct_effic;
625 if (opt_MOB_ACCESS) {
626 time(§.sct_access);
627 sect.sct_mobil = -(etu_per_update / sect_mob_neg_factor);
632 map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BSPAN].d_mnem, 2);
633 writemap(player->cnum);
635 pr("Bridge span built over %s\n",
636 xyas(sect.sct_x, sect.sct_y, player->cnum));
637 vec[I_HCM] -= buil_bh;
642 build_nuke(struct sctstr *sp, struct nchrstr *np,
647 if (sp->sct_type != SCT_NUKE && !player->god) {
648 pr("Nuclear weapons must be built in nuclear plants.\n");
651 if (sp->sct_effic < 60 && !player->god) {
652 pr("Sector %s is not 60%% efficient.\n",
653 xyas(sp->sct_x, sp->sct_y, player->cnum));
656 if (vec[I_HCM] < np->n_hcm || vec[I_LCM] < np->n_lcm ||
657 vec[I_OIL] < np->n_oil || vec[I_RAD] < np->n_rad) {
658 pr("Not enough materials for a %s bomb in %s\n",
659 np->n_name, xyas(sp->sct_x, sp->sct_y, player->cnum));
660 pr("(%d hcm, %d lcm, %d oil, & %d rads).\n",
661 np->n_hcm, np->n_lcm, np->n_oil, np->n_rad);
664 if (cash < np->n_cost) {
665 pr("You need $%d, you only have %d.\n", np->n_cost, cash);
668 avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
670 * XXX when nukes turn into units (or whatever), then
671 * make them start at 20%. Since they don't have efficiency
672 * now, we charge all the work right away.
674 if (sp->sct_avail < avail) {
675 pr("Not enough available work in %s to build a %s;\n",
676 xyas(sp->sct_x, sp->sct_y, player->cnum), np->n_name);
677 pr(" (%d available work required)\n", avail);
680 if (!trechk(player->cnum, 0, NEWNUK))
682 if (!check_sect_ok(sp))
684 sp->sct_avail -= avail;
685 player->dolcost += np->n_cost;
687 nuk_add(sp->sct_x, sp->sct_y, np - nchr, 1);
688 vec[I_HCM] -= np->n_hcm;
689 vec[I_LCM] -= np->n_lcm;
690 vec[I_OIL] -= np->n_oil;
691 vec[I_RAD] -= np->n_rad;
692 pr("%s warhead created in %s\n", np->n_name,
693 xyas(sp->sct_x, sp->sct_y, player->cnum));
698 build_plane(struct sctstr *sp, struct plchrstr *pp,
699 short *vec, int tlev)
703 struct nstr_item nstr;
704 float eff = PLANE_MINEFF / 100.0;
708 mil = roundavg(((double)pp->pl_crew * eff));
709 /* Always use at least 1 mil to build a plane */
710 if (mil == 0 && pp->pl_crew > 0)
712 hcm = roundavg(((double)pp->pl_hcm * eff));
713 lcm = roundavg(((double)pp->pl_lcm * eff));
714 if (sp->sct_type != SCT_AIRPT && !player->god) {
715 pr("Planes must be built in airports.\n");
718 if (sp->sct_effic < 60 && !player->god) {
719 pr("Sector %s is not 60%% efficient.\n",
720 xyas(sp->sct_x, sp->sct_y, player->cnum));
723 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
724 pr("Not enough materials in %s\n",
725 xyas(sp->sct_x, sp->sct_y, player->cnum));
728 avail = (PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm) * PLANE_MINEFF + 99) / 100;
729 if (sp->sct_avail < avail) {
730 pr("Not enough available work in %s to build a %s\n",
731 xyas(sp->sct_x, sp->sct_y, player->cnum), pp->pl_name);
732 pr(" (%d available work required)\n", avail);
735 cost = pp->pl_cost * PLANE_MINEFF / 100;
737 pr("Not enough money left to build a %s\n", pp->pl_name);
740 if (vec[I_MILIT] < mil || (vec[I_MILIT] == 0 && pp->pl_crew > 0)) {
741 pr("Not enough military for crew in %s\n",
742 xyas(sp->sct_x, sp->sct_y, player->cnum));
745 if (!trechk(player->cnum, 0, NEWPLN))
747 if (!check_sect_ok(sp))
749 sp->sct_avail -= avail;
750 player->dolcost += cost;
752 snxtitem_all(&nstr, EF_PLANE);
754 while (nxtitem(&nstr, &plane)) {
755 if (plane.pln_own == 0) {
760 if (freeplane == 0) {
761 ef_extend(EF_PLANE, 50);
763 memset(&plane, 0, sizeof(struct plnstr));
764 plane.pln_x = sp->sct_x;
765 plane.pln_y = sp->sct_y;
766 plane.pln_own = sp->sct_own;
767 plane.pln_type = pp - plchr;
768 plane.pln_effic = PLANE_MINEFF;
769 if (opt_MOB_ACCESS) {
770 time(&plane.pln_access);
771 plane.pln_mobil = -(etu_per_update / sect_mob_neg_factor);
775 plane.pln_mission = 0;
778 plane.pln_radius = 0;
779 plane.pln_range = UCHAR_MAX; /* will be adjusted by pln_set_tech() */
780 plane.pln_range_max = plane.pln_range;
781 plane.pln_wing = ' ';
784 plane.pln_uid = nstr.cur;
785 plane.pln_nuketype = -1;
786 plane.pln_harden = 0;
788 pln_set_tech(&plane, tlev);
794 makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid, plane.pln_x,
796 putplane(plane.pln_uid, &plane);
797 pr("%s built in sector %s\n", prplane(&plane),
798 xyas(sp->sct_x, sp->sct_y, player->cnum));
803 build_tower(struct sctstr *sp, short *vec)
816 if (sp->sct_type != SCT_BSPAN) {
817 pr("Bridge towers can only be built from bridge spans.\n");
821 if (sp->sct_effic < 60 && !player->god) {
822 pr("Sector %s is not 60%% efficient.\n",
823 xyas(sp->sct_x, sp->sct_y, player->cnum));
827 if (vec[I_HCM] < buil_tower_bh) {
828 pr("%s only has %d unit%s of hcm,\n",
829 xyas(sp->sct_x, sp->sct_y, player->cnum),
830 vec[I_HCM], vec[I_HCM] > 1 ? "s" : "");
831 pr("(a bridge tower requires %d)\n", buil_tower_bh);
835 if (cash < buil_tower_bc) {
836 pr("A bridge tower costs $%.2f to build; ", buil_tower_bc);
837 pr("you only have %d.\n", cash);
840 avail = (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100;
841 if (sp->sct_avail < avail) {
842 pr("Not enough available work in %s to build a bridge tower\n",
843 xyas(sp->sct_x, sp->sct_y, player->cnum));
844 pr(" (%d available work required)\n", avail);
847 if (!player->argp[3]) {
848 pr("Building from %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
849 nav_map(sp->sct_x, sp->sct_y, 1);
851 if (!(p = getstarg(player->argp[3], "build tower in what direction? ", buf))
855 /* Sanity check time */
856 if (!check_sect_ok(sp))
859 if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
860 pr("'%c' is not a valid direction...\n", *p);
864 newx = sp->sct_x + diroff[val][0];
865 newy = sp->sct_y + diroff[val][1];
866 if (getsect(newx, newy, §) == 0 || sect.sct_type != SCT_WATER) {
867 pr("%s is not a water sector\n", xyas(newx, newy, player->cnum));
871 /* Now, check. You aren't allowed to build bridge towers
874 for (i = 1; i <= 6; i++) {
876 nx = sect.sct_x + diroff[i][0];
877 ny = sect.sct_y + diroff[i][1];
878 getsect(nx, ny, &s2);
879 if ((s2.sct_type != SCT_WATER) &&
880 (s2.sct_type != SCT_BTOWER) && (s2.sct_type != SCT_BSPAN)) {
886 pr("Bridge towers cannot be built adjacent to land.\n");
887 pr("That sector is adjacent to land.\n");
891 sp->sct_avail -= avail;
892 player->dolcost += buil_tower_bc;
893 cash -= buil_tower_bc;
894 sect.sct_type = SCT_BTOWER;
895 sect.sct_newtype = SCT_BTOWER;
896 sect.sct_effic = SCT_MINEFF;
899 sect.sct_defense = 0;
900 if (opt_MOB_ACCESS) {
901 time(§.sct_access);
902 sect.sct_mobil = -(etu_per_update / sect_mob_neg_factor);
906 if (!opt_DEFENSE_INFRA)
907 sect.sct_defense = sect.sct_effic;
909 map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BTOWER].d_mnem, 2);
910 writemap(player->cnum);
912 pr("Bridge tower built in %s\n",
913 xyas(sect.sct_x, sect.sct_y, player->cnum));
914 vec[I_HCM] -= buil_tower_bh;