Use int instead of long for money

Code dealing with money mixes int and long pretty haphazardly.
Harmless, because practical amounts of money fit into int on any
machine capable of running the server.  Clean up anyway.
This commit is contained in:
Markus Armbruster 2013-01-13 17:59:29 +01:00
parent 5ed02791f5
commit 5f46ced826
24 changed files with 73 additions and 73 deletions

View file

@ -51,11 +51,11 @@ void bp_put_avail(struct bp *, struct sctstr *, int);
int get_materials(struct sctstr *, struct bp *, int *, int); int get_materials(struct sctstr *, struct bp *, int *, int);
extern long money[MAXNOC]; extern int money[MAXNOC];
extern int pops[MAXNOC]; extern int pops[MAXNOC];
extern long sea_money[MAXNOC]; extern int sea_money[MAXNOC];
extern long lnd_money[MAXNOC]; extern int lnd_money[MAXNOC];
extern long air_money[MAXNOC]; extern int air_money[MAXNOC];
extern int tpops[MAXNOC]; extern int tpops[MAXNOC];
extern float levels[MAXNOC][4]; extern float levels[MAXNOC][4];

View file

@ -28,7 +28,7 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Marc Olzheim, 2004 * Marc Olzheim, 2004
* Markus Armbruster, 2004-2012 * Markus Armbruster, 2004-2013
*/ */
/* /*
@ -208,7 +208,7 @@ EMPCFBOTH("players_at_00", players_at_00, int, NSC_INT, 0,
"Players have their coordinate system at deity 0,0 (0 - no, 1 - yes)") "Players have their coordinate system at deity 0,0 (0 - no, 1 - yes)")
EMPCFBOTH("at_least_one_100", at_least_one_100, int, NSC_INT, KM_INTERNAL, EMPCFBOTH("at_least_one_100", at_least_one_100, int, NSC_INT, KM_INTERNAL,
"Initialize new countries with at least one sector with 100 of all resource") "Initialize new countries with at least one sector with 100 of all resource")
EMPCFBOTH("start_cash", start_cash, long, NSC_LONG, KM_INTERNAL, EMPCFBOTH("start_cash", start_cash, int, NSC_INT, KM_INTERNAL,
"Starting cash for new countries") "Starting cash for new countries")
EMPCF_COMMENT("\n\n### Technology/Research/Education/Happiness") EMPCF_COMMENT("\n\n### Technology/Research/Education/Happiness")

View file

@ -52,8 +52,8 @@ struct lonstr {
signed char l_status; /* loan status */ signed char l_status; /* loan status */
int l_irate; /* interest rate */ int l_irate; /* interest rate */
int l_ldur; /* intended duration */ int l_ldur; /* intended duration */
long l_amtpaid; /* amount paid so far */ int l_amtpaid; /* amount paid so far */
long l_amtdue; /* amount still owed */ int l_amtdue; /* amount still owed */
time_t l_lastpay; /* date of most recent payment */ time_t l_lastpay; /* date of most recent payment */
time_t l_duedate; /* date after which interest doubles, etc */ time_t l_duedate; /* date after which interest doubles, etc */
}; };

View file

