Commit graph

1971 commits

Author SHA1 Message Date
f3e85c2f70 Coding style, comments, spelling... 2006-05-26 18:46:50 +00:00
109dad1bee (food_needed): New.
(feed_ship, feed_land): Use it.
(do_feed): Use it.  Estimate of food needed was one too large for
integer food needs.  Used to round fractional food need to nearest
instead of up for supply_commod(), which could cause starvation.
(s_commod, get_minimum): Use it.  Estimate of food needed was one too
large for integer food needs.  s_commod() used to reserve one more
than get_minimum() would have returned; it's now the same.

(famine_victims): New.
(feed_people): Use it.  This rounds victim fractions down instead of
up.  It also dosn't flush needs <=1 to zero.  Doesn't change
starvation, as do_feed() always produces at least one emergency food.
Does change food consumption.

(starve_some): New.
(feed_people): Use it.

(feed_ship): Use feed_people().  This rounds victim fractions down
instead of up.

(feed_land): Use feed_people().  Rounding of victim fractions
unchanged.  Feeds all people not just mil; closes #913997.

(starv_people): New.
(starv_sects, starv_ships, starv_units): Use it.  Fixes starve land to
talk about people instead of mil.

(starv_sects): Use famine_victims() rather than feed_people().  Take
emergency food into account, because feed_people() doesn't.  Don't aim
for one extra food, for consistency with starv_ships() and
starv_units().
(feed_people): Remove useless parameter.  Simplify.

(starv_ships, starv_ships): Use famine_victims() rather than
feed_ship() and feed_land().
(feed_ship, feed_land): Remove useless parameters.  Internal linkage.
Simplify.

(feed_land): Call resupply_commod() only if there's a food shortage.
Don't scrounge lnd_ship for food, resupply_commod() already does.
2006-05-26 18:22:42 +00:00
0ac31b3ece (ask_olist): Fix rev. 1.45. The bug makes it impossible to assault or
board with land units.
2006-05-26 17:53:53 +00:00
d723532add Bump version to 4.3.5. 2006-05-26 05:09:00 +00:00
56181c1986 The previous revision of Make.mk didn't work with separate build
trees.  Do it in a way that does.
2006-05-25 08:18:20 +00:00
edbf6b0061 4.3.4 last minute changes. 2006-05-25 05:48:58 +00:00
8a81c5b404 Autoconfigure NROFF. Traditional nroff now works in addition to
groff.
2006-05-24 19:56:13 +00:00
b01382cdcc Don't use -I with $(NROFF), old versions of groff and traditional
nroff don't support it.
2006-05-24 19:55:05 +00:00
320a265d2f (natstr): Remove unused member nat_spare[]. 2006-05-24 18:33:28 +00:00
cc1df4e88a (verify_fail): New parameter idx. Use it to print array index when
applicable.  Callers changed.
2006-05-24 18:32:13 +00:00
46a7a9c17f SuSE 9.3 reportedly needs -lncurses for setupterm(). 2006-05-24 18:26:34 +00:00
1fad65964f Update for 4.3.4. 2006-05-23 18:14:17 +00:00
c7d41b3f98 Document need for curses. 2006-05-23 18:04:11 +00:00
ee53725a21 (prmptrd, uprmptrd): Oops on null prompt. getstarg() is sometimes
called with a null prompt when it is believed not to use it, and that
belief is sometimes wrong.  Other users could have similar bugs.  Some
systems (GNU, Windows) deal gracefully with printing null strings,
others crash.
2006-05-23 06:04:55 +00:00
93b6a54356 (nat_ca, cou_ca, ef_init_srv, xdvisible): Plug major information leak:
nat_ca[] was designed for visibility to the owner only, while cou_ca[]
was designed for the public.  xdvisible() implemented that for xdump.
But selectors don't care for that!  Since nat_ca[] applies to
EF_NATION, it must be for public visibility.  Broken in 4.2.21.  Fix
by exchanging contents of nat_ca[] and and cou_ca[].  This breaks
clients relying on xdump.
2006-05-22 20:59:11 +00:00
Ron Koenderink
548bc5bbdc (command): Remove unused local variable i. 2006-05-22 20:37:20 +00:00
df3786ac40 (command): Don't fold conditionals to lower case. This was added
early in Chainsaw 3, most probably to make them case insensitive.
This is of debatable utility, and inconsistent with the case
sensitivity of commands and arguments.  It also interferes with string
conditionals: fleet#A is folded to fleet#a, which means something
else!
2006-05-22 20:04:54 +00:00
13cd9081da Minimize redundancy between (mortal's) xdump nation and xdump country:
(ef_init_srv): Make NSC_DEITY in cou_ca mirror ~NSC_EXTRA in nat_ca,
except for cnum, which may not have either flag in either table.
(nat_ca): Make selectors stat, cname, passwd, xorg, yorg, relations,
contacts and rejects NSC_EXTRA.
2006-05-22 19:58:44 +00:00
a8e2df3ad8 (edit): Crashed when country argument didn't name a country. Fix &
simplify.  Reported by Pat Loney.
2006-05-22 18:51:24 +00:00
Ron Koenderink
44a5e5d65a (nuke): Removed unused local variable. 2006-05-22 17:23:31 +00:00
Ron Koenderink
263927cb7e (att_get_offense): Remove unused local variables. 2006-05-22 17:22:28 +00:00
0e14911d72 Rev. 1.26 screwed up return value for building, which was visible in
output of budget.  Reported by Stefan Hauser.
2006-05-21 20:24:36 +00:00
ba578e0e23 (nstr_resolve_id): Resolve ambigous name into string if string_ok.
(nstr_comp_val): Break long line.
2006-05-21 20:05:50 +00:00
433f223a14 (NSC_GENITEM, ship_ca, plane_ca, land_ca): Change selectors group,
fleet, wing and army from numbers to user-friendly strings.  This
makes ?fleet#'a' work.  Closes #928405.
2006-05-21 17:25:40 +00:00
0d842c47f7 Purge the register keyword. 2006-05-21 13:18:57 +00:00
4c4fdca42b Line breaks and other formatting issues. No functional changes. 2006-05-21 13:05:24 +00:00
281840b604 (pln_hitchance): Change tfact from float to double, because it is used
as double.
2006-05-21 13:03:40 +00:00
cd73a47dfa Remove superflous casts and parenthesis. 2006-05-21 12:24:30 +00:00
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