#endif
int
-login(int s, char *uname, char *cname, char *cpass, int kill_proc, int utf8)
+login(int s, char *uname, char *cname, char *cpass,
+ int kill_proc, int utf8)
{
char tmp[128];
char buf[1024];
return;
if (setupterm(NULL, fileno(stdout), &err) != OK) {
- fprintf(stderr, "Can't setup terminal, check environment variable TERM\n");
+ fprintf(stderr,
+ "Can't setup terminal, check environment variable TERM\n");
return;
}
pr("No available mil or mob in sector.\n");
continue;
}
- pr("Sector mobility/troop strength will allow %d troops to engage.\n", avail_mil);
+ pr("Sector mobility/troop strength will allow %d troops to engage.\n",
+ avail_mil);
if (target == player->cnum) {
amil = mil;
foundland = 1;
}
if (!foundland) {
- pr("You don't have any mobility (sector or land units) in %s!\n", xyas(off->x, off->y, player->cnum));
+ pr("You don't have any mobility (sector or land units) in %s!\n",
+ xyas(off->x, off->y, player->cnum));
return RET_SYN;
}
}
} else {
pr("splash\n");
/* Bombs that miss have to land somewhere! */
- dam = pln_damage(&plp->plane, target->sct_x, target->sct_y, 'p',
- &nukedam, 0);
+ dam = pln_damage(&plp->plane, target->sct_x, target->sct_y,
+ 'p', &nukedam, 0);
collateral_damage(target->sct_x, target->sct_y, dam, list);
dam = 0;
}
} else {
pr("thud\n");
/* Bombs that miss have to land somewhere! */
- dam = pln_damage(&plp->plane, target->sct_x, target->sct_y, 'p',
- &nukedam, 0);
+ dam = pln_damage(&plp->plane, target->sct_x, target->sct_y,
+ 'p', &nukedam, 0);
collateral_damage(target->sct_x, target->sct_y, dam, list);
dam = 0;
}
if ((plp->pcp->pl_flags & P_C) && (!(plp->pcp->pl_flags & P_T)))
continue;
if (plp->bombs || plp->plane.pln_nuketype != -1)
- dam += pln_damage(&plp->plane, target->sct_x, target->sct_y, 's',
- &nukedam, 1);
+ dam += pln_damage(&plp->plane, target->sct_x, target->sct_y,
+ 's', &nukedam, 1);
}
if (dam <= 0) /* dam == 0 if only nukes were delivered */
return;
}
if (type < 0) {
pr("You can't build that!\n");
- pr("Use `show plane build %d' to show types you can build.\n", tlev);
+ pr("Use `show plane build %d' to show types you can build.\n",
+ tlev);
return RET_FAIL;
}
break;
}
if (type < 0) {
pr("You can't build that!\n");
- pr("Use `show ship build %d' to show types you can build.\n", tlev);
+ pr("Use `show ship build %d' to show types you can build.\n",
+ tlev);
return RET_FAIL;
}
break;
}
if (type < 0) {
pr("You can't build that!\n");
- pr("Use `show land build %d' to show types you can build.\n", tlev);
+ pr("Use `show land build %d' to show types you can build.\n",
+ tlev);
return RET_FAIL;
}
break;
tt = (tlev < (rlev / drnuke_const) ? (int)tlev :
(int)(rlev / drnuke_const));
pr("You can't build that!\n");
- pr("Use `show nuke build %d' to show types you can build.\n", tt);
+ pr("Use `show nuke build %d' to show types you can build.\n",
+ tt);
return RET_FAIL;
}
break;
xyas(sp->sct_x, sp->sct_y, player->cnum));
nav_map(sp->sct_x, sp->sct_y, 1);
}
- if (!(p = getstarg(player->argp[3], "build span in what direction? ", buf))
- || !*p) {
+ p = getstarg(player->argp[3], "build span in what direction? ", buf);
+ if (!p || !*p) {
return 0;
}
/* Sanity check time */
pr("Building from %s\n", xyas(sp->sct_x, sp->sct_y, player->cnum));
nav_map(sp->sct_x, sp->sct_y, 1);
}
- if (!(p = getstarg(player->argp[3], "build tower in what direction? ", buf))
- || !*p) {
+ p = getstarg(player->argp[3], "build tower in what direction? ", buf);
+ if (!p || !*p) {
return 0;
}
/* Sanity check time */
bad = 0;
}
if (bad) {
- pr("%s has no sector with mobility adjacent to or ship in %s!\n", cname(to), xyas(sect.sct_x, sect.sct_y, player->cnum));
+ pr("%s has no sector with mobility adjacent to or ship in %s!\n",
+ cname(to), xyas(sect.sct_x, sect.sct_y, player->cnum));
continue;
}
}
if (dchr[des].d_cost < 0) {
if (for_real)
- pr("Only %s can make a %s!\n", cname(0), dchr[des].d_name);
+ pr("Only %s can make a %s!\n",
+ cname(0), dchr[des].d_name);
continue;
}
}
amount - left, ip->i_name, left, ip->i_name,
xyas(endsect.sct_x, endsect.sct_y, player->cnum));
} else {
- pr("All of the %s you were exploring with were destroyed!\n", ip->i_name);
+ pr("All of the %s you were exploring with were destroyed!\n",
+ ip->i_name);
}
amount = left;
}
continue;
}
if (land.lnd_land >= 0) {
- pr("%s is on a land unit and can't be fortified\n", prland(&land));
+ pr("%s is on a land unit and can't be fortified\n",
+ prland(&land));
continue;
}
pp->pln_x = sx;
pp->pln_y = sy;
pp->pln_flags |= PLN_LAUNCHED;
- pp->pln_mobil = (pp->pln_mobil > dist) ? (pp->pln_mobil - dist) : 0;
+ pp->pln_mobil = pp->pln_mobil > dist ? pp->pln_mobil - dist : 0;
putplane(pp->pln_uid, pp);
- pr(", will be ready for use in %d time units\n", plane_mob_max - pp->pln_mobil);
+ pr(", will be ready for use in %d time units\n",
+ plane_mob_max - pp->pln_mobil);
return RET_OK;
}
(sp->shp_nland >= mchr[(int)sp->shp_type].m_nland)) {
if (noisy) {
if (mchr[(int)sp->shp_type].m_nland)
- pr("%s doesn't have room for any more land units!\n", prship(sp));
+ pr("%s doesn't have room for any more land units!\n",
+ prship(sp));
else
pr("%s cannot carry land units!\n", prship(sp));
}
if (lp->lnd_nland >= lp->lnd_maxland) {
if (noisy) {
if (lp->lnd_nland)
- pr("%s doesn't have room for any more land units!\n", prland(lp));
+ pr("%s doesn't have room for any more land units!\n",
+ prland(lp));
else
pr("%s cannot carry land units!\n", prland(lp));
}
if (tleft < 0.0)
tleft = 0.0;
pr(" %3d $%12.2f %2d %5.2f hrs (%3d) %c %6d ",
- comm->com_uid,
- comm->com_price,
- comm->com_maxbidder,
- tleft, comm->com_owner, ichr[comm->com_type].i_mnem, comm->com_amount);
+ comm->com_uid, comm->com_price, comm->com_maxbidder, tleft,
+ comm->com_owner, ichr[comm->com_type].i_mnem, comm->com_amount);
if (comm->com_owner == player->cnum || player->god)
pr("%s", xyas(comm->sell_x, comm->sell_y, player->cnum));
pr("\n");
continue;
}
if (fland.lnd_effic < LAND_MINFIREEFF) {
- pr("Unit %d cannot fire because it is less than %d%% efficient\n", fland.lnd_uid, LAND_MINFIREEFF);
+ pr("Unit %d cannot fire because it is less than %d%% efficient\n",
+ fland.lnd_uid, LAND_MINFIREEFF);
continue;
}
resupply_commod(&fland, I_SHELL); /* Get more shells */
else
pr("\n");
} else
- pr("%s ran out of %s before it could finish the job\nOnly %d mines were laid in %s\n", prland(&land), land.lnd_mobil > 0 ? "supply" : "mobility", total_mines_laid, xyas(sect.sct_x, sect.sct_y, land.lnd_own));
+ pr("%s ran out of %s before it could finish the job\n"
+ "Only %d mines were laid in %s\n",
+ prland(&land),
+ land.lnd_mobil > 0 ? "supply" : "mobility",
+ total_mines_laid,
+ xyas(sect.sct_x, sect.sct_y, land.lnd_own));
}
return RET_OK;
}
pcp = &plchr[(int)gp->type];
if (!(pcp->pl_flags & P_T)) {
- pr("Only planes with the tactical ability can interdict.\n%s #%d is ineligible\n", pcp->pl_name, gp->uid);
+ pr("Only planes with the tactical ability can interdict.\n"
+ "%s #%d is ineligible\n",
+ pcp->pl_name, gp->uid);
continue;
}
}
pcp = &plchr[(int)gp->type];
if (!(pcp->pl_flags & P_F)) {
- pr("Only planes with the intercept abilities can perform air defense.\n%s #%d is ineligible\n", pcp->pl_name, gp->uid);
+ pr("Only planes with the intercept abilities can perform air defense.\n"
+ "%s #%d is ineligible\n",
+ pcp->pl_name, gp->uid);
continue;
}
}
pcp = &plchr[(int)gp->type];
if (!(pcp->pl_flags & P_ESC) && !(pcp->pl_flags & P_F)) {
- pr("Only planes with the escort or intercept abilities can escort.\n%s #%d is ineligible\n", pcp->pl_name, gp->uid);
+ pr("Only planes with the escort or intercept abilities can escort.\n"
+ "%s #%d is ineligible\n",
+ pcp->pl_name, gp->uid);
continue;
}
}
pcp = &plchr[(int)gp->type];
if (!(pcp->pl_flags & P_T)) {
- pr("Only planes with the tactical ability can support.\n%s #%d is ineligible\n", pcp->pl_name, gp->uid);
+ pr("Only planes with the tactical ability can support.\n"
+ "%s #%d is ineligible\n",
+ pcp->pl_name, gp->uid);
continue;
}
}
case 19:
if ((plchr[(int)plane.pln_type].pl_flags & (P_O | P_M)) ==
P_O) {
- pr(" %c", (plane.pln_flags & PLN_SYNCHRONOUS) ? 'Y' : 'N');
+ pr(" %c",
+ (plane.pln_flags & PLN_SYNCHRONOUS) ? 'Y' : 'N');
} else
pr(" N");
break;
/* during the update, but it's the best we can really do */
work = new_work(§,
total_work(sect.sct_work, etu_per_update,
- civs, sect.sct_item[I_MILIT], uws, maxpop));
+ civs, sect.sct_item[I_MILIT], uws,
+ maxpop));
bwork = work / 2;
if (sect.sct_off)
return RET_SYN;
while (nxtitem(&ni, &nat)) {
if (nat.nat_stat == STAT_GOD) {
- pr("You may not reject/accept stuff from %s\nbecause they are a deity.\n", nat.nat_cnam);
+ pr("You may not reject/accept stuff from %s\n"
+ "because they are a deity.\n",
+ nat.nat_cnam);
continue;
}
if (nat.nat_stat == STAT_UNUSED)
int tolerance;
if (ours
- && plnatp->nat_stat >= STAT_ACTIVE && natp->nat_stat >= STAT_ACTIVE) {
+ && plnatp->nat_stat >= STAT_ACTIVE
+ && natp->nat_stat >= STAT_ACTIVE) {
theirs = natp->nat_level[what];
if ((shift = MIN((int)theirs, (int)ours) - 100) > 0) {
ours -= shift;
check_market();
check_trade();
- if ((p = getstarg(player->argp[1], "Ship, plane, land unit or nuke? ", buf)) == 0)
+ p = getstarg(player->argp[1], "Ship, plane, land unit or nuke? ", buf);
+ if (p == 0)
return RET_SYN;
if ((type = ef_byname_from(p, ef_saleable)) < 0) {
pr("You can sell only ships, planes, land units or nukes\n");
static s_char **map = NULL;
nsect = 0;
- if ((ptr = getstarg(player->argp[1], "commodity or variable? ", buf)) == 0)
+ ptr = getstarg(player->argp[1], "commodity or variable? ", buf);
+ if (ptr == 0)
return RET_SYN;
ptr = nstr_comp_val(ptr, &val, EF_SECTOR);
if (!ptr)
continue;
}
if (!(lchr[(int)land.lnd_type].l_flags & L_ASSAULT)) {
- pr("%s does not have \"assault\" capability and can't be tended\n", prland(&land));
+ pr("%s does not have \"assault\" capability and can't be tended\n",
+ prland(&land));
continue;
}
if (!snxtitem(&targets, EF_SHIP,
if (*update_demandtimes != 0)
pr("Demand updates are allowed during: %s\n",
update_demandtimes);
- pr("Demand updates require %d country(s) to want one.\n", update_wantmin);
+ pr("Demand updates require %d country(s) to want one.\n",
+ update_wantmin);
}
}
if (*game_days != 0)
if (sect.sct_type != SCT_HEADQ || sect.sct_effic < 60)
continue;
rel = getrel(getnatp(land.lnd_own), sect.sct_own);
- if ((rel < FRIENDLY) && (sect.sct_own != land.lnd_own)) {
- pr("You are not on friendly terms with the owner of unit %d!\n", land.lnd_uid);
+ if (rel < FRIENDLY && sect.sct_own != land.lnd_own) {
+ pr("You are not on friendly terms with the owner of unit %d!\n",
+ land.lnd_uid);
continue;
}
n++;
if (sect.sct_type != SCT_HARBR || sect.sct_effic < 60)
continue;
rel = getrel(getnatp(ship.shp_own), sect.sct_own);
- if ((rel < FRIENDLY) && (sect.sct_own != ship.shp_own)) {
- pr("You are not on friendly terms with the owner of ship %d!\n", ship.shp_uid);
+ if (rel < FRIENDLY && sect.sct_own != ship.shp_own) {
+ pr("You are not on friendly terms with the owner of ship %d!\n",
+ ship.shp_uid);
continue;
}
n++;
if (sect.sct_type != SCT_AIRPT || sect.sct_effic < 60)
continue;
rel = getrel(getnatp(plane.pln_own), sect.sct_own);
- if ((rel < FRIENDLY) && (sect.sct_own != plane.pln_own)) {
- pr("You are not on friendly terms with the owner of plane %d!\n", plane.pln_uid);
+ if (rel < FRIENDLY && sect.sct_own != plane.pln_own) {
+ pr("You are not on friendly terms with the owner of plane %d!\n",
+ plane.pln_uid);
continue;
}
n++;
pr("Banks pay $%.2f in interest per 1000 gold bars per etu.\n",
bankint * 1000.0);
- pr("1000 civilians generate $%.2f, uncompensated workers $%.2f each time unit.\n", 1000.0 * money_civ, 1000.0 * money_uw);
+ pr("1000 civilians generate $%.2f, uncompensated workers $%.2f each time unit.\n",
+ 1000.0 * money_civ, 1000.0 * money_uw);
pr("1000 active military cost $%.2f, reserves cost $%.2f.\n",
-money_mil * 1000.0, -money_res * 1000.0);
if (rollover_avail_max)
- pr("Up to %d avail can roll over an update.\n", rollover_avail_max);
+ pr("Up to %d avail can roll over an update.\n",
+ rollover_avail_max);
if (opt_SLOW_WAR)
pr("Declaring war will cost you $%i\n\n", War_Cost);
pr("Happiness p.e. requires 1 happy stroller per %d civ.\n",
pr("Happiness is averaged over %d time units.\n", (int)hap_avg);
pr("Education is averaged over %d time units.\n", (int)edu_avg);
if (opt_ALL_BLEED == 0)
- pr("The technology/research boost you get from your allies is %.2f%%.\n", 100.0 / ally_factor);
+ pr("The technology/research boost you get from your allies is %.2f%%.\n",
+ 100.0 / ally_factor);
else
- pr("The technology/research boost you get from the world is %.2f%%.\n", 100.0 / ally_factor);
+ pr("The technology/research boost you get from the world is %.2f%%.\n",
+ 100.0 / ally_factor);
pr("Nation levels (tech etc.) decline 1%% every %d time units.\n",
(int)(level_age_rate));
-(etu_per_update / sect_mob_neg_factor));
pr("\n");
if (opt_FUEL)
- pr("For ships and land units, fuelu makes %d mobility.\n\n", fuel_mult);
+ pr("For ships and land units, fuelu makes %d mobility.\n\n",
+ fuel_mult);
pr("Ships on autonavigation may use %i cargo holds per ship.\n", TMAX);
if (opt_TRADESHIPS) {
- pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n", trade_1_dist, (float)(trade_1 * 100.0));
- pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n", trade_2_dist, (float)(trade_2 * 100.0));
- pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n", trade_3_dist, (float)(trade_3 * 100.0));
- pr("Cashing in trade-ships with an ally nets you a %.1f%% bonus.\n", trade_ally_bonus * 100.0);
- pr("Cashing in trade-ships with an ally nets your ally a %.1f%% bonus.\n\n", trade_ally_cut * 100.0);
+ pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
+ trade_1_dist, (float)(trade_1 * 100.0));
+ pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
+ trade_2_dist, (float)(trade_2 * 100.0));
+ pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
+ trade_3_dist, (float)(trade_3 * 100.0));
+ pr("Cashing in trade-ships with an ally nets you a %.1f%% bonus.\n",
+ trade_ally_bonus * 100.0);
+ pr("Cashing in trade-ships with an ally nets your ally a %.1f%% bonus.\n\n",
+ trade_ally_cut * 100.0);
}
if (opt_MARKET) {
- pr("The tax you pay on selling things on the trading block is %.1f%%\n", (1.00 - tradetax) * 100.0);
- pr("The tax you pay on buying commodities on the market is %.1f%%\n", (buytax - 1.00) * 100.0);
- pr("The amount of time to bid on commodities is %d seconds.\n", MARK_DELAY);
- pr("The amount of time to bid on a unit is %d seconds.\n\n", TRADE_DELAY);
+ pr("The tax you pay on selling things on the trading block is %.1f%%\n",
+ (1.00 - tradetax) * 100.0);
+ pr("The tax you pay on buying commodities on the market is %.1f%%\n",
+ (buytax - 1.00) * 100.0);
+ pr("The amount of time to bid on commodities is %d seconds.\n",
+ MARK_DELAY);
+ pr("The amount of time to bid on a unit is %d seconds.\n\n",
+ TRADE_DELAY);
}
if (!ef_nelem(EF_NUKE_CHR))
pr("Nukes are disabled.\n");
else if (drnuke_const > MIN_DRNUKE_CONST) {
- pr("In order to build a nuke, you need %1.2f times the tech level in research\n", drnuke_const);
- pr("\tExample: In order to build a 300 tech nuke, you need %d research\n\n", (int)(300.0 * drnuke_const));
+ pr("In order to build a nuke, you need %1.2f times the tech level in research\n",
+ drnuke_const);
+ pr("\tExample: In order to build a 300 tech nuke, you need %d research\n\n",
+ (int)(300.0 * drnuke_const));
}
pr("Fire ranges are scaled by %.2f.\n", fire_range_factor);
show_opts(0);
pr("\n\nSee \"info Options\" for a detailed list of options and descriptions.\n");
show_custom();
- pr("\nThe person to annoy if something goes wrong is:\n\t%s\n\t(%s).\n\n",
+ pr("\nThe person to annoy if something goes wrong is:\n\t%s\n\t(%s).\n",
privname, privlog);
- pr("You can get your own copy of the source from "
+ pr("\nYou can get your own copy of the source from "
"http://www.wolfpackempire.com/\n\n");
pr("%s", legal);
return RET_OK;
eff_amt = MIN(land.lnd_mobil, work_amt);
w = ldround(((double)eff_amt * land.lnd_effic / 600.0), 1);
if (w < 1) {
- pr("%s doesn't work enough to change efficiency (try increasing amount)\n", prland(&land));
+ pr("%s doesn't work enough to change efficiency (try increasing amount)\n",
+ prland(&land));
continue;
}
nunits++;
news_item = N_SAT_KILL;
if (sect.sct_own) {
mpr(sect.sct_own, "%s has positioned a satellite over %s\n",
- sublaunch ? (s_char *)"someone" : cname(bombown), xyas(x,
- y,
- sect.
- sct_own));
+ sublaunch ? "someone" : cname(bombown),
+ xyas(x, y, sect.sct_own));
}
} else if (wantflags == P_N && nowantflags == P_O) {
att_name = "warhead";
exit(EXIT_FAILURE);
ef_init();
if (chdir(configdir)) {
- fprintf(stderr, "Can't chdir to %s (%s)\n", configdir, strerror(errno));
+ fprintf(stderr, "Can't chdir to %s (%s)\n",
+ configdir, strerror(errno));
exit(EXIT_FAILURE);
}
if (chdir(builtindir)) {
- fprintf(stderr, "Can't chdir to %s (%s)\n", builtindir, strerror(errno));
+ fprintf(stderr, "Can't chdir to %s (%s)\n",
+ builtindir, strerror(errno));
exit(EXIT_FAILURE);
}
if (read_builtin_tables() < 0)
exit(EXIT_FAILURE);
if (chdir(configdir)) {
- fprintf(stderr, "Can't chdir to %s (%s)\n", configdir, strerror(errno));
+ fprintf(stderr, "Can't chdir to %s (%s)\n",
+ configdir, strerror(errno));
exit(EXIT_FAILURE);
}
if (read_custom_tables() < 0)
exit(EXIT_FAILURE);
if (chdir(gamedir)) {
- fprintf(stderr, "Can't chdir to %s (%s)\n", gamedir, strerror(errno));
+ fprintf(stderr, "Can't chdir to %s (%s)\n",
+ gamedir, strerror(errno));
exit(EXIT_FAILURE);
}
#if defined(_WIN32)
if (daemonize != 0) {
- SERVICE_TABLE_ENTRY DispatchTable[]={{"Empire Server", service_main},{NULL, NULL}};
+ SERVICE_TABLE_ENTRY DispatchTable[]={
+ {"Empire Server", service_main},
+ {NULL, NULL}
+ };
if (StartServiceCtrlDispatcher(DispatchTable))
return 0;
else {
* start server in the foreground
*/
if (GetLastError() != ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
- logerror("Failed to dispatch service (%lu)", GetLastError());
+ logerror("Failed to dispatch service (%lu)",
+ GetLastError());
finish_server();
exit(EXIT_FAILURE);
}