@ -106,7 +106,7 @@ struct natstr {
short nat_btu; /* bureaucratic time units */ short nat_btu; /* bureaucratic time units */
short nat_access; /* The tick when BTUs were last updated */ short nat_access; /* The tick when BTUs were last updated */
int nat_reserve; /* military reserves */ int nat_reserve; /* military reserves */
long nat_money; /* moola */ int nat_money; /* moola */
time_t nat_last_login; /* time of last login, 0 menas never */ time_t nat_last_login; /* time of last login, 0 menas never */
time_t nat_last_logout; /* time of last logout, 0 means never */ time_t nat_last_logout; /* time of last logout, 0 means never */
time_t nat_newstim; /* date news last read */ time_t nat_newstim; /* date news last read */

View file

@ -728,7 +728,7 @@ extern void sail_ship(natid);
extern void do_fallout(struct sctstr *, int); extern void do_fallout(struct sctstr *, int);
extern void spread_fallout(struct sctstr *, int); extern void spread_fallout(struct sctstr *, int);
extern void decay_fallout(struct sctstr *, int); extern void decay_fallout(struct sctstr *, int);
extern void produce_sect(int, int, struct bp *, long [][2]); extern void produce_sect(int, int, struct bp *, int[][2]);
/* ship.c */ /* ship.c */
extern int prod_ship(int, int, struct bp *, int); extern int prod_ship(int, int, struct bp *, int);

View file

@ -50,7 +50,7 @@ struct trdstr {
/* end of part matching struct empobj */ /* end of part matching struct empobj */
short trd_type; short trd_type;
int trd_unitid; int trd_unitid;
long trd_price; int trd_price;
int trd_maxbidder; int trd_maxbidder;
time_t trd_markettime; time_t trd_markettime;
coord trd_x; /* destination for teleporting trade */ coord trd_x; /* destination for teleporting trade */

View file

@ -42,7 +42,7 @@
#include "optlist.h" #include "optlist.h"
#include "product.h" #include "product.h"
static void calc_all(long (*p_sect)[2], int *taxes, int *Ncivs, static void calc_all(int (*p_sect)[2], int *taxes, int *Ncivs,
int *Nuws, int *bars, int *Nbars, int *mil, int *Nuws, int *bars, int *Nbars, int *mil,
int *ships, int *sbuild, int *nsbuild, int *smaint, int *ships, int *sbuild, int *nsbuild, int *smaint,
int *units, int *lbuild, int *nlbuild, int *lmaint, int *units, int *lbuild, int *nlbuild, int *lmaint,
@ -53,7 +53,7 @@ int
budg(void) budg(void)
{ {
int i; int i;
long p_sect[SCT_BUDG_MAX+1][2]; int p_sect[SCT_BUDG_MAX+1][2];
int taxes, Ncivs, Nuws, bars, Nbars, mil; int taxes, Ncivs, Nuws, bars, Nbars, mil;
int ships, sbuild, nsbuild, smaint; int ships, sbuild, nsbuild, smaint;
int units, lbuild, nlbuild, lmaint; int units, lbuild, nlbuild, lmaint;
@ -84,12 +84,12 @@ budg(void)
continue; continue;
pr("%-17s\t\t", dchr[i].d_name); pr("%-17s\t\t", dchr[i].d_name);
if (i == SCT_ENLIST) if (i == SCT_ENLIST)
pr("%ld mil \t", p_sect[i][0]); pr("%d mil \t", p_sect[i][0]);
else if (dchr[i].d_prd >= 0) else if (dchr[i].d_prd >= 0)
pr("%ld %-7s\t", p_sect[i][0], pchr[dchr[i].d_prd].p_sname); pr("%d %-7s\t", p_sect[i][0], pchr[dchr[i].d_prd].p_sname);
else else
pr("\t\t"); pr("\t\t");
pr("\t\t%8ld\n", p_sect[i][1]); pr("\t\t%8d\n", p_sect[i][1]);
expenses += p_sect[i][1]; expenses += p_sect[i][1];
} }
@ -129,16 +129,16 @@ budg(void)
} }
if (p_sect[SCT_EFFIC][1]) { if (p_sect[SCT_EFFIC][1]) {
sprintf(buf, "%ld sector%s", sprintf(buf, "%d sector%s",
p_sect[SCT_EFFIC][0], splur(p_sect[SCT_EFFIC][0])); p_sect[SCT_EFFIC][0], splur(p_sect[SCT_EFFIC][0]));
pr("Sector building\t\t\t%-16s\t\t%8ld\n", pr("Sector building\t\t\t%-16s\t\t%8d\n",
buf, p_sect[SCT_EFFIC][1]); buf, p_sect[SCT_EFFIC][1]);
expenses += p_sect[SCT_EFFIC][1]; expenses += p_sect[SCT_EFFIC][1];
} }
if (p_sect[SCT_MAINT][0]) { if (p_sect[SCT_MAINT][0]) {
sprintf(buf, "%ld sector%s", sprintf(buf, "%d sector%s",
p_sect[SCT_MAINT][0], splur(p_sect[SCT_MAINT][0])); p_sect[SCT_MAINT][0], splur(p_sect[SCT_MAINT][0]));
pr("Sector maintenance\t\t%-16s\t\t%8ld\n", pr("Sector maintenance\t\t%-16s\t\t%8d\n",
buf, p_sect[SCT_MAINT][1]); buf, p_sect[SCT_MAINT][1]);
expenses += p_sect[SCT_MAINT][1]; expenses += p_sect[SCT_MAINT][1];
} }
@ -159,7 +159,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 %10ld\n", np->nat_money); pr("Balance forward\t\t\t\t\t\t %10d\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));
@ -172,7 +172,7 @@ budg(void)
} }
static void static void
calc_all(long p_sect[][2], calc_all(int p_sect[][2],
int *taxes, int *Ncivs, int *Nuws, int *bars, int *Nbars, int *mil, int *taxes, int *Ncivs, int *Nuws, int *bars, int *Nbars, int *mil,
int *ships, int *sbuild, int *nsbuild, int *smaint, int *ships, int *sbuild, int *nsbuild, int *smaint,
int *units, int *lbuild, int *nlbuild, int *lmaint, int *units, int *lbuild, int *nlbuild, int *lmaint,

View file

@ -136,9 +136,9 @@ coll(void)
} else { } else {
(void)time(&loan.l_lastpay); (void)time(&loan.l_lastpay);
owed -= pay; owed -= pay;
loan.l_amtdue = (long)owed; loan.l_amtdue = (int)owed;
pay += loan.l_amtpaid; pay += loan.l_amtpaid;
loan.l_amtpaid = pay; loan.l_amtpaid = (int)pay;
wu(0, loan.l_lonee, wu(0, loan.l_lonee,
"%s seized %s in partial payment of loan %d.\n", "%s seized %s in partial payment of loan %d.\n",
cname(player->cnum), cname(player->cnum),

View file

@ -222,7 +222,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 $%ld at the same terms.\n", lp->l_amtdue); pr("You may borrow $%d at the same terms.\n", lp->l_amtdue);
} }
lender->nat_money -= lp->l_amtdue; lender->nat_money -= lp->l_amtdue;
putnat(lender); putnat(lender);
@ -236,7 +236,7 @@ loan_accept(struct ltcomstr *ltcp)
return RET_FAIL; return RET_FAIL;
} }
accpt(ltcp); accpt(ltcp);
pr("You are now $%ld richer (sort of).\n", lp->l_amtdue); pr("You are now $%d richer (sort of).\n", lp->l_amtdue);
return RET_OK; return RET_OK;
} }

