Commit graph

2043 commits

Author SHA1 Message Date
f883710417 (get_dtotal): Simplify.
(att_reacting_units): Simplify.

(get_osupport, get_dsupport, get_mine_dsupport, att_calcodds): Remove
redundant casts and parenthesis.

(att_fight): Simplify.

(att_calcodds): Supply static keyword forgotten in rev. 1.49.

(sector_strength): Simplify.  Oops on impossible result.
2006-05-21 09:33:24 +00:00
e627f31c10 (attack_val): Don't truncate or round intermediate values, truncate
final result, like defense_val() does.

(defense_val): Simplify.  Remove check sanity check that is not
appropriate here.
2006-05-21 09:23:42 +00:00
ebe030feba (pln_sel): Clarification. No functional change.
(pln_mobcost): Don't round cost computation intermediate values.

(pln_mobcost): Don't limit cost to current mobility + 32.  No
airworthy plane can possibly use more than 55 mobility in one sortie,
and mobility going that much negative is fine.
2006-05-21 09:08:57 +00:00
9d8674f1a2 (sectdamage): Simplify. 2006-05-21 08:56:17 +00:00
739b5ac6fb (prod): Round the final cost instead of truncating along the way.
(prod, produce): Simplify calculation TECH_POP cost factor slightly.
2006-05-21 08:48:16 +00:00
898d1422fa (plane_sona): Compute range multiplier in double rather than int, to
match the formula used for sweep chance in plane_sweep().  Rounding
intermediate values is ugly anyway.
2006-05-21 08:17:15 +00:00
36c73ca99a (landdamage): Code to guard against zero land_mob_max was broken.
Remove it, as fixing it isn't worth it.  Remove superflous casts.
2006-05-21 07:59:19 +00:00
d8dc8a3257 (explore, ask_move_in_off): Compute weight as double, for consistency
with similar computations elsewhere.
2006-05-21 07:42:53 +00:00
9b282753d6 (deliver): Change mcost from float to double, because it's used as
double but never as float.  This avoids converting the value of
sector_mcost() to float and back.
2006-05-21 07:27:11 +00:00
416fe3d42d (coas, skyw): Don't convert value of tfact() to float and back. 2006-05-21 07:24:49 +00:00
16b9c41b39 (shp_mobcost): New.
(use_ammo, eta_calc, torp, fire_torp, perform_mission, retreat_ship1)
(shp_sweep, shp_nav_one_sector, cost_ship): Use it.

(perform_mission): Fix mobility cost of torpedo: charged full sector
cost instead of half.
2006-05-20 19:28:29 +00:00
2cd8e99f49 (oprange): Fix for non-missile planes: round pln_range/2 down, not up.
Planes didn't actually fly to the incorrect range, but mission showed
it.
2006-05-20 17:34:32 +00:00
2732ac5d1d (lnd_getmil, total_mil): Trivial, inline into callers and remove. The
abstraction from actual land unit mil encoding provided by them was
too leaky to be relied upon anyway.
2006-05-20 16:39:58 +00:00
3a38e91a5c (take_casualties): Remove superflous casts and parenthesis. Cast to
double rather than float where result usual arithmetic conversions
obviously convert the cast's result to double.  No functional changes;
code is still ugly and incomprehensible.
2006-05-20 16:24:15 +00:00
092a52f2c6 (att_estimate_defense, att_get_offense): Rename. Remove dead code and
unused last parameter.  Callers changed.
2006-05-20 15:17:30 +00:00
7ea516852b (sail): Don't interpret negative x-coordinates as unsail argument. 2006-05-20 14:20:24 +00:00
ed1b47c05a (mapindex, mapbuf): Change element type to unsigned short, because 16
bits suffice.

(bestownedpath): Use diroff[] and dirch[].  No functional change.
(dirchar, dx, dy): Remove.
2006-05-20 14:18:29 +00:00
2ae6be9af6 (num_teles, redir_fp, pipe_fp, exec_fd, sendeof, prompt, command)
(ac_intercept, all_missiles, ac_planedamage, ac_doflak, ac_landflak)
(ac_shipflak, ac_fireflak, can_fly, do_evade, att_calcodds)
(emp_setbitmap, lnd_hit_mine, conditions, get_wp, daemonize): Internal
linkage.
2006-05-20 13:54:45 +00:00
aac6312c74 (makeqt): Unused, remove. 2006-05-20 13:41:24 +00:00
e2f3f6839e (ioq_init): Initializing num_teles[] here is unmodular. Remove, as
default initialization is fine.
2006-05-20 13:40:56 +00:00
dd4a175532 (tfactfire): Unused since src/lib/subs/landgun.c rev. 1.12, remove. 2006-05-20 13:02:40 +00:00
d906fd6b99 DEFENSE_INFRA was implemented in an odd way: sct_defense was used
regardless of the option, but forced to sct_effic when disabled.  This
screws up sct_defense when you disable DEFENSE_INFRA.  Implement it
more like FALLOUT: use sct_defense if enabled, else sct_effic.  The
change should be invisible except in xdump, which shows the real
sct_defense.  Closes #804641.
(SCT_DEFENSE): New.
(dump, sinfra, sector_strength): Use it.
(eff_bomb, build_bridge, build_tower, new, buildeff, sect_damage)
(put_combat, checksect, produce_sect): Don't force sct_defense to
sct_effic when DEFENSE_INFRA is disabled.
2006-05-20 11:53:20 +00:00
499e19f97b (improve): Fix unsafe use of opt_DEFENSE_INFRA as array subscript. 2006-05-20 11:04:00 +00:00
d5eee2175b (nati): Remove weird code to round max safe population that has no
effect unless your floating-point arithmetic is hopelessly broken.
This code appeared in Chainsaw 3.2 or so.  Also remove some redundant
casts.
2006-05-20 08:43:24 +00:00
89cd9b7ca0 (EF_NATION_REJECTS, nation_rejects): New.
(empfile): Add it.
(nat_ca): Use it.
2006-05-18 19:42:23 +00:00
35d14c3e73 (cou_ca, nat_ca, ef_init_srv): Make selectors relations and rejects
visible to mortals in cou_ca[].
2006-05-18 19:20:16 +00:00
75604d817c (nsc_type): New member NSC_HIDDEN.
(meta_type): Add its entry.
(setnum, nstr_promote, nstr_exec_val): Deal with it.  nstr_exec_val()
implements opt_HIDDEN by mapping unknown values to -1.
(natstr, nat_ca): Use it for member nat_relate.  This also halves its
size.  Fixes very minor leak: before, player could see relations to
all countries, regardless of contact.
(nation_relations): Add entry for -1.
2006-05-18 19:02:04 +00:00
6844c94b4a (natstr, add, getrejects, putreject): Simplify rejections storage.
The space savings of nibble storage are not worth the hassle,
especially for xdump.

