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-2006
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,
69 static int build_can_afford(double, char *);
72 * build <WHAT> <SECTS> <TYPE|DIR|MEG> [NUMBER]
78 struct nstr_sect nstr;
95 natp = getnatp(player->cnum);
97 getstarg(player->argp[1],
98 "Build (ship, nuke, bridge, plane, land unit, tower)? ",
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",
130 p = getstarg(player->argp[3], "Ship type? ", buf);
131 if (p == 0 || *p == 0)
133 type = typematch(p, EF_SHIP);
139 if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
143 pr("You can't build that!\n");
144 pr("Use `show ship build %d' to show types you can build.\n",
150 p = getstarg(player->argp[3], "Land unit type? ", buf);
151 if (p == 0 || *p == 0)
153 type = typematch(p, EF_LAND);
159 if ((lp->l_flags & L_SPY) && !opt_LANDSPIES)
163 pr("You can't build that!\n");
164 pr("Use `show land build %d' to show types you can build.\n",
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",
215 pr("You can't build that!\n");
220 if (what != 'b' && what != 't') {
221 if (player->argp[4]) {
222 number = atoi(player->argp[4]);
226 "Are you sure that you want to build %s of them? ",
228 p = getstarg(player->argp[6], bstr, buf);
229 if (p == 0 || *p != 'y')
235 if (what != 'b' && what != 'n' && what != 't') {
236 if (player->argp[5]) {
237 tlev = atoi(player->argp[5]);
238 if (tlev > natp->nat_level[NAT_TLEV] && !player->god) {
239 pr("Your tech level is only %d.\n",
240 (int)natp->nat_level[NAT_TLEV]);
244 pr("Required tech is %d.\n", rqtech);
247 pr("building with tech level %d.\n", tlev);
251 while (number-- > 0) {
252 while (nxtsct(&nstr, §)) {
258 built = build_land(§, lp, sect.sct_item, tlev);
261 built = build_ship(§, mp, sect.sct_item, tlev);
264 built = build_bridge(§, sect.sct_item);
267 built = build_tower(§, sect.sct_item);
270 built = build_nuke(§, np, sect.sct_item);
273 built = build_plane(§, pp, sect.sct_item, tlev);
283 snxtsct_rewind(&nstr);
286 pr("Bad sector specification.\n");
292 build_ship(struct sctstr *sp, struct mchrstr *mp,
293 short *vec, int tlev)
296 struct nstr_item nstr;
299 float eff = SHIP_MINEFF / 100.0;
303 hcm = roundavg((double)mp->m_hcm * eff);
304 lcm = roundavg((double)mp->m_lcm * eff);
306 if (sp->sct_type != SCT_HARBR) {
307 pr("Ships must be built in harbours.\n");
310 if (sp->sct_effic < 60 && !player->god) {
311 pr("Sector %s is not 60%% efficient.\n",
312 xyas(sp->sct_x, sp->sct_y, player->cnum));
315 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
316 pr("Not enough materials in %s\n",
317 xyas(sp->sct_x, sp->sct_y, player->cnum));
320 avail = (SHP_BLD_WORK(mp->m_lcm, mp->m_hcm) * SHIP_MINEFF + 99) / 100;
321 if (sp->sct_avail < avail) {
322 pr("Not enough available work in %s to build a %s\n",
323 xyas(sp->sct_x, sp->sct_y, player->cnum), mp->m_name);
324 pr(" (%d available work required)\n", avail);
327 cost = mp->m_cost * SHIP_MINEFF / 100.0;
328 if (!build_can_afford(cost, mp->m_name))
330 if (!trechk(player->cnum, 0, NEWSHP))
332 if (!check_sect_ok(sp))
334 sp->sct_avail -= avail;
335 player->dolcost += cost;
336 snxtitem_all(&nstr, EF_SHIP);
337 while (nxtitem(&nstr, &ship)) {
338 if (ship.shp_own == 0) {
344 ef_extend(EF_SHIP, 50);
346 memset(&ship, 0, sizeof(struct shpstr));
347 ship.shp_x = sp->sct_x;
348 ship.shp_y = sp->sct_y;
349 ship.shp_destx[0] = sp->sct_x;
350 ship.shp_desty[0] = sp->sct_y;
351 ship.shp_destx[1] = sp->sct_x;
352 ship.shp_desty[1] = sp->sct_y;
353 ship.shp_autonav = 0;
354 /* new code for autonav, Chad Zabel 1-15-94 */
355 for (i = 0; i < TMAX; ++i) {
356 ship.shp_tstart[i] = I_NONE;
357 ship.shp_tend[i] = I_NONE;
358 ship.shp_lstart[i] = 0;
359 ship.shp_lend[i] = 0;
361 ship.shp_mission = 0;
362 ship.shp_own = player->cnum;
363 ship.shp_type = mp - mchr;
364 ship.shp_effic = SHIP_MINEFF;
365 if (opt_MOB_ACCESS) {
366 time(&ship.shp_access);
367 ship.shp_mobil = -(etu_per_update / sect_mob_neg_factor);
371 ship.shp_uid = nstr.cur;
374 ship.shp_nxlight = 0;
375 ship.shp_nchoppers = 0;
376 ship.shp_fleet = ' ';
377 memset(ship.shp_item, 0, sizeof(ship.shp_item));
378 ship.shp_pstage = PLG_HEALTHY;
380 ship.shp_mobquota = 0;
382 ship.shp_follow = nstr.cur;
383 ship.shp_name[0] = 0;
384 ship.shp_orig_own = player->cnum;
385 ship.shp_orig_x = sp->sct_x;
386 ship.shp_orig_y = sp->sct_y;
387 ship.shp_fuel = mchr[(int)ship.shp_type].m_fuelc;
389 memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
390 shp_set_tech(&ship, tlev);
395 if (sp->sct_pstage == PLG_INFECT)
396 ship.shp_pstage = PLG_EXPOSED;
397 makenotlost(EF_SHIP, ship.shp_own, ship.shp_uid, ship.shp_x,
399 putship(ship.shp_uid, &ship);
400 pr("%s", prship(&ship));
401 pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
406 build_land(struct sctstr *sp, struct lchrstr *lp,
407 short *vec, int tlev)
410 struct nstr_item nstr;
413 float eff = LAND_MINEFF / 100.0;
414 int mil, lcm, hcm, gun, shell;
418 mil = roundavg(((double)lp->l_mil * eff));
419 shell = roundavg(((double)lp->l_shell * eff));
420 gun = roundavg(((double)lp->l_gun * eff));
422 mil = shell = gun = 0;
424 hcm = roundavg(((double)lp->l_hcm * eff));
425 lcm = roundavg(((double)lp->l_lcm * eff));
427 if (sp->sct_type != SCT_HEADQ) {
428 pr("Land Units must be built in headquarters.\n");
431 if (sp->sct_effic < 60 && !player->god) {
432 pr("Sector %s is not 60%% efficient.\n",
433 xyas(sp->sct_x, sp->sct_y, player->cnum));
436 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
437 pr("Not enough materials in %s\n",
438 xyas(sp->sct_x, sp->sct_y, player->cnum));
442 if (vec[I_GUN] < gun || vec[I_GUN] == 0) {
443 pr("Not enough guns in %s\n",
444 xyas(sp->sct_x, sp->sct_y, player->cnum));
447 if (vec[I_SHELL] < shell) {
448 pr("Not enough shells in %s\n",
449 xyas(sp->sct_x, sp->sct_y, player->cnum));
452 if (vec[I_MILIT] < mil) {
453 pr("Not enough military in %s\n",
454 xyas(sp->sct_x, sp->sct_y, player->cnum));
458 if (!trechk(player->cnum, 0, NEWLND))
460 if (!check_sect_ok(sp))
462 avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * LAND_MINEFF + 99) / 100;
463 if (sp->sct_avail < avail) {
464 pr("Not enough available work in %s to build a %s\n",
465 xyas(sp->sct_x, sp->sct_y, player->cnum), lp->l_name);
466 pr(" (%d available work required)\n", avail);
469 cost = lp->l_cost * LAND_MINEFF / 100.0;
470 if (!build_can_afford(cost, lp->l_name))
472 sp->sct_avail -= avail;
473 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 (!build_can_afford(buil_bc, dchr[SCT_BSPAN].d_name))
567 avail = (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100;
568 if (sp->sct_avail < avail) {
569 pr("Not enough available work in %s to build a bridge\n",
570 xyas(sp->sct_x, sp->sct_y, player->cnum));
571 pr(" (%d available work required)\n", avail);
574 if (!player->argp[3]) {
575 pr("Bridge head at %s\n",
576 xyas(sp->sct_x, sp->sct_y, player->cnum));
577 nav_map(sp->sct_x, sp->sct_y, 1);
579 p = getstarg(player->argp[3], "build span in what direction? ", buf);
583 /* Sanity check time */
584 if (!check_sect_ok(sp))
587 if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
588 pr("'%c' is not a valid direction...\n", *p);
592 newx = sp->sct_x + diroff[val][0];
593 newy = sp->sct_y + diroff[val][1];
594 if (getsect(newx, newy, §) == 0 || sect.sct_type != SCT_WATER) {
595 pr("%s is not a water sector\n", xyas(newx, newy, player->cnum));
598 if (opt_EASY_BRIDGES) {
601 for (i = 1; i <= 6; i++) {
603 nx = sect.sct_x + diroff[i][0];
604 ny = sect.sct_y + diroff[i][1];
605 getsect(nx, ny, &s2);
606 if ((s2.sct_type != SCT_WATER) && (s2.sct_type != SCT_BSPAN))
610 pr("Bridges must be built adjacent to land or bridge towers.\n");
611 pr("That sector is not adjacent to land or a bridge tower.\n");
614 } /* end EASY_BRIDGES */
615 sp->sct_avail -= avail;
616 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 (!build_can_afford(np->n_cost, np->n_name))
666 avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
668 * XXX when nukes turn into units (or whatever), then
669 * make them start at 20%. Since they don't have efficiency
670 * now, we charge all the work right away.
672 if (sp->sct_avail < avail) {
673 pr("Not enough available work in %s to build a %s;\n",
674 xyas(sp->sct_x, sp->sct_y, player->cnum), np->n_name);
675 pr(" (%d available work required)\n", avail);
678 if (!trechk(player->cnum, 0, NEWNUK))
680 if (!check_sect_ok(sp))
682 sp->sct_avail -= avail;
683 player->dolcost += np->n_cost;
684 nuk_add(sp->sct_x, sp->sct_y, np - nchr, 1);
685 vec[I_HCM] -= np->n_hcm;
686 vec[I_LCM] -= np->n_lcm;
687 vec[I_OIL] -= np->n_oil;
688 vec[I_RAD] -= np->n_rad;
689 pr("%s warhead created in %s\n", np->n_name,
690 xyas(sp->sct_x, sp->sct_y, player->cnum));
695 build_plane(struct sctstr *sp, struct plchrstr *pp,
696 short *vec, int tlev)
699 struct nstr_item nstr;
702 float eff = PLANE_MINEFF / 100.0;
706 mil = roundavg(((double)pp->pl_crew * eff));
707 /* Always use at least 1 mil to build a plane */
708 if (mil == 0 && pp->pl_crew > 0)
710 hcm = roundavg(((double)pp->pl_hcm * eff));
711 lcm = roundavg(((double)pp->pl_lcm * eff));
712 if (sp->sct_type != SCT_AIRPT && !player->god) {
713 pr("Planes must be built in airports.\n");
716 if (sp->sct_effic < 60 && !player->god) {
717 pr("Sector %s is not 60%% efficient.\n",
718 xyas(sp->sct_x, sp->sct_y, player->cnum));
721 if (vec[I_LCM] < lcm || vec[I_HCM] < hcm) {
722 pr("Not enough materials in %s\n",
723 xyas(sp->sct_x, sp->sct_y, player->cnum));
726 avail = (PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm) * PLANE_MINEFF + 99) / 100;
727 if (sp->sct_avail < avail) {
728 pr("Not enough available work in %s to build a %s\n",
729 xyas(sp->sct_x, sp->sct_y, player->cnum), pp->pl_name);
730 pr(" (%d available work required)\n", avail);
733 cost = pp->pl_cost * PLANE_MINEFF / 100.0;
734 if (!build_can_afford(cost, pp->pl_name))
736 if (vec[I_MILIT] < mil || (vec[I_MILIT] == 0 && pp->pl_crew > 0)) {
737 pr("Not enough military for crew in %s\n",
738 xyas(sp->sct_x, sp->sct_y, player->cnum));
741 if (!trechk(player->cnum, 0, NEWPLN))
743 if (!check_sect_ok(sp))
745 sp->sct_avail -= avail;
746 player->dolcost += cost;
747 snxtitem_all(&nstr, EF_PLANE);
749 while (nxtitem(&nstr, &plane)) {
750 if (plane.pln_own == 0) {
755 if (freeplane == 0) {
756 ef_extend(EF_PLANE, 50);
758 memset(&plane, 0, sizeof(struct plnstr));
759 plane.pln_x = sp->sct_x;
760 plane.pln_y = sp->sct_y;
761 plane.pln_own = sp->sct_own;
762 plane.pln_type = pp - plchr;
763 plane.pln_effic = PLANE_MINEFF;
764 if (opt_MOB_ACCESS) {
765 time(&plane.pln_access);
766 plane.pln_mobil = -(etu_per_update / sect_mob_neg_factor);
770 plane.pln_mission = 0;
773 plane.pln_radius = 0;
774 plane.pln_range = UCHAR_MAX; /* will be adjusted by pln_set_tech() */
775 plane.pln_range_max = plane.pln_range;
776 plane.pln_wing = ' ';
779 plane.pln_uid = nstr.cur;
780 plane.pln_nuketype = -1;
781 plane.pln_harden = 0;
783 pln_set_tech(&plane, tlev);
789 makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid, plane.pln_x,
791 putplane(plane.pln_uid, &plane);
792 pr("%s built in sector %s\n", prplane(&plane),
793 xyas(sp->sct_x, sp->sct_y, player->cnum));
798 build_tower(struct sctstr *sp, short *vec)
811 if (sp->sct_type != SCT_BSPAN) {
812 pr("Bridge towers can only be built from bridge spans.\n");
816 if (sp->sct_effic < 60 && !player->god) {
817 pr("Sector %s is not 60%% efficient.\n",
818 xyas(sp->sct_x, sp->sct_y, player->cnum));
822 if (vec[I_HCM] < buil_tower_bh) {
823 pr("%s only has %d unit%s of hcm,\n",
824 xyas(sp->sct_x, sp->sct_y, player->cnum),
825 vec[I_HCM], vec[I_HCM] > 1 ? "s" : "");
826 pr("(a bridge tower requires %d)\n", buil_tower_bh);
830 if (!build_can_afford(buil_tower_bc, dchr[SCT_BTOWER].d_name))
832 avail = (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100;
833 if (sp->sct_avail < avail) {
834 pr("Not enough available work in %s to build a bridge tower\n",
835 xyas(sp->sct_x, sp->sct_y, player->cnum));
836 pr(" (%d available work required)\n", avail);
839 if (!player->argp[3]) {
840 pr("Building from %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
841 nav_map(sp->sct_x, sp->sct_y, 1);
843 p = getstarg(player->argp[3], "build tower in what direction? ", buf);
847 /* Sanity check time */
848 if (!check_sect_ok(sp))
851 if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
852 pr("'%c' is not a valid direction...\n", *p);
856 newx = sp->sct_x + diroff[val][0];
857 newy = sp->sct_y + diroff[val][1];
858 if (getsect(newx, newy, §) == 0 || sect.sct_type != SCT_WATER) {
859 pr("%s is not a water sector\n", xyas(newx, newy, player->cnum));
863 /* Now, check. You aren't allowed to build bridge towers
866 for (i = 1; i <= 6; i++) {
868 nx = sect.sct_x + diroff[i][0];
869 ny = sect.sct_y + diroff[i][1];
870 getsect(nx, ny, &s2);
871 if ((s2.sct_type != SCT_WATER) &&
872 (s2.sct_type != SCT_BTOWER) && (s2.sct_type != SCT_BSPAN)) {
878 pr("Bridge towers cannot be built adjacent to land.\n");
879 pr("That sector is adjacent to land.\n");
883 sp->sct_avail -= avail;
884 player->dolcost += buil_tower_bc;
885 sect.sct_type = SCT_BTOWER;
886 sect.sct_newtype = SCT_BTOWER;
887 sect.sct_effic = SCT_MINEFF;
890 sect.sct_defense = 0;
891 if (opt_MOB_ACCESS) {
892 time(§.sct_access);
893 sect.sct_mobil = -(etu_per_update / sect_mob_neg_factor);
897 if (!opt_DEFENSE_INFRA)
898 sect.sct_defense = sect.sct_effic;
900 map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BTOWER].d_mnem, 2);
901 writemap(player->cnum);
903 pr("Bridge tower built in %s\n",
904 xyas(sect.sct_x, sect.sct_y, player->cnum));
905 vec[I_HCM] -= buil_tower_bh;
910 build_can_afford(double cost, char *what)
912 struct natstr *natp = getnatp(player->cnum);
913 if (natp->nat_money < player->dolcost + cost) {
914 pr("Not enough money left to build a %s\n", what);