View file

@ -31,7 +31,7 @@
* Chad Zabel, 1994 * Chad Zabel, 1994
* Steve McClure, 1998-2000 * Steve McClure, 1998-2000
* Ron Koenderink, 2003-2009 * Ron Koenderink, 2003-2009
* Markus Armbruster, 2003-2011 * Markus Armbruster, 2003-2013
*/ */
#include <config.h> #include <config.h>
@ -302,7 +302,7 @@ prnat(struct natstr *np)
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>: $%6ld\n", np->nat_money); pr("Money <M>: $%6d\n", np->nat_money);
pr("Telegrams <t>: %6d\n", np->nat_tgms); pr("Telegrams <t>: %6d\n", np->nat_tgms);
if (opt_HIDDEN) { if (opt_HIDDEN) {
pr("Countries contacted: "); pr("Countries contacted: ");
@ -709,9 +709,9 @@ docountry(char op, int arg, char *p, struct natstr *np)
np->nat_timeused = arg; np->nat_timeused = arg;
break; break;
case 'M': case 'M':
pr("Money changed from %ld to %d\n", np->nat_money, arg); pr("Money changed from %d to %d\n", np->nat_money, arg);
wu(player->cnum, nat, wu(player->cnum, nat,
"Money changed from %ld to %d by divine intervention.\n", "Money changed from %d to %d by divine intervention.\n",
np->nat_money, arg); np->nat_money, arg);
np->nat_money = arg; np->nat_money = arg;
break; break;

View file

@ -66,7 +66,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 %5ld %7.0f", pr("%3d%% %3d %5d %7.0f",
loan.l_irate, loan.l_ldur, loan.l_amtpaid, loan.l_irate, loan.l_ldur, loan.l_amtpaid,
ceil(loan_owed(&loan, now))); ceil(loan_owed(&loan, now)));
if (now > loan.l_duedate) if (now > loan.l_duedate)

