]> git.pond.sub.org Git - empserver/blob - src/lib/commands/vers.c
Update known contributors comment.
[empserver] / src / lib / commands / vers.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2006, 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 files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future 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  *     Ron Koenderink, 2005
37  *     Markus Armbruster, 2005
38  */
39
40 #include <config.h>
41
42 #include <stdio.h>
43 #include <time.h>
44 #include "misc.h"
45 #include "player.h"
46 #include "version.h"
47 #include "ship.h"
48 #include "optlist.h"
49 #include "commands.h"
50 #include "file.h"
51
52 static void show_custom(void);
53 static void show_opts(int val);
54
55 int
56 vers(void)
57 {
58     time_t now;
59
60     (void)time(&now);
61     pr("%s\n\n", version);
62     pr("The following parameters have been set for this game:\n");
63     pr("World size is %d by %d.\n", WORLD_X, WORLD_Y);
64     pr("There can be up to %d countries.\n", MAXNOC);
65     pr("By default, countries use %s coordinate system.\n",
66        (players_at_00) ? "the deity's" : "their own");
67     pr("\n");
68     pr("An Empire time unit is %d second%s long.\n",
69        s_p_etu, s_p_etu != 1 ? "s" : "");
70     pr("Use the 'update' command to find out the time of the next update.\n");
71     pr("The current time is %19.19s.\n", ctime(&now));
72     pr("An update consists of %d empire time units.\n", etu_per_update);
73     pr("Each country is allowed to be logged in %d minutes a day.\n",
74        m_m_p_d);
75     pr("It takes %.2f civilians to produce a BTU in one time unit.\n",
76        (1.0 / (btu_build_rate * 100.0)));
77     pr("\n");
78
79     pr("A non-aggi, 100 fertility sector can grow %.2f food per etu.\n",
80        100.0 * fgrate);
81     pr("1000 civilians will harvest %.1f food per etu.\n",
82        1000.0 * fcrate);
83     pr("1000 civilians will give birth to %.1f babies per etu.\n",
84        1000.0 * obrate);
85     pr("1000 uncompensated workers will give birth to %.1f babies.\n",
86        1000.0 * uwbrate);
87     pr("In one time unit, 1000 people eat %.1f units of food.\n",
88        1000.0 * eatrate);
89     pr("1000 babies eat %.1f units of food becoming adults.\n",
90        1000.0 * babyeat);
91     if (opt_NOFOOD)
92         pr("No food is needed!\n");
93
94     pr("\n");
95
96     pr("Banks pay $%.2f in interest per 1000 gold bars per etu.\n",
97        bankint * 1000.0);
98     pr("1000 civilians generate $%.2f, uncompensated workers $%.2f each time unit.\n", 1000.0 * money_civ, 1000.0 * money_uw);
99     pr("1000 active military cost $%.2f, reserves cost $%.2f.\n",
100        -money_mil * 1000.0, -money_res * 1000.0);
101     if (rollover_avail_max)
102         pr("Up to %d avail can roll over an update.\n", rollover_avail_max);
103     if (opt_SLOW_WAR)
104         pr("Declaring war will cost you $%i\n\n", War_Cost);
105     pr("Happiness p.e. requires 1 happy stroller per %d civ.\n",
106        (int)hap_cons / etu_per_update);
107     pr("Education p.e. requires 1 class of graduates per %d civ.\n",
108        (int)edu_cons / etu_per_update);
109     pr("Happiness is averaged over %d time units.\n", (int)hap_avg);
110     pr("Education is averaged over %d time units.\n", (int)edu_avg);
111     if (opt_ALL_BLEED == 0)
112         pr("The technology/research boost you get from your allies is %.2f%%.\n", 100.0 / ally_factor);
113     else
114         pr("The technology/research boost you get from the world is %.2f%%.\n", 100.0 / ally_factor);
115
116     pr("Nation levels (tech etc.) decline 1%% every %d time units.\n",
117        (int)(level_age_rate));
118
119     pr("Tech Buildup is ");
120     if (tech_log_base <= 1.0) {
121         pr("not limited\n");
122     }
123     if (tech_log_base > 1.0) {
124         pr("limited to logarithmic growth (base %.2f)", tech_log_base);
125         if (easy_tech == 0.0)
126             pr(".\n");
127         else
128             pr(" after %0.2f.\n", easy_tech);
129     }
130     pr("\n");
131     pr("\t\t\t\tSectors\tShips\tPlanes\tUnits\n");
132     pr("Maximum mobility\t\t%d\t%d\t%d\t%d\n", sect_mob_max,
133        ship_mob_max, plane_mob_max, land_mob_max);
134     pr("Max mob gain per update\t\t%d\t%d\t%d\t%d\n",
135        (int)(sect_mob_scale * (float)etu_per_update),
136        (int)(ship_mob_scale * (float)etu_per_update),
137        (int)(plane_mob_scale * (float)etu_per_update),
138        (int)(land_mob_scale * (float)etu_per_update));
139     pr("Mission mobility cost\t\t--\t%d\t%d\t%d\n",
140        ldround((mission_mob_cost * (double)ship_mob_max), 1),
141        ldround((mission_mob_cost * (double)plane_mob_max), 1),
142        ldround((mission_mob_cost * (double)land_mob_max), 1));
143     pr("Max eff gain per update\t\t--\t%d\t%d\t%d\n",
144        MIN((int)(ship_grow_scale * (float)etu_per_update), 100),
145        MIN((int)(plane_grow_scale * (float)etu_per_update), 100),
146        MIN((int)(land_grow_scale * (float)etu_per_update), 100));
147     pr("Maintenance cost per update\t--\t%0.1f%%\t%0.1f%%\t%0.1f%%\n",
148        money_ship * -100.0 * etu_per_update,
149        money_plane * -100.0 * etu_per_update,
150        money_land * -100.0 * etu_per_update);
151     pr("Max interdiction range\t\t%d\t%d\t--\t%d\n",
152        fort_max_interdiction_range,
153        ship_max_interdiction_range,
154        land_max_interdiction_range);
155     pr("\n");
156     pr("The maximum amount of mobility used for land unit combat is %0.2f.\n",
157        combat_mob);
158     if (opt_MOB_ACCESS)
159         pr("The starting mobility when acquiring a sector or unit is %d.\n",
160            -(etu_per_update / sect_mob_neg_factor));
161     pr("\n");
162     if (opt_FUEL)
163         pr("For ships and land units, fuelu makes %d mobility.\n\n", fuel_mult);
164     pr("Ships on autonavigation may use %i cargo holds per ship.\n", TMAX);
165     if (opt_TRADESHIPS) {
166         pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n", trade_1_dist, (float)(trade_1 * 100.0));
167         pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n", trade_2_dist, (float)(trade_2 * 100.0));
168         pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n", trade_3_dist, (float)(trade_3 * 100.0));
169         pr("Cashing in trade-ships with an ally nets you a %.1f%% bonus.\n", trade_ally_bonus * 100.0);
170         pr("Cashing in trade-ships with an ally nets your ally a %.1f%% bonus.\n\n", trade_ally_cut * 100.0);
171     }
172     if (opt_MARKET) {
173         pr("The tax you pay on selling things on the trading block is %.1f%%\n", (1.00 - tradetax) * 100.0);
174         pr("The tax you pay on buying commodities on the market is %.1f%%\n", (buytax - 1.00) * 100.0);
175         pr("The amount of time to bid on commodities is %d seconds.\n", MARK_DELAY);
176         pr("The amount of time to bid on a unit is %d seconds.\n\n", TRADE_DELAY);
177     }
178
179     if (!ef_nelem(EF_NUKE_CHR))
180         pr("Nukes are disabled.\n");
181     else if (drnuke_const > MIN_DRNUKE_CONST) {
182         pr("In order to build a nuke, you need %1.2f times the tech level in research\n", drnuke_const);
183         pr("\tExample: In order to build a 300 tech nuke, you need %d research\n\n", (int)(300.0 * drnuke_const));
184     }
185
186     pr("Fire ranges are scaled by %.2f.\n", fire_range_factor);
187     pr("Flak damage is scaled by %0.2f.\n", flakscale);
188     pr("Torpedo damage is 2d%d+%d.\n", torpedo_damage, torpedo_damage - 2);
189     pr("The attack factor for para & assault troops is %0.2f.\n",
190        assault_penalty);
191     pr("%0.f%% of fallout leaks into each surrounding sector.\n",
192        fallout_spread * 100.0 * MIN(24, etu_per_update));
193     pr("Fallout decays by %.0f%% per update\n",
194        100.0 - (decay_per_etu + 6.0) * fallout_spread * MIN(24, etu_per_update) * 100.0);
195     pr("\n");
196     pr ("Damage to\t\t\tSpills to\n");
197     pr("\t      Sector  People  Mater.   Ships  Planes  LandU.\n");
198     pr("Sector\t\t --\t%3.0f%%\t100%%\t  0%%\t%3.0f%%\t%3.0f%%\n",
199        people_damage * 100.0, unit_damage / 0.07, unit_damage * 100.0);
200     pr("People\t\t%3.0f%%\t --\t --\t --\t --\t --\n",
201        collateral_dam * 100.0);
202     pr("Materials\t%3.0f%%\t --\t --\t --\t --\t --\n",
203        collateral_dam * 100.0);
204     pr("Efficiency\t%3.0f%%\t --\t --\t --\t --\t --\n",
205        collateral_dam * 100.0);
206     pr("Ships\t\t%3.0f%%\t100%%\t100%%\t --\t  0%%\t  0%%\n",
207        collateral_dam * 100.0);
208     pr("Planes\t\t%3.0f%%\t  0%%\t  0%%\t --\t --\t --\n",
209        collateral_dam * 100.0);
210     pr("Land units\t%3.0f%%\t  0%%\t100%%\t --\t  0%%\t  0%%\n",
211        collateral_dam * 100.0);
212     pr("\n");
213     pr("You can have at most %d BTUs.\n", max_btus);
214     pr("You are disconnected after %d minutes of idle time.\n", max_idle);
215     pr("\nOptions enabled in this game:\n        ");
216     show_opts(1);
217     pr("\n\nOptions disabled in this game:\n        ");
218     show_opts(0);
219     pr("\n\nSee \"info Options\" for a detailed list of options and descriptions.\n");
220     show_custom();
221     pr("\nThe person to annoy if something goes wrong is:\n\t%s\n\t(%s).\n\n",
222        privname, privlog);
223     pr("You can get your own copy of the source from "
224        "http://www.wolfpackempire.com/\n\n");
225     pr("%s", legal);
226     return RET_OK;
227 }
228
229 static void
230 show_custom(void)
231 {
232     char *sep = "\nCustomized in this game:\n        ";
233     int i;
234
235     /* TODO wrap long lines */
236     for (i = 0; i < EF_MAX; i++) {
237         if (ef_flags(i) & EFF_CUSTOM) {
238             pr("%s%s", sep, ef_nameof(i));
239             sep = ", ";
240         }
241     }
242     if (*sep == ',')
243         pr("\nCheck \"show\" for details.\n");
244 }
245
246 static void
247 show_opts(int val)
248 {
249     int col;
250     char *sep;
251     struct keymatch *kp;
252
253     sep = "";
254     col = 0;
255     for (kp = configkeys; kp->km_key; kp++) {
256         if (!(kp->km_flags & KM_OPTION))
257             continue;
258         if (CANT_HAPPEN(kp->km_type != NSC_INT))
259             continue;
260         if (!*(int *)kp->km_data != !val)
261             continue;
262         col += strlen(sep) + strlen(kp->km_key);
263         if (col > 70) {
264             pr(",\n        ");
265             sep = "";
266             col = strlen(kp->km_key);
267         }
268         pr("%s%s", sep, kp->km_key);
269         sep = ", ";
270     }
271 }