2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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 * newe.c: Show new sector efficiency (projected)
30 * Known contributors to this file:
31 * Thomas Ruschak, 1993
52 struct nstr_sect nstr;
53 double work, wforce, lcms, hcms;
64 if (!snxtsct(&nstr, player->argp[1]))
66 player->simulation = 1;
69 while (nxtsct(&nstr, §)) {
73 getvec(VT_ITEM, items, (s_char *)§, EF_SECTOR);
75 civs = min(999, (int)((obrate * (double)etu_per_update + 1.0)
76 * (double)items[I_CIVIL]));
77 uws = min(999, (int)((uwbrate * (double)etu_per_update + 1.0)
78 * (double)items[I_UW]));
79 natp = getnatp(sect.sct_own);
80 maxpop = max_pop((float)natp->nat_level[NAT_RLEV], §);
81 civs = min(civs, maxpop);
82 uws = min(uws, maxpop);
83 /* This isn't quite right, since research might rise/fall */
84 /* during the update, but it's the best we can really do */
85 wforce = (int)((civs * sect.sct_work) / 100.0
86 + uws + items[I_MILIT] * 2 / 5.0);
88 work = etu_per_update * wforce / 100.0;
89 if (opt_ROLLOVER_AVAIL) {
90 if (sect.sct_type == sect.sct_newtype) {
91 work += sect.sct_avail;
93 if (work > 999) work = 999;
100 if (sect.sct_newtype != type) {
101 twork = (eff + 3) / 4;
109 type = sect.sct_newtype;
117 if (dchr[type].d_lcms > 0) {
119 lcms = (int)(lcms / dchr[type].d_lcms);
123 if (dchr[type].d_hcms > 0) {
125 hcms = (int)(hcms / dchr[type].d_hcms);
131 } else if (eff < 100) {
136 if (dchr[type].d_lcms > 0) {
138 lcms = (int)(lcms / dchr[type].d_lcms);
142 if (dchr[type].d_hcms > 0) {
144 hcms = (int)(hcms / dchr[type].d_hcms);
152 eff = sect.sct_effic;
153 type = sect.sct_type;
156 pr("EFFICIENCY SIMULATION\n");
157 pr(" sect des projected eff\n");
159 prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
160 pr(" %c", dchr[type].d_mnem);
163 player->simulation = 0;
166 pr("%s: No sector(s)\n", player->argp[1]);
168 pr("%s: No sector(s)\n", "");
171 pr("%d sector%s\n", nsect, splur(nsect));