View file

@ -51,7 +51,7 @@ hard(void)
struct nstr_item ni; struct nstr_item ni;
struct sctstr sect; struct sctstr sect;
char buf[1024]; char buf[1024];
long cash; int cash;
struct natstr *natp; struct natstr *natp;
if (!snxtitem(&ni, EF_PLANE, player->argp[1], NULL)) if (!snxtitem(&ni, EF_PLANE, player->argp[1], NULL))

View file

@ -46,7 +46,7 @@ repa(void)
struct natstr *loaner; struct natstr *loaner;
int loan_num; int loan_num;
int payment; int payment;
long newdue; int newdue;
char *cp; char *cp;
time_t now; time_t now;
char buf[1024]; char buf[1024];
@ -75,13 +75,13 @@ repa(void)
if (payment <= 0) if (payment <= 0)
return RET_SYN; return RET_SYN;
newdue = (long)ceil(loan_owed(&loan, time(&now)) - payment); newdue = (int)ceil(loan_owed(&loan, time(&now)) - payment);
if (newdue < 0) { if (newdue < 0) {
pr("You don't owe that much.\n"); pr("You don't owe that much.\n");
return RET_FAIL; return RET_FAIL;
} }
if (natp->nat_money < payment) { if (natp->nat_money < payment) {
pr("You only have $%ld.\n", natp->nat_money); pr("You only have $%d.\n", natp->nat_money);
return RET_FAIL; return RET_FAIL;
} }
player->dolcost += payment; player->dolcost += payment;

View file

@ -48,7 +48,7 @@ shark(void)
struct natstr *natp; struct natstr *natp;
struct natstr *oldie; struct natstr *oldie;
double owed; double owed;
long payment; int payment;
char buf[1024]; char buf[1024];
if (!opt_LOANS) { if (!opt_LOANS) {
@ -78,7 +78,7 @@ shark(void)
} }
pr("That loan is worth $%.2f.\n", owed); pr("That loan is worth $%.2f.\n", owed);
natp = getnatp(player->cnum); natp = getnatp(player->cnum);
payment = (long)ceil(owed * (1.0 + loan.l_irate / 100.0)); payment = (int)ceil(owed * (1.0 + loan.l_irate / 100.0));
if (payment > natp->nat_money - 100.0) { if (payment > natp->nat_money - 100.0) {
pr("You do not have enough to cover that loan\n"); pr("You do not have enough to cover that loan\n");
return RET_FAIL; return RET_FAIL;
@ -87,7 +87,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 %ld\n", "%s bought loan #%d out from under you for %d\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);
} }

View file

