/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
#include <config.h>
#include <limits.h>
-#include <string.h>
-#include "misc.h"
-#include "player.h"
-#include "plague.h"
-#include "sect.h"
-#include "nat.h"
-#include "ship.h"
+#include "commands.h"
#include "land.h"
+#include "lost.h"
+#include "map.h"
#include "nuke.h"
+#include "optlist.h"
+#include "path.h"
+#include "plague.h"
#include "plane.h"
-#include "xy.h"
-#include "nsc.h"
+#include "ship.h"
#include "treaty.h"
-#include "file.h"
-#include "path.h"
-#include "optlist.h"
-#include "commands.h"
static int build_nuke(struct sctstr *sp,
struct nchrstr *np, short *vec, int tlev);
p = getstarg(player->argp[3], "Plane type? ", buf);
if (p == 0 || *p == 0)
return RET_SYN;
- type = typematch(p, EF_PLANE);
+ type = ef_elt_byname(EF_PLANE_CHR, p);
if (type >= 0) {
pp = &plchr[type];
rqtech = pp->pl_tech;
p = getstarg(player->argp[3], "Ship type? ", buf);
if (p == 0 || *p == 0)
return RET_SYN;
- type = typematch(p, EF_SHIP);
+ type = ef_elt_byname(EF_SHIP_CHR, p);
if (type >= 0) {
mp = &mchr[type];
rqtech = mp->m_tech;
p = getstarg(player->argp[3], "Land unit type? ", buf);
if (p == 0 || *p == 0)
return RET_SYN;
- type = typematch(p, EF_LAND);
+ type = ef_elt_byname(EF_LAND_CHR, p);
if (type >= 0) {
lp = &lchr[type];
rqtech = lp->l_tech;
p = getstarg(player->argp[3], "Nuke type? ", buf);
if (p == 0 || *p == 0)
return RET_SYN;
- type = typematch(p, EF_NUKE);
+ type = ef_elt_byname(EF_NUKE_CHR, p);
if (type >= 0) {
np = &nchr[type];
rqtech = np->n_tech;
struct nstr_item nstr;
int avail, i;
double cost;
- float eff = SHIP_MINEFF / 100.0;
+ double eff = SHIP_MINEFF / 100.0;
int lcm, hcm;
int freeship = 0;
- hcm = roundavg((double)mp->m_hcm * eff);
- lcm = roundavg((double)mp->m_lcm * eff);
+ hcm = roundavg(mp->m_hcm * eff);
+ lcm = roundavg(mp->m_lcm * eff);
if (sp->sct_type != SCT_HARBR) {
pr("Ships must be built in harbours.\n");
ship.shp_nland = 0;
ship.shp_nxlight = 0;
ship.shp_nchoppers = 0;
- ship.shp_fleet = ' ';
+ ship.shp_fleet = 0;
memset(ship.shp_item, 0, sizeof(ship.shp_item));
ship.shp_pstage = PLG_HEALTHY;
ship.shp_ptime = 0;
if (sp->sct_pstage == PLG_INFECT)
ship.shp_pstage = PLG_EXPOSED;
- makenotlost(EF_SHIP, ship.shp_own, ship.shp_uid, ship.shp_x,
- ship.shp_y);
+ makenotlost(EF_SHIP, ship.shp_own, ship.shp_uid,
+ ship.shp_x, ship.shp_y);
putship(ship.shp_uid, &ship);
pr("%s", prship(&ship));
pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
struct nstr_item nstr;
int avail;
double cost;
- float eff = LAND_MINEFF / 100.0;
+ double eff = LAND_MINEFF / 100.0;
int mil, lcm, hcm, gun, shell;
int freeland = 0;
#if 0
- mil = roundavg(((double)lp->l_mil * eff));
- shell = roundavg(((double)lp->l_shell * eff));
- gun = roundavg(((double)lp->l_gun * eff));
+ mil = roundavg(lp->l_mil * eff);
+ shell = roundavg(lp->l_shell * eff);
+ gun = roundavg(lp->l_gun * eff);
#else
mil = shell = gun = 0;
#endif
- hcm = roundavg(((double)lp->l_hcm * eff));
- lcm = roundavg(((double)lp->l_lcm * eff));
+ hcm = roundavg(lp->l_hcm * eff);
+ lcm = roundavg(lp->l_lcm * eff);
if (sp->sct_type != SCT_HEADQ) {
pr("Land Units must be built in headquarters.\n");
land.lnd_mobil = 0;
}
land.lnd_uid = nstr.cur;
- land.lnd_army = ' ';
+ land.lnd_army = 0;
land.lnd_flags = 0;
land.lnd_ship = -1;
land.lnd_land = -1;
if (sp->sct_pstage == PLG_INFECT)
land.lnd_pstage = PLG_EXPOSED;
putland(nstr.cur, &land);
- makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
- land.lnd_y);
+ makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
+ land.lnd_x, land.lnd_y);
pr("%s", prland(&land));
pr(" built in sector %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
return 1;
sect.sct_road = 0;
sect.sct_rail = 0;
sect.sct_defense = 0;
- if (!opt_DEFENSE_INFRA)
- sect.sct_defense = sect.sct_effic;
if (opt_MOB_ACCESS) {
time(§.sct_access);
sect.sct_mobil = -(etu_per_update / sect_mob_neg_factor);
nuke.nuk_own = sp->sct_own;
nuke.nuk_type = np - nchr;
nuke.nuk_effic = 100;
- nuke.nuk_stockpile = ' ';
+ nuke.nuk_stockpile = 0;
nuke.nuk_ship = nuke.nuk_plane = nuke.nuk_land = -1;
nuke.nuk_uid = nstr.cur;
nuke.nuk_tech = tlev;
struct nstr_item nstr;
int avail;
double cost;
- float eff = PLANE_MINEFF / 100.0;
+ double eff = PLANE_MINEFF / 100.0;
int hcm, lcm, mil;
int freeplane;
- mil = roundavg(((double)pp->pl_crew * eff));
+ mil = roundavg(pp->pl_crew * eff);
/* Always use at least 1 mil to build a plane */
if (mil == 0 && pp->pl_crew > 0)
mil = 1;
- hcm = roundavg(((double)pp->pl_hcm * eff));
- lcm = roundavg(((double)pp->pl_lcm * eff));
+ hcm = roundavg(pp->pl_hcm * eff);
+ lcm = roundavg(pp->pl_lcm * eff);
if (sp->sct_type != SCT_AIRPT && !player->god) {
pr("Planes must be built in airports.\n");
return 0;
plane.pln_radius = 0;
plane.pln_range = UCHAR_MAX; /* will be adjusted by pln_set_tech() */
plane.pln_range_max = plane.pln_range;
- plane.pln_wing = ' ';
+ plane.pln_wing = 0;
plane.pln_ship = -1;
plane.pln_land = -1;
plane.pln_uid = nstr.cur;
vec[I_HCM] -= hcm;
vec[I_MILIT] -= mil;
- makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid, plane.pln_x,
- plane.pln_y);
+ makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
+ plane.pln_x, plane.pln_y);
putplane(plane.pln_uid, &plane);
pr("%s built in sector %s\n", prplane(&plane),
xyas(sp->sct_x, sp->sct_y, player->cnum));
} else {
sect.sct_mobil = 0;
}
- if (!opt_DEFENSE_INFRA)
- sect.sct_defense = sect.sct_effic;
sect.sct_mines = 0;
map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BTOWER].d_mnem, 2);
writemap(player->cnum);