2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * enli.c: Enlist some military
30 * Known contributors to this file:
48 struct nstr_sect nstr;
62 if (!snxtsct(&nstr, player->argp[1]))
64 if (!trechk(player->cnum, 0, TRTENL))
66 natp = getnatp(player->cnum);
68 sprintf(prompt, "Number to enlist (max %d) : ", newmil);
69 if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
71 if ((milwant = atoi(p)) > newmil)
73 if (0 != (quota = (milwant < 0)))
76 reserve = natp->nat_reserve;
78 pr("No military reserves left\n");
81 while (nxtsct(&nstr, §)) {
84 if (sect.sct_oldown != player->cnum)
86 civ = sect.sct_item[I_CIVIL];
89 if (sect.sct_loyal > 70) {
90 pr("civilians refuse to report in %s!\n",
91 xyas(sect.sct_x, sect.sct_y, player->cnum));
94 if (sect.sct_mobil <= 0) {
95 pr("%s is out of mobility!\n",
96 xyas(sect.sct_x, sect.sct_y, player->cnum));
98 mil = sect.sct_item[I_MILIT];
101 if (newmil > milwant - mil)
102 newmil = milwant - mil;
105 } else if (newmil > milwant)
107 if (newmil > 999 - mil)
111 if (newmil > reserve)
113 sect.sct_item[I_MILIT] = newmil + mil;
116 sect.sct_item[I_CIVIL] = civ - newmil;
117 pr("%3d enlisted in %s (%d)\n", newmil,
118 xyas(sect.sct_x, sect.sct_y, player->cnum), mil + newmil);
119 if (sect.sct_mobil > 0) {
120 sect.sct_mobil = (u_char)((float)sect.sct_mobil *
121 (1.0 - (float)newmil / (float)civ));
124 if (totalmil >= 10000) {
125 pr("Rioting in induction center interrupts enlistment\n");
129 pr("Military reserve exhausted\n");
133 pr("Total new enlistment : %d\n", totalmil);
134 pr("Military reserves stand at %ld\n", reserve);
136 natp->nat_reserve -= totalmil;
139 if ((player->btused += roundavg((float)totalmil * 0.02)) > 0)
140 pr("Paperwork at recruiting stations ... %d\n", player->btused);