@ -30,6 +30,7 @@
* Dave Pare, 1986 * Dave Pare, 1986
* Pat Loney, 1992 * Pat Loney, 1992
* Steve McClure, 1996-2000 * Steve McClure, 1996-2000
* Markus Armbruster, 2004-2013
*/ */
#include <config.h> #include <config.h>
@ -102,7 +103,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("$%7ld %2d %5.2f hrs ", pr("$%7d %2d %5.2f hrs ",
trade.trd_price, trade.trd_maxbidder, tleft); trade.trd_price, trade.trd_maxbidder, tleft);
trade_desc(&tg.gen); /* XXX */ trade_desc(&tg.gen); /* XXX */
pr("\n"); pr("\n");

View file

@ -83,7 +83,7 @@ lupgr(void)
int n; int n;
int tlev; int tlev;
int avail, cost; int avail, cost;
long cash; int cash;
if (!snxtitem(&ni, EF_LAND, player->argp[2], NULL)) if (!snxtitem(&ni, EF_LAND, player->argp[2], NULL))
return RET_SYN; return RET_SYN;
@ -163,7 +163,7 @@ supgr(void)
int n; int n;
int tlev; int tlev;
int avail, cost; int avail, cost;
long cash; int cash;
if (!snxtitem(&ni, EF_SHIP, player->argp[2], NULL)) if (!snxtitem(&ni, EF_SHIP, player->argp[2], NULL))
return RET_SYN; return RET_SYN;
@ -242,7 +242,7 @@ pupgr(void)
int n; int n;
int tlev; int tlev;
int avail, cost; int avail, cost;
long cash; int cash;
if (!snxtitem(&ni, EF_PLANE, player->argp[2], NULL)) if (!snxtitem(&ni, EF_PLANE, player->argp[2], NULL))
return RET_SYN; return RET_SYN;

View file

