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