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
49 extern double obrate, uwbrate;
50 extern int etu_per_update;
53 struct nstr_sect nstr;
54 double work, wforce, lcms, hcms;
65 if (!snxtsct(&nstr, player->argp[1]))
67 player->simulation = 1;
70 while (nxtsct(&nstr, §)) {
74 getvec(VT_ITEM, items, (s_char *)§, EF_SECTOR);
76 civs = min(999, (int) ((obrate * (double) etu_per_update + 1.0)
77 * (double) items[I_CIVIL]));
78 uws = min(999, (int) ((uwbrate * (double) etu_per_update + 1.0)
79 * (double) items[I_UW]));
80 natp = getnatp(sect.sct_own);
81 maxpop = max_pop((float)natp->nat_level[NAT_RLEV], §);
82 civs = min(civs, maxpop);
83 uws = min(uws, maxpop);
84 /* This isn't quite right, since research might rise/fall */
85 /* during the update, but it's the best we can really do */
87 ((civs * sect.sct_work) / 100.0
88 + uws + items[I_MILIT] * 2 / 5.0);
90 work = etu_per_update * wforce / 100.0;
95 if(sect.sct_newtype != type) {
104 type = sect.sct_newtype;
112 if (dchr[type].d_lcms>0){
114 lcms = (int)(lcms/dchr[type].d_lcms);
118 if (dchr[type].d_hcms>0){
120 hcms = (int)(hcms/dchr[type].d_hcms);
132 if (dchr[type].d_lcms>0){
134 lcms = (int)(lcms/dchr[type].d_lcms);
138 if (dchr[type].d_hcms>0){
140 hcms = (int)(hcms/dchr[type].d_hcms);
148 eff = sect.sct_effic;
149 type = sect.sct_type;
152 pr("EFFICIENCY SIMULATION\n");
153 pr(" sect des projected eff\n");
155 prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
156 pr(" %c", dchr[type].d_mnem);
159 player->simulation = 0;
162 pr("%s: No sector(s)\n", player->argp[1]);
164 pr("%s: No sector(s)\n", "");
167 pr("%d sector%s\n", nsect, splur(nsect));