them. From Marc Olzheim.
Type modifier 'l' was missing in many places, probably rendering the
server useless on 64-bit hosts.
(ef_flush, ef_write, ef_extend, lwpCreate, lwpDestroy): Use conversion
specifier 'p' to print pointers.
(check_market): Fix display of loan amount.
(doland): Fix unescaped '%' (undefined behavior).
(ldump, ndump, pdump, sdump): Don't use flag '0' with conversion
specifier 's' (undefined behavior).
(dump, ldump, lost, ndump, pdump, sdump, empth_create, update_sched):
Cast time_t and pthread_t to long for printing.
(lwpStackCheck, lwpStackCheckUsed, finish_sects): Insert cast to fix
argument type on all platforms.
(prod): Remove extra argument.
(perform_mission, airdamage, retreat_land1, lwpReschedule): Format
string missed arguments.
void lwpSignal(struct lwpSem *);
void lwpWait(struct lwpSem *);
void lwpSelect(void *);
-void lwpStatus(struct lwpProc * proc, char *format, ...);
+void lwpStatus(struct lwpProc *proc, char *format, ...)
+ ATTRIBUTE((format (printf, 2, 3)));
extern struct lwpProc *LwpCurrent;
time_t starttime; /* When we should start updating mobility again. */
};
+#ifdef __GNUC__
+#define ATTRIBUTE(attrs) __attribute__ (attrs)
+#else
+#define ATTRIBUTE(attrs)
+#endif
+
#define ANNO_KEEP_DAYS 7 /* Keep announcements around for this many days */
/* This uses a lot of thread stack with some versions of GNU libc,
which can lead to nasty heap smashes (observed with 2.2.93).
extern s_char *plur(int n, s_char *no, s_char *yes);
extern s_char *getstarg(s_char *input, s_char *prompt, s_char buf[]);
extern s_char *getstring(s_char *prompt, s_char buf[]);
-extern s_char *prbuf(s_char *format, ...);
+extern s_char *prbuf(s_char *format, ...)
+ ATTRIBUTE((format (printf, 1, 2)));
#define MAXCHRNV 12
extern int has_helpful_engineer(coord x, coord y, natid cn);
/* log.c */
extern void loginit(s_char *);
-extern void logerror(s_char *, ...);
+extern void logerror(s_char *, ...) ATTRIBUTE((format (printf, 1, 2)));
/* maps.c */
extern int draw_map(int, s_char, int, struct nstr_sect *, int);
extern int unit_map(int, int, struct nstr_sect *, s_char *);
extern int pln_damage(struct plnstr *, coord, coord, s_char, int *, int);
extern int pln_identchance(struct plnstr *, int, int);
/* pr.c */
-extern void pr(s_char *, ...);
+extern void pr(s_char *, ...) ATTRIBUTE((format (printf, 1, 2)));
extern void prnf(s_char *buf);
-extern void pr_id(struct player *, int, s_char *, ...);
-extern void pr_flash(struct player *, s_char *, ...);
-extern void pr_inform(struct player *, s_char *, ...);
-extern void pr_wall(s_char *, ...);
+extern void pr_id(struct player *, int, s_char *, ...)
+ ATTRIBUTE((format (printf, 3, 4)));
+extern void pr_flash(struct player *, s_char *, ...)
+ ATTRIBUTE((format (printf, 2, 3)));
+extern void pr_inform(struct player *, s_char *, ...)
+ ATTRIBUTE((format (printf, 2, 3)));
+extern void pr_wall(s_char *, ...)
+ ATTRIBUTE((format (printf, 1, 2)));
extern void pr_player(struct player *pl, int id, s_char *buf);
extern void pr_hilite(s_char *buf);
extern void prredir(s_char *redir);
extern int prmptrd(s_char *prompt, s_char *str, int size);
extern void prdate(void);
extern void prxy(s_char *format, coord x, coord y, natid country);
-extern void PR(int, s_char *, ...);
+extern void PR(int, s_char *, ...) ATTRIBUTE((format (printf, 2, 3)));
extern void PRdate(natid cn);
extern void pr_beep(void);
-extern void mpr(int, s_char *, ...);
+extern void mpr(int, s_char *, ...) ATTRIBUTE((format (printf, 2, 3)));
/* radmap.c */
extern int deltx(struct range *, coord);
/* wu.c */
extern void clear_telegram_is_new(natid);
extern int typed_wu(natid, natid, s_char *, int);
-extern int wu(natid, natid, s_char *, ...);
+extern int wu(natid, natid, s_char *, ...) ATTRIBUTE((format (printf, 3, 4)));
/*
* src/lib/update/ *.c
pr("%-17s\t%c\t", dchr[x].d_name, dchr[x].d_mnem);
if (x == SCT_ENLIST)
- pr("%d mil \t", p_sect[x][0]);
+ pr("%ld mil \t", p_sect[x][0]);
else if (pchr[dchr[x].d_prd].p_cost != 0)
- pr("%d %-7s\t", p_sect[x][0], pchr[dchr[x].d_prd].p_sname);
+ pr("%ld %-7s\t", p_sect[x][0], pchr[dchr[x].d_prd].p_sname);
else
pr("\t\t");
pr("\t");
if (np->nat_priorities[x] != 0) {
if ((np->nat_money + income - expenses) > 0) {
- pr("%8d", p_sect[x][1]);
+ pr("%8ld", p_sect[x][1]);
expenses += p_sect[x][1];
} else
- pr("[%7d]", p_sect[x][1]);
+ pr("[%7ld]", p_sect[x][1]);
} else {
if ((np->nat_money + income - expenses) > 0)
- pr("(%7d)", p_sect[x][1]);
+ pr("(%7ld)", p_sect[x][1]);
else
- pr("[(%7d)]", p_sect[x][1]);
+ pr("[(%7ld)]", p_sect[x][1]);
}
pr("\n");
np->nat_priorities[PRI_PMAINT], -1 * pmaint);
}
if (p_sect[SCT_EFFIC][1]) {
- pr("Sector building\t\t\t\t%8d sct(s)\t\t%8d\n",
+ pr("Sector building\t\t\t\t%8ld sct(s)\t\t%8ld\n",
p_sect[SCT_EFFIC][0], p_sect[SCT_EFFIC][1]);
expenses += p_sect[SCT_EFFIC][1];
}
n ==
1 ? opt_BIG_CITY ? "city" : "capital" : opt_BIG_CITY ?
"cities" : "capitals");
- pr("%s maintenance\t\t%-32s%8d\n",
+ pr("%s maintenance\t\t%-32s%8ld\n",
opt_BIG_CITY ? "City" : "Capital", in, p_sect[SCT_CAPIT][1]);
expenses += p_sect[SCT_CAPIT][1];
}
pr("Income from bars\t\t%-32s%+8d\n", in, bars);
}
pr("Total income%s\n", dotsprintf(buf, "%+60d", income));
- pr("Balance forward\t\t\t\t\t\t %10d\n", np->nat_money);
+ pr("Balance forward\t\t\t\t\t\t %10ld\n", np->nat_money);
pr("Estimated delta\t\t\t\t\t\t %+10d\n", income - expenses);
pr("Estimated new treasury%s\n",
dotsprintf(buf, "%50d", np->nat_money + income - expenses));
nreport(comm.com_maxbidder, N_FIN_TROUBLE,
comm.com_owner, 1);
wu(0, comm.com_maxbidder,
- "You just took loan #%d for $%.2f to cover the cost of your purchase.\n",
+ "You just took loan #%d for $%ld to cover the cost of your purchase.\n",
j, loan.l_amtdue);
wu(0, comm.com_owner,
"You just extended loan #%d to %s to help with the purchase cose.\n",
pr("%s no longer has the funds.\n", cname(ltcp->proposer));
if (lp->l_amtdue <= 0)
return RET_FAIL;
- pr("You may borrow $%d at the same terms.\n", lp->l_amtdue);
+ pr("You may borrow $%ld at the same terms.\n", lp->l_amtdue);
}
lender->nat_money -= lp->l_amtdue;
putnat(lender);
return RET_FAIL;
}
accpt(ltcp);
- pr("You are now $%d richer (sort of).\n", lp->l_amtdue);
+ pr("You are now $%ld richer (sort of).\n", lp->l_amtdue);
return RET_OK;
}
}
pr("Total new civilians : %d\n", mil_demob);
if (*p == 'y')
- pr("Military reserve stands at %d (up %d)\n",
+ pr("Military reserve stands at %ld (up %d)\n",
natp->nat_reserve + reserves, reserves);
if (reserves > 0) {
natp->nat_reserve += reserves;
if (player->god)
pr(" ");
time(&now);
- pr("DUMP SECTOR %d\n", now);
+ pr("DUMP SECTOR %ld\n", (long)now);
if (player->god)
pr("own ");
pr("x y");
pr("Connected: %d\n", np->nat_connected);
pr("Representative <r>: %-20s\n", np->nat_pnam);
pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
- pr("Reserves <m>: %5d\n", np->nat_reserve);
+ pr("Reserves <m>: %5ld\n", np->nat_reserve);
pr("Capital <c>: %s\t\t",
xyas(np->nat_xcap, np->nat_ycap, player->cnum));
pr("Origin <o>: %3s\n",
pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
- pr("Money <M>: $%6d\n", np->nat_money);
+ pr("Money <M>: $%6ld\n", np->nat_money);
pr("Telegrams <t>: %6d\n", np->nat_tgms);
if (opt_DEMANDUPDATE)
pr("Updates missed <U>: %d\n", np->nat_missed);
case 'p':
old = sect->sct_pstage;
new = errcheck(arg, 0, PLG_EXPOSED);
- pr("Plague stage of %s changed from %d to %d%\n",
+ pr("Plague stage of %s changed from %d to %d%%\n",
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
sect->sct_pstage = new;
break;
case 't':
old = sect->sct_ptime;
new = errcheck(arg, 0, 255);
- pr("Plague time of %s changed from %d to %d%\n",
+ pr("Plague time of %s changed from %d to %d%%\n",
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
sect->sct_ptime = new;
break;
break;
case 'm':
benefit(nat, np->nat_reserve < arg);
- pr("Military Reserves changed from %d to %d\n",
+ pr("Military Reserves changed from %ld to %d\n",
np->nat_reserve, arg);
if (np->nat_stat == STAT_NORM)
wu(player->cnum, nat,
- "Military Reserves changed from %d to %d by divine intervention.\n",
+ "Military Reserves changed from %ld to %d by divine intervention.\n",
np->nat_reserve, arg);
np->nat_reserve = arg;
break;
np->nat_minused = arg;
break;
case 'M':
- pr("Money changed from %d to %d\n", np->nat_money, arg);
+ pr("Money changed from %ld to %d\n", np->nat_money, arg);
wu(player->cnum, nat,
- "Money changed from %d to %d by divine intervention.\n",
+ "Money changed from %ld to %d by divine intervention.\n",
np->nat_money, arg);
np->nat_money = arg;
break;
}
}
pr("Total new enlistment : %d\n", totalmil);
- pr("Military reserves stand at %d\n", reserve);
+ pr("Military reserves stand at %ld\n", reserve);
if (totalmil) {
natp->nat_reserve -= totalmil;
putnat(natp);
pr(" %-2d (%3d) %-8.8s (%3d) %-8.8s ", ni.cur,
loan.l_loner, cname(loan.l_loner),
loan.l_lonee, cname(loan.l_lonee));
- pr("%3d%% %3d %5d %7d",
+ pr("%3d%% %3d %5ld %7d",
loan.l_irate, loan.l_ldur, loan.l_amtpaid, (int)amt);
if (now > loan.l_duedate)
pr(" (in arrears)\n");
free(lbp);
if ((nhl) > lhitlim) {
- pr("Limit of %ld lines exceeded\n", lhitlim);
+ pr("Limit of %d lines exceeded\n", lhitlim);
}
pr("Found %s in %ld of %ld files and in %ld of %ld lines\n",
bp, nhf, nf, nhl, nl);
if (player->god)
pr(" ");
time(&now);
- pr("DUMP LAND UNITS %d\n", now);
+ pr("DUMP LAND UNITS %ld\n", (long)now);
if (player->god)
pr("own ");
pr("id");
while (field[n]) {
switch (field[n++]) {
case 1:
- pr(" %0.4s", lchr[(int)land.lnd_type].l_name);
+ pr(" %.4s", lchr[(int)land.lnd_type].l_name);
break;
case 2:
pr(" %d", xrel(np, land.lnd_x));
prdate();
nlost = 0;
time(&now);
- pr("DUMP LOST ITEMS %d\n", now);
+ pr("DUMP LOST ITEMS %ld\n", (long)now);
if (player->god)
pr("owner ");
pr("type id x y timestamp\n");
pr("%d ", lost.lost_owner);
pr("%d %d ", lost.lost_type, lost.lost_id);
prxy("%d %d ", lost.lost_x, lost.lost_y, player->cnum);
- pr("%d\n", lost.lost_timestamp);
+ pr("%ld\n", (long)lost.lost_timestamp);
nlost++;
}
if (nlost == 0) {
}
}
pr(" The treasury has $%.2f", (double)natp->nat_money);
- pr(" Military reserves: %d\n", natp->nat_reserve);
+ pr(" Military reserves: %ld\n", natp->nat_reserve);
pr("Education..........%6.2f Happiness.......%6.2f\n",
(double)natp->nat_level[NAT_ELEV],
(double)natp->nat_level[NAT_HLEV]);
if (player->god)
pr(" ");
time(&now);
- pr("DUMP NUKES %d\n", now);
+ pr("DUMP NUKES %ld\n", (long)now);
if (player->god)
pr("own ");
pr("id x y num type\n");
pr("%d ", nuk.nuk_uid);
prxy("%d %d", nuk.nuk_x, nuk.nuk_y, player->cnum);
pr(" %d", nuk.nuk_types[i]);
- pr(" %0.5s", nchr[i].n_name);
+ pr(" %.5s", nchr[i].n_name);
pr("\n");
}
}
if (player->god)
pr(" ");
time(&now);
- pr("DUMP PLANES %d\n", now);
+ pr("DUMP PLANES %ld\n", (long)now);
if (player->god)
pr("own ");
pr("id");
while (field[n]) {
switch (field[n++]) {
case 1:
- pr(" %0.4s", plchr[(int)plane.pln_type].pl_name);
+ pr(" %.4s", plchr[(int)plane.pln_type].pl_name);
break;
case 2:
pr(" %d", xrel(natp, plane.pln_x));
break;
case 20:
if (plane.pln_nuketype != -1) {
- pr(" %0.5s", nchr[(int)plane.pln_nuketype].n_name);
+ pr(" %.5s", nchr[(int)plane.pln_nuketype].n_name);
break;
} else
pr(" N/A");
com = "";
- pr("%-9.9s %3d %32.32s %2d:%02d %4ds %-20.20s\n",
+ pr("%-9.9s %3d %32.32s %2d:%02d %4lds %-20.20s\n",
cname(joe->cnum),
joe->cnum,
(player->god
pr(" %4d mil 1.00 $%-5d%3dc",
enlisted, enlisted * 3, enlisted);
pr(" %3dc %4d\n",
- enlisted, maxmil, maxmil);
+ enlisted, maxmil);
continue;
}
return RET_FAIL;
}
if (natp->nat_money < payment) {
- pr("You only have $%d.\n", natp->nat_money);
+ pr("You only have $%ld.\n", natp->nat_money);
return RET_FAIL;
}
player->dolcost += payment;
putnat(loaner);
(void)time(&loan.l_lastpay);
if (owe <= payment) {
- wu(0, loan.l_loner, "Country #%d paid off loan #%d with $%d\n",
+ wu(0, loan.l_loner, "Country #%d paid off loan #%d with $%ld\n",
player->cnum, loan_num, payment);
nreport(player->cnum, N_REPAY_LOAN, loan.l_loner, 1);
loan.l_status = LS_FREE;
if (player->god)
pr(" ");
time(&now);
- pr("DUMP SHIPS %d\n", now);
+ pr("DUMP SHIPS %ld\n", (long)now);
if (player->god)
pr("own ");
pr("id");
while (field[n]) {
switch (field[n++]) {
case 1:
- pr(" %0.4s", mchr[(int)ship.shp_type].m_name);
+ pr(" %.4s", mchr[(int)ship.shp_type].m_name);
break;
case 2:
pr(" %d", xrel(np, ship.shp_x));
"%s bought loan #%d. You now owe him!\n",
cname(player->cnum), arg);
wu(0, loan.l_loner,
- "%s bought loan #%d out from under you for %d\n",
+ "%s bought loan #%d out from under you for %ld\n",
cname(player->cnum), arg, payment);
pr("You now own loan #%d. Go break some legs.\n", arg);
}
TRADE_DELAY / 3600.0 - (now - trade.trd_markettime) / 3600.0;
if (tleft < 0.0)
tleft = 0.0;
- pr("$%7d %2d %5.2f hrs ", trade.trd_price,
+ pr("$%7ld %2d %5.2f hrs ", trade.trd_price,
trade.trd_maxbidder, tleft);
(void)trade_desc(&trade, &tg); /* XXX */
pr("\n");
return 0;
}
if (write(ep->fd, ep->cache, size) != size) {
- logerror("ef_flush: %s cache write(%d, %x, %d) -> %d",
- ep->name, ep->fd, ep->cache, ep->size, r);
+ logerror("ef_flush: %s cache write(%d, %p, %d) -> %d",
+ ep->name, ep->fd, (void *)ep->cache, ep->size, r);
return 0;
}
}
if (ep->prewrite)
ep->prewrite(id, ptr);
if ((r = write(ep->fd, ptr, ep->size)) != ep->size) {
- logerror("ef_write: %s #%d write(%d, %x, %d) -> %d",
- ep->name, id, ep->fd, ptr, ep->size, r);
+ logerror("ef_write: %s #%d write(%d, %p, %d) -> %d",
+ ep->name, id, ep->fd, (void *)ptr, ep->size, r);
return 0;
}
if (id >= ep->baseid && id < ep->baseid + ep->cids) {
if (ep->init)
ep->init(cur, ptr);
if ((r = write(ep->fd, ptr, ep->size)) != ep->size) {
- logerror("ef_extend: %s +#%d write(%d, %x, %d) -> %d",
- ep->name, count, ep->fd, ptr, ep->size, r);
+ logerror("ef_extend: %s +#%d write(%d, %p, %d) -> %d",
+ ep->name, count, ep->fd, (void *)ptr, ep->size, r);
return 0;
}
}
static pthread_mutex_t mtx_ctxsw; /* thread in critical section */
+static void empth_status(char *format, ...) ATTRIBUTE((format (printf, 1, 2)));
+
static void *
empth_start(void *ctx)
strerror(eno));
goto bad;
}
- empth_status("new thread id is %d", t);
+ empth_status("new thread id is %ld", (long)t);
return ctx;
pthread_attr_destroy(&attr);
bad:
if (LwpCurrent != nextp && !(LwpCurrent && i)) {
/* restore previous context */
- lwpStatus(nextp, "switch in", nextp->pri);
+ lwpStatus(nextp, "switch in %d", nextp->pri);
LwpCurrent = nextp;
*LwpContextPtr = LwpCurrent->ud;
#ifdef BOUNDS_CHECK
newp->dead = 0;
if (flags & LWP_STACKCHECK)
lwpStackCheckInit(newp);
- lwpStatus(newp, "creating process structure sbtm: %d",
- (int)newp->sbtm);
+ lwpStatus(newp, "creating process structure sbtm: %p",
+ newp->sbtm);
lwpReady(newp);
lwpReady(LwpCurrent);
#ifdef UCONTEXT
lwpStackCheckUsed(proc);
lwpStackCheck(proc);
}
- lwpStatus(proc, "destroying sbtm: %d", (int)proc->sbtm);
+ lwpStatus(proc, "destroying sbtm: %p", proc->sbtm);
proc->entry = 0;
proc->ud = 0;
proc->argv = 0;
amt = (i + 1) * sizeof(long);
}
lwpStatus(newp, "Thread stack overflowed %d bytes (of %u)",
- amt, newp->size - 2 * LWP_REDZONE - sizeof(stkalign_t));
+ amt, newp->size - 2 * LWP_REDZONE - (int)sizeof(stkalign_t));
return (0);
}
for (lp = newp->lowmark, i = 0; i < LWP_REDZONE / sizeof(long);
amt = (LWP_REDZONE - i + 1) * sizeof(long);
}
lwpStatus(newp, "Thread stack underflow %d bytes (of %u)",
- amt, newp->size - 2 * LWP_REDZONE - sizeof(stkalign_t));
+ amt, newp->size - 2 * LWP_REDZONE - (int)sizeof(stkalign_t));
return (0);
}
return (1);
}
lwpStatus(newp, "stack use: %u bytes (of %u total)",
(i * sizeof(long)) - LWP_REDZONE,
- newp->size - 2 * LWP_REDZONE - sizeof(stkalign_t));
+ newp->size - 2 * LWP_REDZONE - (int)sizeof(stkalign_t));
}
#endif
void
lwpSleepUntil(long int until)
{
- lwpStatus(LwpCurrent, "sleeping for %d sec", until - time(0));
+ lwpStatus(LwpCurrent, "sleeping for %ld sec", until - time(0));
LwpCurrent->runtime = until;
if (LwpSelect.maxfd == 0 && LwpSelect.delayq.head == 0) {
/* select process is sleeping until first waiter arrives */
return 1;
}
if (read(downf, buf, tgm.tel_length) != tgm.tel_length) {
- logerror("bad length %d on login message", tgm.tel_length);
+ logerror("bad length %ld on login message", tgm.tel_length);
close(downf);
return 1;
}
return RET_FAIL;
}
if (read(upf, buf, tgm.tel_length) != tgm.tel_length) {
- logerror("bad length %d on login message", tgm.tel_length);
+ logerror("bad length %ld on login message", tgm.tel_length);
close(upf);
return RET_FAIL;
}
player->dolcost -= gain;
} else
gain = 0;
- wu(0, coun, "You lost $%d and they gained $%d\n", lose, gain);
+ wu(0, coun, "You lost $%ld and they gained $%ld\n", lose, gain);
wu(0, coun,
"Your capital has been moved to %s. You must use 'capital' to reset it.\n",
xyas(natp->nat_xcap, natp->nat_ycap, coun));
s_char *p;
if (cash > 0 && cost > cash / 2) {
- pr("This operation will cost you $%d, and you only have $%d.\n",
+ pr("This operation will cost you $%ld, and you only have $%ld.\n",
cost, cash);
if (cost > cash) {
- pr("You will be broke with $%d if you proceed with this command.\n", cash - cost);
+ pr("You will be broke with $%ld if you proceed with this command.\n", cash - cost);
}
p = getstarg(argp, "Are you sure that you want to do this? ", buf);
if (p == 0 || *p != 'y')
if (looping && cash > 0 && player->dolcost + cost > cash
&& *warnedp < 2) {
*warnedp = 2;
- pr("You will go broke! (it will cost $%d and you only have $%d)\n", cost, cash - (long)player->dolcost);
+ pr("You will go broke! (it will cost $%d and you only have $%ld)\n", cost, cash - (long)player->dolcost);
p = getstarg(argp, "Are you sure you wish to continue? ", buf);
if (p == 0 || *p != 'y')
return 1;
if (looping && cash > 0 && player->dolcost > cash / 2 && *warnedp < 1) {
*warnedp = 1;
pr("WARNING. You have just spent over half of your money.\n");
- pr("You started with $%d and now you only have $%d left\n", cash,
+ pr("You started with $%ld and now you only have $%ld left\n", cash,
cash - (long)player->dolcost);
}
return 0;
pr("\nLoan #%d from %s to", n, cname(loan->l_loner));
pr(" %s\n", cname(loan->l_lonee));
if (loan->l_status == LS_PROPOSED) {
- pr("(proposed) principal=$%d interest rate=%d%%",
+ pr("(proposed) principal=$%ld interest rate=%d%%",
loan->l_amtdue, loan->l_irate);
pr(" duration(days)=%d\n", loan->l_ldur);
if (loan->l_duedate < now) {
owe = ((double)loan->l_amtdue *
(((double)normaltime * rate + 1.0) +
((double)doubletime * rate * 2.0))) + 0.5;
- pr("Amount paid to date $%d\n", loan->l_amtpaid);
+ pr("Amount paid to date $%ld\n", loan->l_amtpaid);
pr("Amount due (if paid now) $%.2f", owe);
if (doubletime == 0) {
pr(" (if paid on due date) $%.2f\n",
"%s fires at %s %s at %s\n",
prship(sp), cname(victim), s, xyas(x, y, sp->shp_own));
- mpr(victim, "%s fires at you at %s\n",
+ mpr(victim, "%s %s fires at you at %s\n",
cname(sp->shp_own), prship(sp), xyas(x, y, victim));
sp->shp_item[I_SHELL] = shell - gun;
if (nukedam) {
if (mission == MI_INTERDICT) {
wu(0, pp->pln_own,
- "\t\tnuclear warhead does %d damage to %s %s\n",
+ "\t\tnuclear warhead on plane %s does %d damage to %s %s\n",
prplane(pp), nukedam, cname(victim), s);
dam += nukedam;
}
val = yrel(np, val);
break;
default:
- logerror("bad type in decode: %x!\n", code & NSC_TMASK);
+ logerror("bad type in decode: %lx!\n", code & NSC_TMASK);
val = 0;
break;
}
if (mines > 0 && (sect.sct_oldown != lp->lnd_own) &&
chance(DMINE_HITCHANCE(mines))) {
wu(0, lp->lnd_own,
- "%s %s,\nand hit a mine while retreating!\n", prland(lp),
- conditions[findcondition(code)].desc[orig], xyas(newx, newy,
- lp->
- lnd_own));
+ "%s %s,\nand hit a mine in %s while retreating!\n",
+ prland(lp),
+ conditions[findcondition(code)].desc[orig],
+ xyas(newx, newy, lp->lnd_own));
nreport(lp->lnd_own, N_LHIT_MINE, 0, 1);
m = MINE_LDAMAGE();
landdamage(lp, m);
return;
}
- logerror("Allocated '%d' bytes '%d' indices\n",
- ((WORLD_X * WORLD_Y) * sizeof(struct distinfo)),
- (WORLD_X * WORLD_Y));
-
+ logerror("Allocated '%lu' bytes '%d' indices\n",
+ (unsigned long)(WORLD_X * WORLD_Y * sizeof(struct distinfo)),
+ WORLD_X * WORLD_Y);
}
/* Wipe it clean */
levels[n][NAT_RLEV] =
limit_level(levels[n][NAT_RLEV] / 1, NAT_RLEV, 0) * 1;
wu((natid)0, n,
- "total pop is %d, yielding %4.2f hap, %4.2f edu\n",
+ "total pop is %ld, yielding %4.2f hap, %4.2f edu\n",
pop - 1, hap, edu);
}
if (ally_factor > 0.0)
if ((sea_money[n] != 0) || (air_money[n] != 0) ||
(lnd_money[n] != 0))
wu((natid)0, n,
- "Army delta $%d, Navy delta $%d, Air force delta $%d\n",
+ "Army delta $%ld, Navy delta $%ld, Air force delta $%ld\n",
lnd_money[n], sea_money[n], air_money[n]);
- wu((natid)0, n, "money delta was $%d for this update\n",
+ wu((natid)0, n, "money delta was $%ld for this update\n",
np->nat_money - money[n]);
if (opt_LOSE_CONTACT) {
for (cn = 0; cn <= MAXNOC; cn++) {
delta += wind;
}
logerror("Next update at %s", ctime(&update_time));
- logerror("Next update in %d seconds", delta);
+ logerror("Next update in %ld seconds", (long)delta);
/* sleep until update is scheduled to go off */
empth_sleep(update_time);
time(&now);