@ -460,8 +460,8 @@ struct castr loan_ca[] = {
EF_AGREEMENT_STATUS, 0}, EF_AGREEMENT_STATUS, 0},
{"irate", fldoff(l_irate), NSC_INT, 0, NULL, EF_BAD, 0}, {"irate", fldoff(l_irate), NSC_INT, 0, NULL, EF_BAD, 0},
{"ldur", fldoff(l_ldur), NSC_INT, 0, NULL, EF_BAD, 0}, {"ldur", fldoff(l_ldur), NSC_INT, 0, NULL, EF_BAD, 0},
{"amtpaid", fldoff(l_amtpaid), NSC_LONG, 0, NULL, EF_BAD, 0}, {"amtpaid", fldoff(l_amtpaid), NSC_INT, 0, NULL, EF_BAD, 0},
{"amtdue", fldoff(l_amtdue), NSC_LONG, 0, NULL, EF_BAD, 0}, {"amtdue", fldoff(l_amtdue), NSC_INT, 0, NULL, EF_BAD, 0},
{"lastpay", fldoff(l_lastpay), NSC_TIME, 0, NULL, EF_BAD, 0}, {"lastpay", fldoff(l_lastpay), NSC_TIME, 0, NULL, EF_BAD, 0},
{"duedate", fldoff(l_duedate), NSC_TIME, 0, NULL, EF_BAD, 0}, {"duedate", fldoff(l_duedate), NSC_TIME, 0, NULL, EF_BAD, 0},
{NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0} {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
@ -526,7 +526,7 @@ struct castr trade_ca[] = {
{"type", fldoff(trd_type), NSC_CHAR, 0, NULL, EF_TABLE, 0}, {"type", fldoff(trd_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
/* unitid's ca_table given by type, but can't express that: */ /* unitid's ca_table given by type, but can't express that: */
{"unitid", fldoff(trd_unitid), NSC_INT, 0, NULL, EF_BAD, 0}, {"unitid", fldoff(trd_unitid), NSC_INT, 0, NULL, EF_BAD, 0},
{"price", fldoff(trd_price), NSC_LONG, 0, NULL, EF_BAD, 0}, {"price", fldoff(trd_price), NSC_INT, 0, NULL, EF_BAD, 0},
{"maxbidder", fldoff(trd_maxbidder), NSC_INT, 0, NULL, EF_NATION, 0}, {"maxbidder", fldoff(trd_maxbidder), NSC_INT, 0, NULL, EF_NATION, 0},
{"markettime", fldoff(trd_markettime), NSC_TIME, 0, NULL, EF_BAD, 0}, {"markettime", fldoff(trd_markettime), NSC_TIME, 0, NULL, EF_BAD, 0},
/* should let maxbidder access xloc, yloc, but can't express that: */ /* should let maxbidder access xloc, yloc, but can't express that: */
@ -575,7 +575,7 @@ struct castr cou_ca[] = {
{"btu", fldoff(nat_btu), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"btu", fldoff(nat_btu), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"access", fldoff(nat_access), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"access", fldoff(nat_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"milreserve", fldoff(nat_reserve), NSC_INT, 0, NULL, EF_BAD, 0}, {"milreserve", fldoff(nat_reserve), NSC_INT, 0, NULL, EF_BAD, 0},
{"money", fldoff(nat_money), NSC_LONG, 0, NULL, EF_BAD, 0}, {"money", fldoff(nat_money), NSC_INT, 0, NULL, EF_BAD, 0},
{"login", fldoff(nat_last_login), NSC_TIME, 0, NULL, EF_BAD, 0}, {"login", fldoff(nat_last_login), NSC_TIME, 0, NULL, EF_BAD, 0},
{"logout", fldoff(nat_last_logout), NSC_TIME, 0, NULL, EF_BAD, 0}, {"logout", fldoff(nat_last_logout), NSC_TIME, 0, NULL, EF_BAD, 0},
{"newstim", fldoff(nat_newstim), NSC_TIME, 0, NULL, EF_BAD, 0}, {"newstim", fldoff(nat_newstim), NSC_TIME, 0, NULL, EF_BAD, 0},

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Ken Stevens, 1995 * Ken Stevens, 1995
* Steve McClure, 1996 * Steve McClure, 1996
* Markus Armbruster, 2004-2012 * Markus Armbruster, 2004-2013
*/ */
#include <config.h> #include <config.h>
@ -209,7 +209,7 @@ float trade_ally_cut = 0.10; /* 10% bonus for ally you trade with */
int torpedo_damage = 40; /* damage is X + 1dX + 1dX, so 40+1d40+1d40 */ int torpedo_damage = 40; /* damage is X + 1dX + 1dX, so 40+1d40+1d40 */
long start_cash = 25000; int start_cash = 25000;
/* initial levels */ /* initial levels */
float start_education = 0.0; float start_education = 0.0;

View file

@ -28,7 +28,7 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Steve McClure, 2000 * Steve McClure, 2000
* Markus Armbruster, 2007-2008 * Markus Armbruster, 2007-2013
*/ */
#include <config.h> #include <config.h>
@ -49,8 +49,7 @@ caploss(struct sctstr *sp, natid coun, char *msg)
struct natstr *natp; struct natstr *natp;
struct lonstr loan; struct lonstr loan;
struct comstr comm; struct comstr comm;
long lose; int lose, gain;
long gain;
char *verb; char *verb;
int loan_num, comm_num; int loan_num, comm_num;
@ -81,9 +80,9 @@ caploss(struct sctstr *sp, natid coun, char *msg)
verb = sp->sct_own ? "sacked" : "obliterated"; verb = sp->sct_own ? "sacked" : "obliterated";
wu(0, coun, "* %s just %s your capital! *\n", wu(0, coun, "* %s just %s your capital! *\n",
cname(player->cnum), verb); cname(player->cnum), verb);
wu(0, coun, "You lost $%ld and they gained $%ld\n", lose, gain); wu(0, coun, "You lost $%d and they gained $%d\n", lose, gain);
wu(0, coun, "You need to use 'capital' to activate a new capital.\n"); wu(0, coun, "You need to use 'capital' to activate a new capital.\n");
wu(0, 0, "%s just %s %s's capital and gained $%ld\n", wu(0, 0, "%s just %s %s's capital and gained $%d\n",
cname(player->cnum), verb, cname(coun), gain); cname(player->cnum), verb, cname(coun), gain);
if (opt_LOANS && sp->sct_own) { if (opt_LOANS && sp->sct_own) {

View file

@ -67,7 +67,7 @@ disloan(int n, 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=$%ld interest rate=%d%%", pr("(proposed) principal=$%d 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) {
@ -81,7 +81,7 @@ disloan(int n, struct lonstr *loan)
return 1; return 1;
} }
pr("Amount paid to date $%ld\n", loan->l_amtpaid); pr("Amount paid to date $%d\n", loan->l_amtpaid);
pr("Amount due (if paid now) $%.2f", loan_owed(loan, now)); pr("Amount due (if paid now) $%.2f", loan_owed(loan, now));
if (now <= loan->l_duedate) { if (now <= loan->l_duedate) {
pr(" (if paid on due date) $%.2f\n", pr(" (if paid on due date) $%.2f\n",

View file

@ -44,11 +44,11 @@
#include "unit.h" #include "unit.h"
#include "update.h" #include "update.h"
long money[MAXNOC]; int money[MAXNOC];
int pops[MAXNOC]; int pops[MAXNOC];
long sea_money[MAXNOC]; int sea_money[MAXNOC];
long lnd_money[MAXNOC]; int lnd_money[MAXNOC];
long air_money[MAXNOC]; int air_money[MAXNOC];
int tpops[MAXNOC]; int tpops[MAXNOC];
void void
@ -103,7 +103,7 @@ update_main(void)
logerror("done preparing sectors."); logerror("done preparing sectors.");
logerror("producing for countries..."); logerror("producing for countries...");
for (i = 0; i < MAXNOC; i++) { for (i = 0; i < MAXNOC; i++) {
long p_sect[SCT_BUDG_MAX+1][2]; int p_sect[SCT_BUDG_MAX+1][2];
memset(p_sect, 0, sizeof(p_sect)); memset(p_sect, 0, sizeof(p_sect));
if (!(np = getnatp(i))) if (!(np = getnatp(i)))

View file

@ -203,9 +203,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(0, n, wu(0, n,
"Army delta $%ld, Navy delta $%ld, Air force delta $%ld\n", "Army delta $%d, Navy delta $%d, Air force delta $%d\n",
lnd_money[n], sea_money[n], air_money[n]); lnd_money[n], sea_money[n], air_money[n]);
wu(0, n, "money delta was $%ld for this update\n", wu(0, n, "money delta was $%d for this update\n",
np->nat_money - money[n]); np->nat_money - money[n]);
if (opt_LOSE_CONTACT) { if (opt_LOSE_CONTACT) {
for (cn = 1; cn < MAXNOC; cn++) { for (cn = 1; cn < MAXNOC; cn++) {

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1986 * Dave Pare, 1986
* Steve McClure, 1996 * Steve McClure, 1996
* Markus Armbruster, 2004-2010 * Markus Armbruster, 2004-2013
*/ */
#include <config.h> #include <config.h>
@ -257,7 +257,7 @@ decay_fallout(struct sctstr *sp, int etus)
* Produce for a specific nation * Produce for a specific nation
*/ */
void void
produce_sect(int natnum, int etu, struct bp *bp, long p_sect[][2]) produce_sect(int natnum, int etu, struct bp *bp, int p_sect[][2])
{ {
struct sctstr *sp; struct sctstr *sp;
struct natstr *np; struct natstr *np;

View file

@ -242,7 +242,7 @@ Player 00 Turn 00 starting
"owner" 5 0 0 9 "owner" 5 0 0 9
"type" 4 0 0 27 "type" 4 0 0 27
"unitid" 8 0 0 -1 "unitid" 8 0 0 -1
"price" 1 0 0 -1 "price" 8 0 0 -1
"maxbidder" 8 0 0 9 "maxbidder" 8 0 0 9
"markettime" 12 0 0 -1 "markettime" 12 0 0 -1
"xloc" 9 1 0 -1 "xloc" 9 1 0 -1
@ -269,7 +269,7 @@ Player 00 Turn 00 starting
"btu" 6 1 0 -1 "btu" 6 1 0 -1
"access" 6 1 0 -1 "access" 6 1 0 -1
"milreserve" 8 1 0 -1 "milreserve" 8 1 0 -1
"money" 1 1 0 -1 "money" 8 1 0 -1
"login" 12 1 0 -1 "login" 12 1 0 -1
"logout" 12 1 0 -1 "logout" 12 1 0 -1
"newstim" 12 1 0 -1 "newstim" 12 1 0 -1
@ -290,8 +290,8 @@ Player 00 Turn 00 starting
"status" 4 0 0 30 "status" 4 0 0 30
"irate" 8 0 0 -1 "irate" 8 0 0 -1
"ldur" 8 0 0 -1 "ldur" 8 0 0 -1
"amtpaid" 1 0 0 -1 "amtpaid" 8 0 0 -1
"amtdue" 1 0 0 -1 "amtdue" 8 0 0 -1
"lastpay" 12 0 0 -1 "lastpay" 12 0 0 -1
"duedate" 12 0 0 -1 "duedate" 12 0 0 -1
/10 /10
@ -758,7 +758,7 @@ Player 00 Turn 00 starting
"btu" 6 0 0 -1 "btu" 6 0 0 -1
"access" 6 0 0 -1 "access" 6 0 0 -1
"milreserve" 8 0 0 -1 "milreserve" 8 0 0 -1
"money" 1 0 0 -1 "money" 8 0 0 -1
"login" 12 0 0 -1 "login" 12 0 0 -1
"logout" 12 0 0 -1 "logout" 12 0 0 -1
"newstim" 12 0 0 -1 "newstim" 12 0 0 -1
@ -1163,7 +1163,7 @@ CENSUS del dst
"owner" 5 0 0 9 "owner" 5 0 0 9
"type" 4 0 0 27 "type" 4 0 0 27
"unitid" 8 0 0 -1 "unitid" 8 0 0 -1
"price" 1 0 0 -1 "price" 8 0 0 -1
"maxbidder" 8 0 0 9 "maxbidder" 8 0 0 9
"markettime" 12 0 0 -1 "markettime" 12 0 0 -1
/7 /7
@ -1183,8 +1183,8 @@ CENSUS del dst
"status" 4 0 0 30 "status" 4 0 0 30
"irate" 8 0 0 -1 "irate" 8 0 0 -1
"ldur" 8 0 0 -1 "ldur" 8 0 0 -1
"amtpaid" 1 0 0 -1 "amtpaid" 8 0 0 -1
"amtdue" 1 0 0 -1 "amtdue" 8 0 0 -1
"lastpay" 12 0 0 -1 "lastpay" 12 0 0 -1
"duedate" 12 0 0 -1 "duedate" 12 0 0 -1
/10 /10
@ -1645,7 +1645,7 @@ CENSUS del dst
"btu" 6 0 0 -1 "btu" 6 0 0 -1
"access" 6 0 0 -1 "access" 6 0 0 -1
"milreserve" 8 0 0 -1 "milreserve" 8 0 0 -1
"money" 1 0 0 -1 "money" 8 0 0 -1
"login" 12 0 0 -1 "login" 12 0 0 -1
"logout" 12 0 0 -1 "logout" 12 0 0 -1
"newstim" 12 0 0 -1 "newstim" 12 0 0 -1