Commit graph

84 commits

Author SHA1 Message Date
44c36fa7d5 Make sector maintenance cost configurable
Replace the fixed $1 per ETU maintenance for capital/city sectors that
are at least 60% efficient by a configurable maintenance cost, payable
regardless of efficiency.  The only change in the default
configuration is that inefficient capitals now pay maintenance.
Charging sector maintenance regardless of efficiency is consistent
with unit maintenance.

New struct dchrstr member d_maint and sector-chr selector maint.  Make
show_sect_build() show it.  Change produce_sect() to record
maintenance in new slot p_sect[SCT_MAINT] instead of abusing
p_sect[SCT_CAPIT].  Replace the "Capital maintenance" line in budget
by "Sector maintenance".
2009-07-19 13:58:47 -04:00
48ff09664b Overhaul show sect b
Print sector type mnemonic and name, like show sect s and c.  Print
"can't" instead of negative number for sectors players can't designate
(this was not an issue before the previous commit).  Show build cost
per 100%, like show ship, land, plane and nuke.  Size the columns more
sensibly.
2009-07-19 13:58:40 -04:00
be6d7ca913 Fix show sect b not to omit undesignatable sectors
show sect b needs to explain any sector players can build.
show_sect_build() omitted sectors players can't designate.  That's
wrong, because players can certainly own and thus build sectors they
can't designate.  Test for infinite mobility cost instead, like
show_sect_stats().
2009-07-19 13:52:55 -04:00
a61e673a07 Clean up poorly chosen loop control variable names
Calling a counting loop's control variable q or x is tasteless
bordering on actively misleading.
2009-05-21 09:30:05 +02:00
ee20a9cd34 Update known contributors comments 2009-02-18 21:11:33 +01:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
Ron Koenderink
08b9455682 Reimplement max_idle without a separate thread
Remove the KillIdle thread.  Add timeout to struct iop, initialized in
io_open().  Obey it in io_input() by passing it to empth_select().  If
empth_select() times out, report that back through io_input() to
recvclient() and player_login().  If player_login() receives a timeout
indication, print a message and terminate the session.  If
recvclient() receives a timeout indication, flash a message to the
player and initiate a shut down the player's session.

Create WIN32 sys/time.h to define struct timeval.  This creates some
conflicts with WIN32 windows.h definitions.  Including windows.h in
show.c and info.c creates conflicts, so remove that.  Modify service.c
to include sys/socket.h instead of windows.h to remove the conflict
with sys/time.h.
2009-02-01 17:06:33 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
e58be3179a Remove product information from show sect c
New show product made this redundant.
2008-07-28 07:52:32 -04:00
acf7f6c1ce Always print header in show_sect_stats() and show_sect_capab()
Simpler, and empty tables are highly unlikely anyway.
2008-07-28 07:52:32 -04:00
71bbd642df New show product
This is the human-readable buddy of xdump product, which dumps pchr[].
It duplicates much of the information in show sect c, but in more
accessible form.  It's in show_product().

Remove product information from info Quick-ref.  show reflects the
actual game, is more complete, and should be just as readable.
2008-07-28 07:51:49 -04:00
ae8c4620b0 Show sector navigability in show se s
This is the human-readable buddy of xdump sect-chr column nav, which
dumps ichr[].d_nav.
2008-07-27 21:04:44 -04:00
4be4a37a96 Show packing type instead of selected bonuses in show se s
show_sect_stats() used to show packing bonuses for military,
uncompensated workers, civilians, bars and lcms.  The bonus for lcms
was labelled "other", which was okay only as long as all other
commodities receive the same packing bonuses.

Show packing bonus type instead.  The actual bonus for each commodity
and packing type is already shown by show item.  But change its header
for the NPKG column from "rg" to "no", because packing type NPKG is
shown by show se s as "normal".
2008-07-27 21:04:44 -04:00
7d37e41527 Add a a line for the usual values to show se b
show_sect_build() showed only sectors with unusual build
characteristics.  Which begged the question what the usual build
characteristics are.  Add a line to show them.
2008-07-27 21:04:26 -04:00
3b4de2feb1 Remove option FUEL
The abstract idea of tying ships and land units to a logistical tether
is sound, the concrete implementation as option FUEL is flawed.  It
adds too much busy-work to the game to be enjoyable.  It hasn't been
enabled in a public game for years.  The code implementing it is ugly,
repetitive, and a burden to maintain.

Remove selector fuel from ship_ca[] and land_ca[], and selectors
fuelc, fuelu from mchr_ca[] and lchr_ca[].  Remove fields fuelc, fuelu
from ship.config and land.config.

