]> git.pond.sub.org Git - empserver/blob - src/lib/commands/vers.c
Import of Empire 4.2.12
[empserver] / src / lib / commands / vers.c
1 /*
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
5  *
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.
10  *
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.
15  *
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
19  *
20  *  ---
21  *
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.
25  *
26  *  ---
27  *
28  *  vers.c: Print out the Empire version
29  * 
30  *  Known contributors to this file:
31  *     Dave Pare
32  *     Jeff Bailey
33  *     Thomas Ruschak
34  *     Ken Stevens
35  *     Steve McClure
36  */
37
38 #include <stdio.h>
39 #include <time.h>
40 #include "gamesdef.h"
41 #include "misc.h"
42 #include "player.h"
43 #include "deity.h"
44 #include "nat.h"
45 #include "version.h"
46 #include "ship.h" 
47 #include "optlist.h"
48 #include "commands.h"
49
50 extern float drnuke_const;
51
52 int
53 vers(void)
54 {
55         extern  int s_p_etu;
56         extern  int etu_per_update;
57         extern  int m_m_p_d;
58         extern  int players_at_00;
59         extern  float btu_build_rate;
60         extern  double fgrate, fcrate;
61         extern  double eatrate, babyeat;
62         extern  double obrate, uwbrate;
63         extern  double bankint;
64         extern  double hap_cons, edu_cons;
65         extern  double money_civ, money_uw, money_mil, money_res;
66         extern  float hap_avg, edu_avg, ally_factor;
67         extern  float level_age_rate;
68 /*      extern  float easy_tech, hard_tech, tech_log_base; */
69         extern  float easy_tech, tech_log_base;
70         extern  int land_mob_max;
71         extern  int land_grow_scale;
72         extern  float land_mob_scale;
73         extern  int sect_mob_max;
74         extern  float sect_mob_scale;
75         extern  int ship_mob_max;
76         extern  float ship_mob_scale;
77         extern  int ship_grow_scale;
78         extern  int plane_mob_max;
79         extern  float plane_mob_scale;
80         extern  int plane_grow_scale;
81         extern  int War_Cost;
82         extern  float fire_range_factor;
83         extern  int   trade_1_dist;     /* less than this gets no money */
84         extern  int   trade_2_dist;     /* less than this gets trade_1 money */
85         extern  int   trade_3_dist;     /* less than this gets trade_2 money */
86         extern  float trade_1;          /* return on trade_1 distance */
87         extern  float trade_2;          /* return on trade_2 distance */
88         extern  float trade_3;          /* return on trade_3 distance */
89         extern  float trade_ally_bonus; /* 20% bonus for trading with allies */
90         extern  float trade_ally_cut;   /* 10% bonus for ally you trade with */
91         extern  double tradetax;
92         extern  double buytax;
93         struct option_list *op;
94
95         time_t  now;
96         int     j;
97
98         (void) time(&now);
99         pr("Empire %d.%d.%d\n(KSU distribution %2.2f, Chainsaw version %2.2f, Wolfpack version %2.2f)\n\n",
100                 EMP_VERS_MAJOR, EMP_VERS_MINOR, EMP_VERS_PATCH,
101                 (float)KSU_DIST, (float)CHAINSAW_DIST, (float)WOLFPACK_DIST);
102         pr("The following parameters have been set for this game:\n");
103         pr("World size is %d by %d.\n", WORLD_X, WORLD_Y);
104         pr("There can be up to %d countries.\n", MAXNOC);
105         pr("By default, countries use %s coordinate system.\n",
106                 (players_at_00) ? "the deity's" : "their own");
107         pr("\n");
108         pr("An Empire time unit is %d second%s long.\n",
109                 s_p_etu, s_p_etu != 1 ? "s" : "");
110         pr("Use the 'update' command to find out the time of the next update.\n");
111         pr("The current time is %19.19s.\n",ctime(&now));
112         pr("An update consists of %d empire time units.\n",
113                 etu_per_update);
114         pr("Each country is allowed to be logged in %d minutes a day.\n",
115                 m_m_p_d);
116         pr("It takes %.2f civilians to produce a BTU in one time unit.\n",
117                 (1.0/(btu_build_rate*100.0)));
118         pr("\n");
119
120         pr("A non-aggi, 100 fertility sector can grow %.2f food per etu.\n",
121                 100.0 * fgrate);
122         pr("1000 civilians will harvest %.1f food per etu.\n",
123                         1000.0*fcrate);
124         pr("1000 civilians will give birth to %.1f babies per etu.\n", 
125                         1000.0*obrate);
126         pr("1000 uncompensated workers will give birth to %.1f babies.\n", 
127                         1000.0*uwbrate);
128         pr("In one time unit, 1000 people eat %.1f units of food.\n", 
129            1000.0*eatrate);
130         pr("1000 babies eat %.1f units of food becoming adults.\n", 
131            1000.0*babyeat);
132         if (opt_NOFOOD)
133                 pr("No food is needed!!\n");
134
135         pr("\n");
136
137         pr("Banks pay $%.2f in interest per 1000 gold bars per etu.\n",
138                 bankint*1000.0);
139         pr("1000 civilians generate $%.2f, uncompensated workers $%.2f each time unit.\n", 1000.0*money_civ, 1000.0*money_uw);
140         pr("1000 active military cost $%.2f, reserves cost $%.2f.\n",
141                 -money_mil*1000.0, -money_res*1000.0);
142         if (opt_SLOW_WAR)
143                 pr("Declaring war will cost you $%i\n\n", War_Cost);
144         pr("Happiness p.e. requires 1 happy stroller per %d civ.\n",
145                 (int) hap_cons / etu_per_update);
146         pr("Education p.e. requires 1 class of graduates per %d civ.\n",
147                 (int) edu_cons / etu_per_update);
148         pr("Happiness is averaged over %d time units.\n", (int)hap_avg);
149         pr("Education is averaged over %d time units.\n", (int)edu_avg);
150         if (opt_ALL_BLEED == 0)
151                 pr(
152         "The technology/research boost you get from your allies is %.2f%%.\n",
153                    100.0/ally_factor);
154         else    /* ! ALL_BLEED */
155                 pr(
156         "The technology/research boost you get from the world is %.2f%%.\n",
157                 100.0/ally_factor);
158
159         pr("Nation levels (tech etc.) decline 1%% every %d time units.\n",
160                 (int)(level_age_rate));
161
162         pr("Tech Buildup is ");
163 /*      if (tech_log_base <= 1.0 && hard_tech == 0.0) { */
164         if (tech_log_base <= 1.0 ) {
165                 pr("not limited\n");
166         } 
167         if (tech_log_base > 1.0) {
168                 pr("limited to logarithmic growth (base %.2f)",
169                         tech_log_base);
170                 if (easy_tech == 0.0) 
171                         pr(".\n");
172                 else
173                         pr(" after %0.2f.\n", easy_tech);
174         } /*else {
175                 pr("limited to asymptotic growth towards %.2f",
176                         hard_tech + easy_tech);
177                 if (easy_tech == 0.00) 
178                         pr(".\n");
179                 else
180                         pr("after %.2f\n",easy_tech);
181         } */
182
183         pr("\n");
184         pr("\t\t\t\tSectors\tShips\tPlanes\tUnits\n");
185         pr("Maximum mobility\t\t%d\t%d\t%d\t%d\n", sect_mob_max,
186                 ship_mob_max, plane_mob_max, land_mob_max);
187         pr("Max mob gain per update\t\t%d\t%d\t%d\t%d\n",
188                 (int)(sect_mob_scale*(float)etu_per_update), 
189                 (int)(ship_mob_scale*(float)etu_per_update), 
190                 (int)(plane_mob_scale*(float)etu_per_update),
191                 (int)(land_mob_scale*(float)etu_per_update));
192         pr("Max eff gain per update\t\t--\t%d\t%d\t%d\n",
193                 min(ship_grow_scale*etu_per_update,100),
194                 min(plane_grow_scale*etu_per_update,100),
195                 min(land_grow_scale*etu_per_update,100));
196         pr("\n");
197         pr("Ships on autonavigation may use %i cargo holds per ship.\n",TMAX);
198         if (opt_TRADESHIPS) {
199           pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
200              trade_1_dist, (float)(trade_1 * 100.0));
201           pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
202              trade_2_dist, (float)(trade_2 * 100.0));
203           pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
204              trade_3_dist, (float)(trade_3 * 100.0));
205           pr("Cashing in trade-ships with an ally nets you a %.1f%% bonus.\n",
206              trade_ally_bonus * 100.0);
207           pr("Cashing in trade-ships with an ally nets your ally a %.1f%% bonus.\n\n",
208              trade_ally_cut * 100.0);
209         }
210         if (opt_MARKET) {
211           pr("The tax you pay on selling things on the trading block is %.1f%%\n",
212              (1.00-tradetax) * 100.0);
213           pr("The tax you pay on buying commodities on the market is %.1f%%\n\n",
214              (buytax - 1.00) * 100.0);
215         }
216
217         if (opt_NONUKES)
218                 pr("Nukes are disabled.\n");
219         else if(opt_DRNUKE) { /* NUKES && DRNUKE enabled */
220                 pr("In order to build a nuke, you need %1.2f times the tech level in research\n",
221                    drnuke_const);
222                 pr("\tExample: In order to build a 300 tech nuke, you need %d research\n\n",
223                    (int)(300.0*drnuke_const));
224         }
225
226         pr("Fire ranges are scaled by %.2f\n", fire_range_factor);
227
228         pr("\nOptions enabled in this game:\n        ");
229         for (j = 0, op = Options; op -> opt_key; op++) {
230                 if (*op -> opt_valuep == 0)
231                         continue;
232
233                 j += strlen (op -> opt_key) + 2;
234                 if (j > 70) {
235                         pr ("\n        ");
236                         j = strlen (op -> opt_key) + 2;
237                 }
238                 pr ("%s%s", op -> opt_key, op[1].opt_key == NULL ? "":  ", ");
239         }
240         pr("\n\nOptions disabled in this game:\n        ");
241         for (j = 0, op = Options; op -> opt_key; op++) {
242                 if (!(*op -> opt_valuep == 0))
243                         continue;
244
245                 j += strlen (op -> opt_key) + 2;
246                 if (j > 70) {
247                         pr ("\n        ");
248                         j = strlen (op -> opt_key) + 2;
249                 }
250                 pr ("%s%s", op -> opt_key, op[1].opt_key == NULL ? "":  ", ");
251         }
252         pr("\n\n\"info Options\" for a detailed list of options and descriptions");
253         pr("\n\n");
254         pr("The person to annoy if something goes wrong is:\n\t%s\n\t(%s).\n",
255                 privname, privlog);
256         pr("You can get your own copy of the source %s\n", GET_SOURCE);
257         return RET_OK;
258 }