(nat_ca): New selector rejects.
2006-05-18 18:43:38 +00:00
af9c94d06f SuSE 9.3 reportedly needs -lncurses for setupterm(). 2006-05-18 18:18:45 +00:00
53f5cb861f Bump version to 4.3.4. 2006-05-18 18:10:27 +00:00
58035e0515 Another 4.3.3. change.
Tag 4.0.0 with the date of the r.g.e. announcement.
2006-05-16 21:39:14 +00:00
fee58a3b66 Update for current code. 2006-05-16 20:46:07 +00:00
9e15c62d7d (powe): Simplify.
(gen_power): Remove redundant parenthesis.
2006-05-16 20:06:24 +00:00
5258e63b48 Fix rev. 1.31. 2006-05-16 19:54:33 +00:00
6e3b478377 (powe): Rewrite computation of targets[] for power c using
snxtitem()/nxtitem(), for simplicity and more uniform syntax.  Country
names no longer work when specifying more than one country (snxtitem()
restriction).  As usual with nxtitem(), silently ignore unsuitable
items (the old code complained and failed).  Don't skip powerless
countries for power c.  Closes #1025607.
(set_target): Unused, remove.
2006-05-16 18:59:19 +00:00
6e148e3176 Fix markup. 2006-05-16 18:46:04 +00:00
b2408762cd Update for 4.3.3. 2006-05-14 19:35:40 +00:00
c332cfd460 Provide example, fix pasto. 2006-05-14 19:33:43 +00:00
568766dce6 (shiprepair, planerepair, landrepair): Simplify materials code. No
functional changes.
2006-05-14 18:26:25 +00:00
4ae17ff922 (shiprepair, landrepair): Always return 1. Change to return void.
Simplify callers.

(prod_ship, upd_ship, prod_land, upd_land): Move test for mineff.

(upd_land, feed_land): Move food resupply.

(landrepair): Don't putsect(), update code works directly on cache.
2006-05-14 18:23:44 +00:00
851e63ef05 (upd_plane, planerepair): New, factored out of prod_plane(). No
functional changes.
2006-05-14 18:13:55 +00:00
917d715c8c (prod_plane): Simplify carrier repair code. Oops on bad carrier. 2006-05-14 18:09:33 +00:00
f60efaca4e (prod_plane): Rename plp to pcp, remove redundant desc. Tally build
cost without rounding, like ships and land units do.
2006-05-14 17:54:52 +00:00
85e7e3c9d4 (prod_plane): Simplify test for moving satellite. 2006-05-14 17:40:00 +00:00
a50ae4a3d8 (effrange, torprange, fortrange): New.
(multifire, quiet_bigdef, torp, anti_torp, sd, sb)
(lnd_fort_interdiction, lnd_support, perform_mission, oprange)
(shp_fort_interdiction): Use them.  This fixes forts shooting below
FORTEFF in quiet_bigdef(), lnd_fort_interdiction() and
shp_fort_interdiction().  Change variables for rounded ranges to int.

(quiet_bigdef, sd): Don't scale ship firing range by efficiency.

(dd, sb): Simplify.

(sb): Internal linkage.

(perform_mission): Rename range2 to vrange.
2006-05-14 14:06:00 +00:00
5b4b3a13cb Break lines more tastefully. 2006-05-14 07:52:20 +00:00
fcc0162188 (nuke): Players need the uid to work with nukes, show it. Show
members introduced in nuke.h rev. 1.19 and 1.20: nuk_plane, nuk_effic,
nuk_tech, nuk_stockpile.  Make output similar to the other unit
reports while we're at it.
2006-05-13 15:30:30 +00:00
89694cd468 (detonate): Change parameters from carrying plane to nuke and
airburst.  Leave taking nuke off the plane to caller.  Use coord for
coordinate parameters.
(pln_damage): Take nuke off the plane.

(detonate): Destroy the nuke.  This is required since arming doesn't
remove nukes from the nuke file anymore (arm.c rev. 1.15).
2006-05-13 14:04:03 +00:00
324e52fa9d (nuk_postread): Update nuke location to match that of the plane
carrying it.  This is required since arming doesn't remove nukes from
the nuke file anymore (arm.c rev. 1.15).

(nuk_prewrite): Properly destroy nuke.  This is required since nuke
file contains individual nukes instead of stockpiles (nuke.h
rev. 1.19).
2006-05-13 13:41:02 +00:00
f70b64d91b (coun_cmd): Multiple client commands could overrun player->client[].
Reported by Luigi Auriemma.
2006-05-13 07:56:12 +00:00