Remove command fuel from player_coms[].

Deprecate edit key 'B' in doship(), dounit(), and don't show it in
pr_ship(), pr_land().

Drop opt_FUEL code from build_ship(), shi(), sdump(), ship_damage(),
show_ship_stats(), do_mob_ship(), nav_ship(), build_land(), land(),
ldump(), land_damage(), show_land_stats(), do_mob_land(),
resupply_all(), resupply_commod(), get_minimum(), has_supply(),
unit_list(), vers().

Remove opt_FUEL, fuel_mult, struct shpstr member shp_fuel, struct
mchrstr members m_fuelc and m_fuelu, M_OILER, struct lndstr member
lnd_fuel, struct lchrstr members l_fuelc and l_fuelu, fuel(), and
auto_fuel_ship().
2008-05-12 09:25:20 +02:00
0dd6702df1 Update known contributors comments 2008-03-14 20:25:44 +01:00
0219bf086a New unit stat development functions
The macros defining unit stat development in tech are somewhat
inconvenient to use.  Define more convenient functions, and hide away
the macros near the function definitions.
2008-03-14 20:25:10 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
136a313334 (show_bridge, show_tower, show_ship_stats): Simplify, no functional
change.
2007-10-28 07:41:39 +00:00
Ron Koenderink
2270ea73d8 (fmttime2822) [_WIN32]: Replace localtime_s() with localtime().
Replace _snprintf_s() with _snprintf().  These secure functions are
not supported by MinGW yet.
2007-08-03 01:47:02 +00:00
Ron Koenderink
812eab5427 Fix the previous revision. 2007-07-26 02:00:49 +00:00
Ron Koenderink
ce6a691126 (fmttime2822): Changed return type for strftime() to size_t.
(fmttime2822) [_WIN32]: %T is not support option for strftime in WIN32
replaced with %H:%M:%S.  Replaced %z in with +/-???? format for WIN32
as the default for WIN32 is the text description for timezone.
2007-07-26 01:59:32 +00:00
a57645340c New command show updates:
(show): New sub-command.
(player_coms): Update its c_form.
(show_updates, fmttime2822): New.

(vers): Show game_days and game_hours.

(upda): Mark obsolete and point to show updates.
(vers): Point to show rather than update.

Rewrite much of info zdone.
2007-07-15 13:34:22 +00:00
de19a17aaf (show_news): Don't show unused elements of rpt[]. 2007-07-10 21:23:29 +00:00
1cfeeb6e0c (show_nuke_build, show_nuke_capab): Fix rounding of research.
Reported by Doug Wescott.
2007-05-13 14:39:42 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
99fc82b94d (LND_AMM): Became weird in 4.2.3: ammo use depends on l_dam if l_ammo
is non-zero; actual value of non-zero l_ammo was unimportant.  Side
effect: it substantially increased ammunition consumption at high
tech, because the change made the value increase with tech.  Back out
4.2.3's change, just use l_ammo.  This lets deities customize
ammunition consumption independent of damage.  Remove second
parameter.  Callers changed.
2006-07-08 07:21:47 +00:00
9e8f74d239 Support definition of additional sector types in sector.config,
missing bits:
(budg, calc_all, update_main): Use SCT_TYPE_MAX instead of SCT_MAXDEF
to size tables.
(map_char): Update sanity check; use CANT_HAPPEN().
(show_sect_build, show_sect_stats, show_sect_capab): Use the sentinel
instead of SCT_MAXDEF.
2006-06-22 20:21:48 +00:00
df6f365a71 (dchrstr): Replace int members d_mcst and d_emcst (mobility cost * 5)
by float d_mob0 and d_mob1 (straight costs).  Impassable terrain now
encoded as negative d_mob0 instead of zero d_mcst.  Users changed.
sect.config updated.
(dchr_ca): Replace selectors mcst and emcst by mob0 and mob1.
(show_sect_stats): Show real mobility costs.
2006-06-17 14:08:20 +00:00
4d1dd6fa6a (sctintrins): New member in_enable. Update infra.config. Use it
instead of opt_DEFENSE_INFRA.
(improve): Test for it.
(show_sect_build): Show only enabled infrastructure.
(opt_DEFENSE_INFRA): Remove.  Deities can edit infra.config instead.

(improve): Dumb down prompt.
2006-06-16 18:39:35 +00:00
9ae594153f (show_sect_stats): Display mobility cost of inaccessible sectors as
`no way' instead of obscure magic numbers.
2006-06-15 21:27:45 +00:00
083003ad82 (sector_mcost): New, simpler sector mobility cost formula. The cost
is a linear function of sector efficiency, with cost at 0% given by
dchstr member d_mcst and cost at 100% given by d_emcst.  The latter
used to be d_mcst - 1.  Mountain cost is no longer a special case.
Road infrastructure now reduces cost up to 90%, linear in road
efficiency (used to be close to that, but non-linear).  Same for rail
infrastructure, but 99%.  Double land unit minimum cost to 0.02.
Change land unit cost penalty in newly taken land to an extra 0.2
instead of a minimum of 0.2.
(dchrstr): New member d_emcst.  sector.config updated, with some
changes: cost of mountain now ranges from 2.4 to 1.2 instead of 2.174
to 1.304, wildernes 0.4 instead of 0.6 to 0.4, highway, bridge head,
bridge span and tower from 0.4 to 0.001 instead of 0.2 to 0.001.
While I'm at it, make bridge head match highway stats (dstr and value
reduced).
(show_sect_stats): Show d_emcst.
(dchr_ca): New selector emcst for d_emcst.
2006-06-15 21:12:53 +00:00
f284b0beab (P_SHELL, P_GUN, P_PETROL, P_IRON, P_DUST, P_BAR, P_FOOD, P_OIL)
(P_LCM, P_HCM, P_TLEV, P_RLEV, P_ELEV, P_HLEV, P_URAN): Use -1 instead
of 0 for `no product', shift down product indexes and update
product.config and sector.config accordingly.
(budg, prod, show_sect_capab, produce, produce_sect): Adapt test for
no product.
(ef_elt_byname): Remove the hack to hide pchr[0].
(prod_eff): Oops on no product.
2006-06-05 17:44:25 +00:00
da88d91899 (pchrstr, pchr_ca, pchr, sctstr, dchr_ca, dchr): Replace pchrstr
member p_effic by sctstr member d_peffic.  Tables updated.
(show_sect_capab): Adapted.
(prod_eff): Adapted; requires changing first parameter to sector type.
Callers changed.
(P_MDUST): Remove, because pchr[P_MDUST] now identical to
pchr[P_DUST].
2006-06-02 05:35:54 +00:00
4c4fdca42b Line breaks and other formatting issues. No functional changes. 2006-05-21 13:05:24 +00:00
f819e7ac85 Do not cast to float where default argument promotion obviously
converts the cast's result to double.  Such casts are ugly and may
lose precision.
2006-05-06 08:34:33 +00:00
b0a5d11a3f (show_nuke_capab, show_ship_capab, show_plane_capab, show_land_capab)
(prxy, border, ac_encounter, look, budg): Fix misuse of pr() and PR():
passed formatted string instead of format string and arguments.
Correctness depends on argument values and tables not containing '%',
which is correct, but fragile.
2006-03-26 13:41:46 +00:00
3252f8a907 (dirchar, neighsects, login_coms, lookup_list, g_distptrs, level_easy)
(level_log, levelnames): Internal linkage.
2006-03-23 20:32:29 +00:00
f5a9284867 Update known contributors comment. 2006-02-24 21:35:27 +00:00
dae17432ae (lndchr): Rename member l_mxland to l_nland for consistency with
similar unit characteristics.
2006-02-19 07:32:03 +00:00
Ron Koenderink
b7d0b66161 (buil, drnuke_const, opt_DRNUKE, show, show_nuke_build)
(show_nuke_capab, vers, xdvisible, build.t, Options.t):
Remove opt_DRNUKE and replace with the following check
drnuke_const > MIN_DRNUKE_CONST.
Set MIN_DRNUKE_CONST to 0.001 to prevent issues with tiny values.
Change the default drnuke_const to 0.0 because in the stock game
opt_DRNUKE was disabled.
2006-02-16 02:14:08 +00:00
Ron Koenderink
7b9fdf8b95 (show_news, news, empfile[], page_headings[], page_headings_symbols[]):
Change page_headings[] to struct symbol and removed
page_headings_symbols[].
2006-01-30 22:26:48 +00:00
Ron Koenderink
1bca66c061 (show_news): New.
(show): Use it to implement show news.
2006-01-29 17:44:29 +00:00
Ron Koenderink
fee6c50b1a (show, show_item): Resurrect show item. 2006-01-22 18:57:14 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
cb7c9008c8 (show_nuke_build, show_nuke_capab): Column res used to be shown only
with DRNUKE.  Show it always.
2006-01-05 15:45:08 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
Ron Koenderink
d4f52f6ca2 (lookup): Rename lookup() to symbol_by_value(), make it public
and move it to nstr.c.
2005-11-22 22:57:06 +00:00