Use int instead of long for military reserves
Code dealing with reserves mixes int and long pretty haphazardly. Harmless, because practical reserves fit easily on any machine capable of running the server. Clean up anyway.
This commit is contained in:
parent
5d7f011900
commit
74b8b9932d
8 changed files with 13 additions and 13 deletions
|
@ -105,7 +105,7 @@ struct natstr {
|
||||||
int nat_timeused; /* number of seconds used today */
|
int nat_timeused; /* number of seconds used today */
|
||||||
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 */
|
||||||
long nat_reserve; /* military reserves */
|
int nat_reserve; /* military reserves */
|
||||||
long nat_money; /* moola */
|
long 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 */
|
||||||
|
|
|
@ -144,7 +144,7 @@ budg(void)
|
||||||
}
|
}
|
||||||
if (mil) {
|
if (mil) {
|
||||||
n = (mil - np->nat_reserve * money_res * etu) / (etu * money_mil);
|
n = (mil - np->nat_reserve * money_res * etu) / (etu * money_mil);
|
||||||
sprintf(in, "%d mil, %d res", n, (int)np->nat_reserve);
|
sprintf(in, "%d mil, %d res", n, np->nat_reserve);
|
||||||
pr("Military payroll\t\t%-32s%8d\n", in, -mil);
|
pr("Military payroll\t\t%-32s%8d\n", in, -mil);
|
||||||
expenses -= mil;
|
expenses -= mil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ demo(void)
|
||||||
}
|
}
|
||||||
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 %ld (up %d)\n",
|
pr("Military reserve stands at %d (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;
|
||||||
|
|
|
@ -291,7 +291,7 @@ prnat(struct natstr *np)
|
||||||
pr("Name <n>: %-20s\t", np->nat_cnam);
|
pr("Name <n>: %-20s\t", np->nat_cnam);
|
||||||
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>: %5ld\n", np->nat_reserve);
|
pr("Reserves <m>: %5d\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",
|
||||||
|
@ -674,10 +674,10 @@ docountry(char op, int arg, char *p, struct natstr *np)
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
benefit(nat, np->nat_reserve < arg);
|
benefit(nat, np->nat_reserve < arg);
|
||||||
pr("Military reserves changed from %ld to %d\n",
|
pr("Military reserves changed from %d to %d\n",
|
||||||
np->nat_reserve, arg);
|
np->nat_reserve, arg);
|
||||||
wu(player->cnum, nat,
|
wu(player->cnum, nat,
|
||||||
"Military reserves changed from %ld to %d by divine intervention.\n",
|
"Military reserves changed from %d to %d by divine intervention.\n",
|
||||||
np->nat_reserve, arg);
|
np->nat_reserve, arg);
|
||||||
np->nat_reserve = arg;
|
np->nat_reserve = arg;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,7 +47,7 @@ enli(void)
|
||||||
int newmil;
|
int newmil;
|
||||||
int milwant;
|
int milwant;
|
||||||
int totalmil;
|
int totalmil;
|
||||||
long reserve;
|
int reserve;
|
||||||
char *p;
|
char *p;
|
||||||
int quota;
|
int quota;
|
||||||
char prompt[128];
|
char prompt[128];
|
||||||
|
@ -123,7 +123,7 @@ enli(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pr("Total new enlistment : %d\n", totalmil);
|
pr("Total new enlistment : %d\n", totalmil);
|
||||||
pr("Military reserves stand at %ld\n", reserve);
|
pr("Military reserves stand at %d\n", reserve);
|
||||||
if (totalmil) {
|
if (totalmil) {
|
||||||
natp->nat_reserve -= totalmil;
|
natp->nat_reserve -= totalmil;
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
|
|
|
@ -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: %ld\n", natp->nat_reserve);
|
pr(" Military reserves: %d\n", natp->nat_reserve);
|
||||||
pr("Education..........%6.2f Happiness.......%6.2f\n",
|
pr("Education..........%6.2f Happiness.......%6.2f\n",
|
||||||
natp->nat_level[NAT_ELEV], natp->nat_level[NAT_HLEV]);
|
natp->nat_level[NAT_ELEV], natp->nat_level[NAT_HLEV]);
|
||||||
pr("Technology.........%6.2f Research........%6.2f\n",
|
pr("Technology.........%6.2f Research........%6.2f\n",
|
||||||
|
|
|
@ -574,7 +574,7 @@ struct castr cou_ca[] = {
|
||||||
{"timeused", fldoff(nat_timeused), NSC_INT, 0, NULL, EF_BAD, 0},
|
{"timeused", fldoff(nat_timeused), NSC_INT, 0, NULL, EF_BAD, 0},
|
||||||
{"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_LONG, 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_LONG, 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},
|
||||||
|
|
|
@ -268,7 +268,7 @@ Player 00 Turn 00 starting
|
||||||
"timeused" 8 1 0 -1
|
"timeused" 8 1 0 -1
|
||||||
"btu" 6 1 0 -1
|
"btu" 6 1 0 -1
|
||||||
"access" 6 1 0 -1
|
"access" 6 1 0 -1
|
||||||
"milreserve" 1 1 0 -1
|
"milreserve" 8 1 0 -1
|
||||||
"money" 1 1 0 -1
|
"money" 1 1 0 -1
|
||||||
"login" 12 1 0 -1
|
"login" 12 1 0 -1
|
||||||
"logout" 12 1 0 -1
|
"logout" 12 1 0 -1
|
||||||
|
@ -757,7 +757,7 @@ Player 00 Turn 00 starting
|
||||||
"timeused" 8 0 0 -1
|
"timeused" 8 0 0 -1
|
||||||
"btu" 6 0 0 -1
|
"btu" 6 0 0 -1
|
||||||
"access" 6 0 0 -1
|
"access" 6 0 0 -1
|
||||||
"milreserve" 1 0 0 -1
|
"milreserve" 8 0 0 -1
|
||||||
"money" 1 0 0 -1
|
"money" 1 0 0 -1
|
||||||
"login" 12 0 0 -1
|
"login" 12 0 0 -1
|
||||||
"logout" 12 0 0 -1
|
"logout" 12 0 0 -1
|
||||||
|
@ -1644,7 +1644,7 @@ CENSUS del dst
|
||||||
"timeused" 8 0 0 -1
|
"timeused" 8 0 0 -1
|
||||||
"btu" 6 0 0 -1
|
"btu" 6 0 0 -1
|
||||||
"access" 6 0 0 -1
|
"access" 6 0 0 -1
|
||||||
"milreserve" 1 0 0 -1
|
"milreserve" 8 0 0 -1
|
||||||
"money" 1 0 0 -1
|
"money" 1 0 0 -1
|
||||||
"login" 12 0 0 -1
|
"login" 12 0 0 -1
|
||||||
"logout" 12 0 0 -1
|
"logout" 12 0 0 -1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue