Use gcc function attribute `format' to catch bad format strings. Fix
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.
This commit is contained in:
parent
735adbf41b
commit
e7d75b2279
38 changed files with 106 additions and 93 deletions
|
@ -95,7 +95,8 @@ struct lwpSem *lwpCreateSem(char *name, int count);
|
||||||
void lwpSignal(struct lwpSem *);
|
void lwpSignal(struct lwpSem *);
|
||||||
void lwpWait(struct lwpSem *);
|
void lwpWait(struct lwpSem *);
|
||||||
void lwpSelect(void *);
|
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;
|
extern struct lwpProc *LwpCurrent;
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,12 @@ struct mob_acc_globals {
|
||||||
time_t starttime; /* When we should start updating mobility again. */
|
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 */
|
#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,
|
/* 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).
|
which can lead to nasty heap smashes (observed with 2.2.93).
|
||||||
|
@ -132,7 +138,8 @@ extern s_char *iesplur(int n);
|
||||||
extern s_char *plur(int n, s_char *no, s_char *yes);
|
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 *getstarg(s_char *input, s_char *prompt, s_char buf[]);
|
||||||
extern s_char *getstring(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
|
#define MAXCHRNV 12
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ extern int adj_units(coord, coord, natid);
|
||||||
extern int has_helpful_engineer(coord x, coord y, natid cn);
|
extern int has_helpful_engineer(coord x, coord y, natid cn);
|
||||||
/* log.c */
|
/* log.c */
|
||||||
extern void loginit(s_char *);
|
extern void loginit(s_char *);
|
||||||
extern void logerror(s_char *, ...);
|
extern void logerror(s_char *, ...) ATTRIBUTE((format (printf, 1, 2)));
|
||||||
/* maps.c */
|
/* maps.c */
|
||||||
extern int draw_map(int, s_char, int, struct nstr_sect *, int);
|
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 unit_map(int, int, struct nstr_sect *, s_char *);
|
||||||
|
@ -414,12 +414,16 @@ extern int pln_hitchance(struct plnstr *, int, int);
|
||||||
extern int pln_damage(struct plnstr *, coord, coord, s_char, int *, int);
|
extern int pln_damage(struct plnstr *, coord, coord, s_char, int *, int);
|
||||||
extern int pln_identchance(struct plnstr *, int, int);
|
extern int pln_identchance(struct plnstr *, int, int);
|
||||||
/* pr.c */
|
/* 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 prnf(s_char *buf);
|
||||||
extern void pr_id(struct player *, int, s_char *, ...);
|
extern void pr_id(struct player *, int, s_char *, ...)
|
||||||
extern void pr_flash(struct player *, s_char *, ...);
|
ATTRIBUTE((format (printf, 3, 4)));
|
||||||
extern void pr_inform(struct player *, s_char *, ...);
|
extern void pr_flash(struct player *, s_char *, ...)
|
||||||
extern void pr_wall(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_player(struct player *pl, int id, s_char *buf);
|
||||||
extern void pr_hilite(s_char *buf);
|
extern void pr_hilite(s_char *buf);
|
||||||
extern void prredir(s_char *redir);
|
extern void prredir(s_char *redir);
|
||||||
|
@ -429,10 +433,10 @@ extern void showvers(int vers);
|
||||||
extern int prmptrd(s_char *prompt, s_char *str, int size);
|
extern int prmptrd(s_char *prompt, s_char *str, int size);
|
||||||
extern void prdate(void);
|
extern void prdate(void);
|
||||||
extern void prxy(s_char *format, coord x, coord y, natid country);
|
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 PRdate(natid cn);
|
||||||
extern void pr_beep(void);
|
extern void pr_beep(void);
|
||||||
extern void mpr(int, s_char *, ...);
|
extern void mpr(int, s_char *, ...) ATTRIBUTE((format (printf, 2, 3)));
|
||||||
|
|
||||||
/* radmap.c */
|
/* radmap.c */
|
||||||
extern int deltx(struct range *, coord);
|
extern int deltx(struct range *, coord);
|
||||||
|
@ -527,7 +531,7 @@ extern int trechk(register natid, register natid, int);
|
||||||
/* wu.c */
|
/* wu.c */
|
||||||
extern void clear_telegram_is_new(natid);
|
extern void clear_telegram_is_new(natid);
|
||||||
extern int typed_wu(natid, natid, s_char *, int);
|
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
|
* src/lib/update/ *.c
|
||||||
|
|
|
@ -185,9 +185,9 @@ budg(void)
|
||||||
|
|
||||||
pr("%-17s\t%c\t", dchr[x].d_name, dchr[x].d_mnem);
|
pr("%-17s\t%c\t", dchr[x].d_name, dchr[x].d_mnem);
|
||||||
if (x == SCT_ENLIST)
|
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)
|
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
|
else
|
||||||
pr("\t\t");
|
pr("\t\t");
|
||||||
|
|
||||||
|
@ -198,15 +198,15 @@ budg(void)
|
||||||
pr("\t");
|
pr("\t");
|
||||||
if (np->nat_priorities[x] != 0) {
|
if (np->nat_priorities[x] != 0) {
|
||||||
if ((np->nat_money + income - expenses) > 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];
|
expenses += p_sect[x][1];
|
||||||
} else
|
} else
|
||||||
pr("[%7d]", p_sect[x][1]);
|
pr("[%7ld]", p_sect[x][1]);
|
||||||
} else {
|
} else {
|
||||||
if ((np->nat_money + income - expenses) > 0)
|
if ((np->nat_money + income - expenses) > 0)
|
||||||
pr("(%7d)", p_sect[x][1]);
|
pr("(%7ld)", p_sect[x][1]);
|
||||||
else
|
else
|
||||||
pr("[(%7d)]", p_sect[x][1]);
|
pr("[(%7ld)]", p_sect[x][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pr("\n");
|
pr("\n");
|
||||||
|
@ -266,7 +266,7 @@ budg(void)
|
||||||
np->nat_priorities[PRI_PMAINT], -1 * pmaint);
|
np->nat_priorities[PRI_PMAINT], -1 * pmaint);
|
||||||
}
|
}
|
||||||
if (p_sect[SCT_EFFIC][1]) {
|
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]);
|
p_sect[SCT_EFFIC][0], p_sect[SCT_EFFIC][1]);
|
||||||
expenses += p_sect[SCT_EFFIC][1];
|
expenses += p_sect[SCT_EFFIC][1];
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ budg(void)
|
||||||
n ==
|
n ==
|
||||||
1 ? opt_BIG_CITY ? "city" : "capital" : opt_BIG_CITY ?
|
1 ? opt_BIG_CITY ? "city" : "capital" : opt_BIG_CITY ?
|
||||||
"cities" : "capitals");
|
"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]);
|
opt_BIG_CITY ? "City" : "Capital", in, p_sect[SCT_CAPIT][1]);
|
||||||
expenses += p_sect[SCT_CAPIT][1];
|
expenses += p_sect[SCT_CAPIT][1];
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ budg(void)
|
||||||
pr("Income from bars\t\t%-32s%+8d\n", in, bars);
|
pr("Income from bars\t\t%-32s%+8d\n", in, bars);
|
||||||
}
|
}
|
||||||
pr("Total income%s\n", dotsprintf(buf, "%+60d", income));
|
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 delta\t\t\t\t\t\t %+10d\n", income - expenses);
|
||||||
pr("Estimated new treasury%s\n",
|
pr("Estimated new treasury%s\n",
|
||||||
dotsprintf(buf, "%50d", np->nat_money + income - expenses));
|
dotsprintf(buf, "%50d", np->nat_money + income - expenses));
|
||||||
|
|
|
@ -301,7 +301,7 @@ check_market(void)
|
||||||
nreport(comm.com_maxbidder, N_FIN_TROUBLE,
|
nreport(comm.com_maxbidder, N_FIN_TROUBLE,
|
||||||
comm.com_owner, 1);
|
comm.com_owner, 1);
|
||||||
wu(0, comm.com_maxbidder,
|
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);
|
j, loan.l_amtdue);
|
||||||
wu(0, comm.com_owner,
|
wu(0, comm.com_owner,
|
||||||
"You just extended loan #%d to %s to help with the purchase cose.\n",
|
"You just extended loan #%d to %s to help with the purchase cose.\n",
|
||||||
|
|
|
@ -231,7 +231,7 @@ loan_accept(struct ltcomstr *ltcp)
|
||||||
pr("%s no longer has the funds.\n", cname(ltcp->proposer));
|
pr("%s no longer has the funds.\n", cname(ltcp->proposer));
|
||||||
if (lp->l_amtdue <= 0)
|
if (lp->l_amtdue <= 0)
|
||||||
return RET_FAIL;
|
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;
|
lender->nat_money -= lp->l_amtdue;
|
||||||
putnat(lender);
|
putnat(lender);
|
||||||
|
@ -245,7 +245,7 @@ loan_accept(struct ltcomstr *ltcp)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
accpt(ltcp);
|
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;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ do_demo(struct natstr *natp, struct nstr_sect nstr, int number, s_char *p,
|
||||||
}
|
}
|
||||||
pr("Total new civilians : %d\n", mil_demob);
|
pr("Total new civilians : %d\n", mil_demob);
|
||||||
if (*p == 'y')
|
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);
|
natp->nat_reserve + reserves, reserves);
|
||||||
if (reserves > 0) {
|
if (reserves > 0) {
|
||||||
natp->nat_reserve += reserves;
|
natp->nat_reserve += reserves;
|
||||||
|
|
|
@ -248,7 +248,7 @@ dump(void)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" ");
|
pr(" ");
|
||||||
time(&now);
|
time(&now);
|
||||||
pr("DUMP SECTOR %d\n", now);
|
pr("DUMP SECTOR %ld\n", (long)now);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("x y");
|
pr("x y");
|
||||||
|
|
|
@ -316,7 +316,7 @@ prnat(natid n)
|
||||||
pr("Connected: %d\n", np->nat_connected);
|
pr("Connected: %d\n", np->nat_connected);
|
||||||
pr("Representative <r>: %-20s\n", np->nat_pnam);
|
pr("Representative <r>: %-20s\n", np->nat_pnam);
|
||||||
pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
|
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",
|
pr("Capital <c>: %s\t\t",
|
||||||
xyas(np->nat_xcap, np->nat_ycap, player->cnum));
|
xyas(np->nat_xcap, np->nat_ycap, player->cnum));
|
||||||
pr("Origin <o>: %3s\n",
|
pr("Origin <o>: %3s\n",
|
||||||
|
@ -327,7 +327,7 @@ prnat(natid n)
|
||||||
pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
|
pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
|
||||||
pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
|
pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
|
||||||
pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
|
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);
|
pr("Telegrams <t>: %6d\n", np->nat_tgms);
|
||||||
if (opt_DEMANDUPDATE)
|
if (opt_DEMANDUPDATE)
|
||||||
pr("Updates missed <U>: %d\n", np->nat_missed);
|
pr("Updates missed <U>: %d\n", np->nat_missed);
|
||||||
|
@ -598,14 +598,14 @@ doland(s_char op, int arg, s_char *p, struct sctstr *sect)
|
||||||
case 'p':
|
case 'p':
|
||||||
old = sect->sct_pstage;
|
old = sect->sct_pstage;
|
||||||
new = errcheck(arg, 0, PLG_EXPOSED);
|
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);
|
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
|
||||||
sect->sct_pstage = new;
|
sect->sct_pstage = new;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
old = sect->sct_ptime;
|
old = sect->sct_ptime;
|
||||||
new = errcheck(arg, 0, 255);
|
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);
|
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
|
||||||
sect->sct_ptime = new;
|
sect->sct_ptime = new;
|
||||||
break;
|
break;
|
||||||
|
@ -717,11 +717,11 @@ docountry(s_char op, int arg, s_char *p, float farg, natid nat,
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
benefit(nat, np->nat_reserve < arg);
|
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);
|
np->nat_reserve, arg);
|
||||||
if (np->nat_stat == STAT_NORM)
|
if (np->nat_stat == STAT_NORM)
|
||||||
wu(player->cnum, nat,
|
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);
|
||||||
np->nat_reserve = arg;
|
np->nat_reserve = arg;
|
||||||
break;
|
break;
|
||||||
|
@ -753,9 +753,9 @@ docountry(s_char op, int arg, s_char *p, float farg, natid nat,
|
||||||
np->nat_minused = arg;
|
np->nat_minused = arg;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
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,
|
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);
|
||||||
np->nat_money = arg;
|
np->nat_money = arg;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -131,7 +131,7 @@ enli(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pr("Total new enlistment : %d\n", totalmil);
|
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) {
|
if (totalmil) {
|
||||||
natp->nat_reserve -= totalmil;
|
natp->nat_reserve -= totalmil;
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
|
|
|
@ -108,7 +108,7 @@ fina(void)
|
||||||
pr(" %-2d (%3d) %-8.8s (%3d) %-8.8s ", ni.cur,
|
pr(" %-2d (%3d) %-8.8s (%3d) %-8.8s ", ni.cur,
|
||||||
loan.l_loner, cname(loan.l_loner),
|
loan.l_loner, cname(loan.l_loner),
|
||||||
loan.l_lonee, cname(loan.l_lonee));
|
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);
|
loan.l_irate, loan.l_ldur, loan.l_amtpaid, (int)amt);
|
||||||
if (now > loan.l_duedate)
|
if (now > loan.l_duedate)
|
||||||
pr(" (in arrears)\n");
|
pr(" (in arrears)\n");
|
||||||
|
|
|
@ -356,7 +356,7 @@ apro(void)
|
||||||
free(lbp);
|
free(lbp);
|
||||||
|
|
||||||
if ((nhl) > lhitlim) {
|
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",
|
pr("Found %s in %ld of %ld files and in %ld of %ld lines\n",
|
||||||
bp, nhf, nf, nhl, nl);
|
bp, nhf, nf, nhl, nl);
|
||||||
|
|
|
@ -160,7 +160,7 @@ ldump(void)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" ");
|
pr(" ");
|
||||||
time(&now);
|
time(&now);
|
||||||
pr("DUMP LAND UNITS %d\n", now);
|
pr("DUMP LAND UNITS %ld\n", (long)now);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("id");
|
pr("id");
|
||||||
|
@ -310,7 +310,7 @@ ldump(void)
|
||||||
while (field[n]) {
|
while (field[n]) {
|
||||||
switch (field[n++]) {
|
switch (field[n++]) {
|
||||||
case 1:
|
case 1:
|
||||||
pr(" %0.4s", lchr[(int)land.lnd_type].l_name);
|
pr(" %.4s", lchr[(int)land.lnd_type].l_name);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pr(" %d", xrel(np, land.lnd_x));
|
pr(" %d", xrel(np, land.lnd_x));
|
||||||
|
|
|
@ -58,7 +58,7 @@ lost(void)
|
||||||
prdate();
|
prdate();
|
||||||
nlost = 0;
|
nlost = 0;
|
||||||
time(&now);
|
time(&now);
|
||||||
pr("DUMP LOST ITEMS %d\n", now);
|
pr("DUMP LOST ITEMS %ld\n", (long)now);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("owner ");
|
pr("owner ");
|
||||||
pr("type id x y timestamp\n");
|
pr("type id x y timestamp\n");
|
||||||
|
@ -71,7 +71,7 @@ lost(void)
|
||||||
pr("%d ", lost.lost_owner);
|
pr("%d ", lost.lost_owner);
|
||||||
pr("%d %d ", lost.lost_type, lost.lost_id);
|
pr("%d %d ", lost.lost_type, lost.lost_id);
|
||||||
prxy("%d %d ", lost.lost_x, lost.lost_y, player->cnum);
|
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++;
|
nlost++;
|
||||||
}
|
}
|
||||||
if (nlost == 0) {
|
if (nlost == 0) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ nati(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pr(" The treasury has $%.2f", (double)natp->nat_money);
|
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",
|
pr("Education..........%6.2f Happiness.......%6.2f\n",
|
||||||
(double)natp->nat_level[NAT_ELEV],
|
(double)natp->nat_level[NAT_ELEV],
|
||||||
(double)natp->nat_level[NAT_HLEV]);
|
(double)natp->nat_level[NAT_HLEV]);
|
||||||
|
|
|
@ -58,7 +58,7 @@ ndump(void)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" ");
|
pr(" ");
|
||||||
time(&now);
|
time(&now);
|
||||||
pr("DUMP NUKES %d\n", now);
|
pr("DUMP NUKES %ld\n", (long)now);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("id x y num type\n");
|
pr("id x y num type\n");
|
||||||
|
@ -76,7 +76,7 @@ ndump(void)
|
||||||
pr("%d ", nuk.nuk_uid);
|
pr("%d ", nuk.nuk_uid);
|
||||||
prxy("%d %d", nuk.nuk_x, nuk.nuk_y, player->cnum);
|
prxy("%d %d", nuk.nuk_x, nuk.nuk_y, player->cnum);
|
||||||
pr(" %d", nuk.nuk_types[i]);
|
pr(" %d", nuk.nuk_types[i]);
|
||||||
pr(" %0.5s", nchr[i].n_name);
|
pr(" %.5s", nchr[i].n_name);
|
||||||
pr("\n");
|
pr("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ pdump(void)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" ");
|
pr(" ");
|
||||||
time(&now);
|
time(&now);
|
||||||
pr("DUMP PLANES %d\n", now);
|
pr("DUMP PLANES %ld\n", (long)now);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("id");
|
pr("id");
|
||||||
|
@ -212,7 +212,7 @@ pdump(void)
|
||||||
while (field[n]) {
|
while (field[n]) {
|
||||||
switch (field[n++]) {
|
switch (field[n++]) {
|
||||||
case 1:
|
case 1:
|
||||||
pr(" %0.4s", plchr[(int)plane.pln_type].pl_name);
|
pr(" %.4s", plchr[(int)plane.pln_type].pl_name);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pr(" %d", xrel(natp, plane.pln_x));
|
pr(" %d", xrel(natp, plane.pln_x));
|
||||||
|
@ -285,7 +285,7 @@ pdump(void)
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
if (plane.pln_nuketype != -1) {
|
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;
|
break;
|
||||||
} else
|
} else
|
||||||
pr(" N/A");
|
pr(" N/A");
|
||||||
|
|
|
@ -109,7 +109,7 @@ play_list(struct player *joe)
|
||||||
com = "";
|
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),
|
cname(joe->cnum),
|
||||||
joe->cnum,
|
joe->cnum,
|
||||||
(player->god
|
(player->god
|
||||||
|
|
|
@ -397,7 +397,7 @@ prod(void)
|
||||||
pr(" %4d mil 1.00 $%-5d%3dc",
|
pr(" %4d mil 1.00 $%-5d%3dc",
|
||||||
enlisted, enlisted * 3, enlisted);
|
enlisted, enlisted * 3, enlisted);
|
||||||
pr(" %3dc %4d\n",
|
pr(" %3dc %4d\n",
|
||||||
enlisted, maxmil, maxmil);
|
enlisted, maxmil);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ repa(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if (natp->nat_money < payment) {
|
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;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
player->dolcost += payment;
|
player->dolcost += payment;
|
||||||
|
@ -125,7 +125,7 @@ repa(void)
|
||||||
putnat(loaner);
|
putnat(loaner);
|
||||||
(void)time(&loan.l_lastpay);
|
(void)time(&loan.l_lastpay);
|
||||||
if (owe <= payment) {
|
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);
|
player->cnum, loan_num, payment);
|
||||||
nreport(player->cnum, N_REPAY_LOAN, loan.l_loner, 1);
|
nreport(player->cnum, N_REPAY_LOAN, loan.l_loner, 1);
|
||||||
loan.l_status = LS_FREE;
|
loan.l_status = LS_FREE;
|
||||||
|
|
|
@ -149,7 +149,7 @@ sdump(void)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr(" ");
|
pr(" ");
|
||||||
time(&now);
|
time(&now);
|
||||||
pr("DUMP SHIPS %d\n", now);
|
pr("DUMP SHIPS %ld\n", (long)now);
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("id");
|
pr("id");
|
||||||
|
@ -282,7 +282,7 @@ sdump(void)
|
||||||
while (field[n]) {
|
while (field[n]) {
|
||||||
switch (field[n++]) {
|
switch (field[n++]) {
|
||||||
case 1:
|
case 1:
|
||||||
pr(" %0.4s", mchr[(int)ship.shp_type].m_name);
|
pr(" %.4s", mchr[(int)ship.shp_type].m_name);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pr(" %d", xrel(np, ship.shp_x));
|
pr(" %d", xrel(np, ship.shp_x));
|
||||||
|
|
|
@ -116,7 +116,7 @@ shark(void)
|
||||||
"%s bought loan #%d. You now owe him!\n",
|
"%s bought loan #%d. You now owe him!\n",
|
||||||
cname(player->cnum), arg);
|
cname(player->cnum), arg);
|
||||||
wu(0, loan.l_loner,
|
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);
|
cname(player->cnum), arg, payment);
|
||||||
pr("You now own loan #%d. Go break some legs.\n", arg);
|
pr("You now own loan #%d. Go break some legs.\n", arg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ trad(void)
|
||||||
TRADE_DELAY / 3600.0 - (now - trade.trd_markettime) / 3600.0;
|
TRADE_DELAY / 3600.0 - (now - trade.trd_markettime) / 3600.0;
|
||||||
if (tleft < 0.0)
|
if (tleft < 0.0)
|
||||||
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);
|
trade.trd_maxbidder, tleft);
|
||||||
(void)trade_desc(&trade, &tg); /* XXX */
|
(void)trade_desc(&trade, &tg); /* XXX */
|
||||||
pr("\n");
|
pr("\n");
|
||||||
|
|
|
@ -140,8 +140,8 @@ ef_flush(int type)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (write(ep->fd, ep->cache, size) != size) {
|
if (write(ep->fd, ep->cache, size) != size) {
|
||||||
logerror("ef_flush: %s cache write(%d, %x, %d) -> %d",
|
logerror("ef_flush: %s cache write(%d, %p, %d) -> %d",
|
||||||
ep->name, ep->fd, ep->cache, ep->size, r);
|
ep->name, ep->fd, (void *)ep->cache, ep->size, r);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,8 +278,8 @@ ef_write(int type, int id, caddr_t ptr)
|
||||||
if (ep->prewrite)
|
if (ep->prewrite)
|
||||||
ep->prewrite(id, ptr);
|
ep->prewrite(id, ptr);
|
||||||
if ((r = write(ep->fd, ptr, ep->size)) != ep->size) {
|
if ((r = write(ep->fd, ptr, ep->size)) != ep->size) {
|
||||||
logerror("ef_write: %s #%d write(%d, %x, %d) -> %d",
|
logerror("ef_write: %s #%d write(%d, %p, %d) -> %d",
|
||||||
ep->name, id, ep->fd, ptr, ep->size, r);
|
ep->name, id, ep->fd, (void *)ptr, ep->size, r);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (id >= ep->baseid && id < ep->baseid + ep->cids) {
|
if (id >= ep->baseid && id < ep->baseid + ep->cids) {
|
||||||
|
@ -368,8 +368,8 @@ ef_extend(int type, int count)
|
||||||
if (ep->init)
|
if (ep->init)
|
||||||
ep->init(cur, ptr);
|
ep->init(cur, ptr);
|
||||||
if ((r = write(ep->fd, ptr, ep->size)) != ep->size) {
|
if ((r = write(ep->fd, ptr, ep->size)) != ep->size) {
|
||||||
logerror("ef_extend: %s +#%d write(%d, %x, %d) -> %d",
|
logerror("ef_extend: %s +#%d write(%d, %p, %d) -> %d",
|
||||||
ep->name, count, ep->fd, ptr, ep->size, r);
|
ep->name, count, ep->fd, (void *)ptr, ep->size, r);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ static char **udata; /* pointer to out global context */
|
||||||
|
|
||||||
static pthread_mutex_t mtx_ctxsw; /* thread in critical section */
|
static pthread_mutex_t mtx_ctxsw; /* thread in critical section */
|
||||||
|
|
||||||
|
static void empth_status(char *format, ...) ATTRIBUTE((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
empth_start(void *ctx)
|
empth_start(void *ctx)
|
||||||
|
@ -230,7 +232,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
|
||||||
strerror(eno));
|
strerror(eno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
empth_status("new thread id is %d", t);
|
empth_status("new thread id is %ld", (long)t);
|
||||||
return ctx;
|
return ctx;
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
bad:
|
bad:
|
||||||
|
|
|
@ -170,7 +170,7 @@ lwpReschedule(void)
|
||||||
|
|
||||||
if (LwpCurrent != nextp && !(LwpCurrent && i)) {
|
if (LwpCurrent != nextp && !(LwpCurrent && i)) {
|
||||||
/* restore previous context */
|
/* restore previous context */
|
||||||
lwpStatus(nextp, "switch in", nextp->pri);
|
lwpStatus(nextp, "switch in %d", nextp->pri);
|
||||||
LwpCurrent = nextp;
|
LwpCurrent = nextp;
|
||||||
*LwpContextPtr = LwpCurrent->ud;
|
*LwpContextPtr = LwpCurrent->ud;
|
||||||
#ifdef BOUNDS_CHECK
|
#ifdef BOUNDS_CHECK
|
||||||
|
@ -296,8 +296,8 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name,
|
||||||
newp->dead = 0;
|
newp->dead = 0;
|
||||||
if (flags & LWP_STACKCHECK)
|
if (flags & LWP_STACKCHECK)
|
||||||
lwpStackCheckInit(newp);
|
lwpStackCheckInit(newp);
|
||||||
lwpStatus(newp, "creating process structure sbtm: %d",
|
lwpStatus(newp, "creating process structure sbtm: %p",
|
||||||
(int)newp->sbtm);
|
newp->sbtm);
|
||||||
lwpReady(newp);
|
lwpReady(newp);
|
||||||
lwpReady(LwpCurrent);
|
lwpReady(LwpCurrent);
|
||||||
#ifdef UCONTEXT
|
#ifdef UCONTEXT
|
||||||
|
@ -316,7 +316,7 @@ lwpDestroy(struct lwpProc *proc)
|
||||||
lwpStackCheckUsed(proc);
|
lwpStackCheckUsed(proc);
|
||||||
lwpStackCheck(proc);
|
lwpStackCheck(proc);
|
||||||
}
|
}
|
||||||
lwpStatus(proc, "destroying sbtm: %d", (int)proc->sbtm);
|
lwpStatus(proc, "destroying sbtm: %p", proc->sbtm);
|
||||||
proc->entry = 0;
|
proc->entry = 0;
|
||||||
proc->ud = 0;
|
proc->ud = 0;
|
||||||
proc->argv = 0;
|
proc->argv = 0;
|
||||||
|
@ -531,7 +531,7 @@ lwpStackCheck(struct lwpProc *newp)
|
||||||
amt = (i + 1) * sizeof(long);
|
amt = (i + 1) * sizeof(long);
|
||||||
}
|
}
|
||||||
lwpStatus(newp, "Thread stack overflowed %d bytes (of %u)",
|
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);
|
return (0);
|
||||||
}
|
}
|
||||||
for (lp = newp->lowmark, i = 0; i < LWP_REDZONE / sizeof(long);
|
for (lp = newp->lowmark, i = 0; i < LWP_REDZONE / sizeof(long);
|
||||||
|
@ -551,7 +551,7 @@ lwpStackCheck(struct lwpProc *newp)
|
||||||
amt = (LWP_REDZONE - i + 1) * sizeof(long);
|
amt = (LWP_REDZONE - i + 1) * sizeof(long);
|
||||||
}
|
}
|
||||||
lwpStatus(newp, "Thread stack underflow %d bytes (of %u)",
|
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 (0);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -592,7 +592,7 @@ lwpStackCheckUsed(struct lwpProc *newp)
|
||||||
}
|
}
|
||||||
lwpStatus(newp, "stack use: %u bytes (of %u total)",
|
lwpStatus(newp, "stack use: %u bytes (of %u total)",
|
||||||
(i * sizeof(long)) - LWP_REDZONE,
|
(i * sizeof(long)) - LWP_REDZONE,
|
||||||
newp->size - 2 * LWP_REDZONE - sizeof(stkalign_t));
|
newp->size - 2 * LWP_REDZONE - (int)sizeof(stkalign_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -128,7 +128,7 @@ lwpWakeupFd(struct lwpProc *proc)
|
||||||
void
|
void
|
||||||
lwpSleepUntil(long int until)
|
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;
|
LwpCurrent->runtime = until;
|
||||||
if (LwpSelect.maxfd == 0 && LwpSelect.delayq.head == 0) {
|
if (LwpSelect.maxfd == 0 && LwpSelect.delayq.head == 0) {
|
||||||
/* select process is sleeping until first waiter arrives */
|
/* select process is sleeping until first waiter arrives */
|
||||||
|
|
|
@ -171,7 +171,7 @@ gamedown(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (read(downf, buf, tgm.tel_length) != tgm.tel_length) {
|
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);
|
close(downf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ show_motd(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if (read(upf, buf, tgm.tel_length) != tgm.tel_length) {
|
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);
|
close(upf);
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ caploss(struct sctstr *sp, natid coun, s_char *msg)
|
||||||
player->dolcost -= gain;
|
player->dolcost -= gain;
|
||||||
} else
|
} else
|
||||||
gain = 0;
|
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,
|
wu(0, coun,
|
||||||
"Your capital has been moved to %s. You must use 'capital' to reset it.\n",
|
"Your capital has been moved to %s. You must use 'capital' to reset it.\n",
|
||||||
xyas(natp->nat_xcap, natp->nat_ycap, coun));
|
xyas(natp->nat_xcap, natp->nat_ycap, coun));
|
||||||
|
|
|
@ -42,10 +42,10 @@ chkmoney(long int cost, long int cash, s_char *argp)
|
||||||
s_char *p;
|
s_char *p;
|
||||||
|
|
||||||
if (cash > 0 && cost > cash / 2) {
|
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);
|
cost, cash);
|
||||||
if (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);
|
p = getstarg(argp, "Are you sure that you want to do this? ", buf);
|
||||||
if (p == 0 || *p != 'y')
|
if (p == 0 || *p != 'y')
|
||||||
|
@ -64,7 +64,7 @@ check_cost(int looping, int cost, long int cash, int *warnedp,
|
||||||
if (looping && cash > 0 && player->dolcost + cost > cash
|
if (looping && cash > 0 && player->dolcost + cost > cash
|
||||||
&& *warnedp < 2) {
|
&& *warnedp < 2) {
|
||||||
*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);
|
p = getstarg(argp, "Are you sure you wish to continue? ", buf);
|
||||||
if (p == 0 || *p != 'y')
|
if (p == 0 || *p != 'y')
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -73,7 +73,7 @@ check_cost(int looping, int cost, long int cash, int *warnedp,
|
||||||
if (looping && cash > 0 && player->dolcost > cash / 2 && *warnedp < 1) {
|
if (looping && cash > 0 && player->dolcost > cash / 2 && *warnedp < 1) {
|
||||||
*warnedp = 1;
|
*warnedp = 1;
|
||||||
pr("WARNING. You have just spent over half of your money.\n");
|
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);
|
cash - (long)player->dolcost);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -72,7 +72,7 @@ disloan(int n, register struct lonstr *loan)
|
||||||
pr("\nLoan #%d from %s to", n, cname(loan->l_loner));
|
pr("\nLoan #%d from %s to", n, cname(loan->l_loner));
|
||||||
pr(" %s\n", cname(loan->l_lonee));
|
pr(" %s\n", cname(loan->l_lonee));
|
||||||
if (loan->l_status == LS_PROPOSED) {
|
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);
|
loan->l_amtdue, loan->l_irate);
|
||||||
pr(" duration(days)=%d\n", loan->l_ldur);
|
pr(" duration(days)=%d\n", loan->l_ldur);
|
||||||
if (loan->l_duedate < now) {
|
if (loan->l_duedate < now) {
|
||||||
|
@ -103,7 +103,7 @@ disloan(int n, register struct lonstr *loan)
|
||||||
owe = ((double)loan->l_amtdue *
|
owe = ((double)loan->l_amtdue *
|
||||||
(((double)normaltime * rate + 1.0) +
|
(((double)normaltime * rate + 1.0) +
|
||||||
((double)doubletime * rate * 2.0))) + 0.5;
|
((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);
|
pr("Amount due (if paid now) $%.2f", owe);
|
||||||
if (doubletime == 0) {
|
if (doubletime == 0) {
|
||||||
pr(" (if paid on due date) $%.2f\n",
|
pr(" (if paid on due date) $%.2f\n",
|
||||||
|
|
|
@ -649,7 +649,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
"%s fires at %s %s at %s\n",
|
"%s fires at %s %s at %s\n",
|
||||||
prship(sp), cname(victim), s, xyas(x, y, sp->shp_own));
|
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));
|
cname(sp->shp_own), prship(sp), xyas(x, y, victim));
|
||||||
|
|
||||||
sp->shp_item[I_SHELL] = shell - gun;
|
sp->shp_item[I_SHELL] = shell - gun;
|
||||||
|
@ -1473,7 +1473,7 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
|
||||||
if (nukedam) {
|
if (nukedam) {
|
||||||
if (mission == MI_INTERDICT) {
|
if (mission == MI_INTERDICT) {
|
||||||
wu(0, pp->pln_own,
|
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);
|
prplane(pp), nukedam, cname(victim), s);
|
||||||
dam += nukedam;
|
dam += nukedam;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ decode(natid cnum, long int code, void *addr, int type)
|
||||||
val = yrel(np, val);
|
val = yrel(np, val);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logerror("bad type in decode: %x!\n", code & NSC_TMASK);
|
logerror("bad type in decode: %lx!\n", code & NSC_TMASK);
|
||||||
val = 0;
|
val = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,10 +536,10 @@ retreat_land1(struct lndstr *lp, s_char code, int orig)
|
||||||
if (mines > 0 && (sect.sct_oldown != lp->lnd_own) &&
|
if (mines > 0 && (sect.sct_oldown != lp->lnd_own) &&
|
||||||
chance(DMINE_HITCHANCE(mines))) {
|
chance(DMINE_HITCHANCE(mines))) {
|
||||||
wu(0, lp->lnd_own,
|
wu(0, lp->lnd_own,
|
||||||
"%s %s,\nand hit a mine while retreating!\n", prland(lp),
|
"%s %s,\nand hit a mine in %s while retreating!\n",
|
||||||
conditions[findcondition(code)].desc[orig], xyas(newx, newy,
|
prland(lp),
|
||||||
lp->
|
conditions[findcondition(code)].desc[orig],
|
||||||
lnd_own));
|
xyas(newx, newy, lp->lnd_own));
|
||||||
nreport(lp->lnd_own, N_LHIT_MINE, 0, 1);
|
nreport(lp->lnd_own, N_LHIT_MINE, 0, 1);
|
||||||
m = MINE_LDAMAGE();
|
m = MINE_LDAMAGE();
|
||||||
landdamage(lp, m);
|
landdamage(lp, m);
|
||||||
|
|
|
@ -94,10 +94,9 @@ finish_sects(int etu)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logerror("Allocated '%d' bytes '%d' indices\n",
|
logerror("Allocated '%lu' bytes '%d' indices\n",
|
||||||
((WORLD_X * WORLD_Y) * sizeof(struct distinfo)),
|
(unsigned long)(WORLD_X * WORLD_Y * sizeof(struct distinfo)),
|
||||||
(WORLD_X * WORLD_Y));
|
WORLD_X * WORLD_Y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wipe it clean */
|
/* Wipe it clean */
|
||||||
|
|
|
@ -179,7 +179,7 @@ prod_nat(int etu)
|
||||||
levels[n][NAT_RLEV] =
|
levels[n][NAT_RLEV] =
|
||||||
limit_level(levels[n][NAT_RLEV] / 1, NAT_RLEV, 0) * 1;
|
limit_level(levels[n][NAT_RLEV] / 1, NAT_RLEV, 0) * 1;
|
||||||
wu((natid)0, n,
|
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);
|
pop - 1, hap, edu);
|
||||||
}
|
}
|
||||||
if (ally_factor > 0.0)
|
if (ally_factor > 0.0)
|
||||||
|
@ -212,9 +212,9 @@ prod_nat(int etu)
|
||||||
if ((sea_money[n] != 0) || (air_money[n] != 0) ||
|
if ((sea_money[n] != 0) || (air_money[n] != 0) ||
|
||||||
(lnd_money[n] != 0))
|
(lnd_money[n] != 0))
|
||||||
wu((natid)0, n,
|
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]);
|
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]);
|
np->nat_money - money[n]);
|
||||||
if (opt_LOSE_CONTACT) {
|
if (opt_LOSE_CONTACT) {
|
||||||
for (cn = 0; cn <= MAXNOC; cn++) {
|
for (cn = 0; cn <= MAXNOC; cn++) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ update_sched(void *unused)
|
||||||
delta += wind;
|
delta += wind;
|
||||||
}
|
}
|
||||||
logerror("Next update at %s", ctime(&update_time));
|
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 */
|
/* sleep until update is scheduled to go off */
|
||||||
empth_sleep(update_time);
|
empth_sleep(update_time);
|
||||||
time(&now);
|
time(&now);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue