Ron Koenderink [Thu, 29 Jun 2006 03:36:14 +0000 (03:36 +0000)]
(navi): Modify map and bmap command options for navi() to support
an user specified ship number.
Without an user specified ship number it will still default to the flagship.
This will make map and bmap commands consistent with commands
like radar, sonar and look.
Ron Koenderink [Sat, 24 Jun 2006 17:29:40 +0000 (17:29 +0000)]
(map, unit_map, draw_map, player_coms[]):
Modify nmap command to allow mapping around a nuke.
Add new command nbmap for bmapping around a nuke.
Add a new mapping flag 'n' for adding nukes to a map.
Correct syntax description for pmap, pbmap, lmap and lbmap
in player_coms[].
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.
Support definition of additional sector types in sector.config:
(SCT_TYPE_MAX): New.
(dchr): Use it instead of SCT_MAXDEF to size the table.
(SCT_EFFIC): Likewise. Move from sect.h to budg.h.
Rewrite rev. 1.69 to suppress immutable field match check when
extending any table, empty or not:
(cur_obj_is_blank): New.
(fldval_must_match): Use it instead of initialized[].
(getobj): Set it along with cur_obj.
(setstr): Move fldval_must_match() down, so that cur_obj_is_blank is
defined.
(initialized): Remove.
(SCT_MAXDEF): Make it equal the maximum sector type, not the maximum
plus one. Users changed. This indirectly fixes off-by-one loop
bounds in budg(), show_sect_build(), show_sect_stats() and
show_sect_capab(). The show bugs were harmless: the loops ran into
the sentinel, which they ignore. The budg bug was serious: the loop
ran into the entries for SCT_EFFIC. This lead to a bogus line in the
budget, printing of a null pointer, and doubled sector build cost.
Budget priorities masked this bug until rev. 1.25.
_exit() fails to terminate all threads on at least some versions of
LinuxThreads, use exit() where possible:
(shutdwn): No longer a signal handler, can safely call exit().
(main, loc_NTInit): No obvious reason for not using exit().
(bestownedpath): Back out rev. 1.22's path termination with 'h' for
now. Consistency with BestLandPath() is nice, but it makes navigate
behave differently, and that wasn't intended.
(navi, march): Simplify convoluted logic. Old code tried path finding
whenever the next direction in the path string is bad. It then passed
the whole path string to shp_path(), which makes no sense unless we're
at the beginning of it, but luckily failed in that case. Change to
try path finding right after prompting for new input.
(ask_olist): Let land units attack as long as they have positive
mobility, except for high-mobility terrain (mountains), where the
rules remain as they were: land units need to have all the mobility
charged for the attack, not counting combat and moving in to occupy.
Rationale: Making sure your land units reach attack positions with
enough mobility left is a pain in the neck. Requiring only positive
mobility is friendlier, but allows rushing of mountains.
(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.
(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.
(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.
(attack_val, defense_val): These functions overestimate unit strength,
because they ignore three facts. Firstly, mil casualties decrease
strength linearly, while unit casualties decrease it quadratically
(unit strength scales with mil * eff). Secondly, casualties decrease
strength proportional to the combat multiplier, hence twice as much
mil are more powerful than double multiplier. Thirdly, units break
and retreat. Change the estimate from mil * mult to mil * sqrt(mult).
Improves things in simulations, hope it works out in practice as well.
Closes #682571.