Commit graph

784 commits

Author SHA1 Message Date
6fadcf6e8e (buil): Use ef_elt_byname() instead of typematch().
(typematch): Unused, remove.
2006-06-01 18:57:03 +00:00
c432e3107d Symbolic names for table entries in conditionals, closes #928376:
(ef_elt_byname): New.
(nstr_match_val): Use it to generalize to arbitrary table with
uniquely named elements.  Use ca_type to find table, remove parameter
type.  Callers changed.
(nstr_mkselval): Adapt sanity check accordingly.
(NSC_TYPEID): No longer needed, remove, users changed to use
appropriate integer type instead.  This fixes signedness of sector
selectors des and newdes.
(meta_type): Remove entry for NSC_TYPEID.
(nstr_coerce_val): Can't detect typeid - integer mismatch anymore.
Was nice to have; perhaps revive it later.
2006-06-01 18:48:42 +00:00
eb1512d75f Let players stop/start units:
(genitem, lndstr, nukstr, plnstr, shpstr): New members off, lnd_off,
nuk_off, pln_off, shp_off.
(NSC_GENITEM): New selector off.
(land, nuke, plan, shi): Display efficiency prefixed by `=' when off.
(start, stop, player_coms): Rewrite, new syntax.  Print only objects
that actually change.
(start_hdr, stop_hdr, start_stop_hdr): Consolidate.
(item_u, start_stop, start_stop_sector, proff, start_stop_unit)
(start_stop_unit_hdr, unit_type_name): New.
(upd_land, upd_plane, planerepair, upd_ship): Obey and clear stoppage.
2006-05-29 21:11:14 +00:00
520446ef39 Remove budget priorities:
(budg, player_coms): Remove command arguments.
(PRI_SMAINT, PRI_PMAINT, PRI_LMAINT, PRI_SBUILD, PRI_PBUILD)
(PRI_LBUILD, PRI_MAX): Remove.
(natstr): Remove member nat_priorities.
(add, main): Remove its initialization.
(budg, cal_call, prexpense, prod, update_main, upd_land, upd_plane)
(upd_buildeff, produce_sect, upd_ship): Simplify.
(produce_sect): Last parameter now superflous, remove & simplify.
(change_prio, do_prod): Unused, remove.

(budg): Move land units output down, to match update sequence.
2006-05-29 20:43:30 +00:00
1b94ddedc3 Change encoding of `not in any group' from space to 0, because that's
friendlier in conditionals:
(army, build_ship, build_land, build_plane, doship, doplane, dounit)
(flee, check_trade, wing, snxtitem_group, takeover_ship)
(takeover_land): Assign 0 instead of space.
(carg, lcarg, pr_ship, pr_plane, pr_land, ldump, land, pdump, plan)
(retr, lretr, sdump, shi, lnd_list, shp_list, ask_olist, att_prompt)
(ask_move_in): Update printing of group.

(takeover_plane): Failed to clear wing.
2006-05-27 13:44:18 +00:00
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
320a265d2f (natstr): Remove unused member nat_spare[]. 2006-05-24 18:33:28 +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
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
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
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
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
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
89cd9b7ca0 (EF_NATION_REJECTS, nation_rejects): New.
(empfile): Add it.
(nat_ca): Use it.
2006-05-18 19:42:23 +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
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
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
9b14771d69 Remove redundant casts. 2006-05-13 07:42:18 +00:00
97be5018e2 (hap_req): New.
(nati, populace): Use it.

(populace, nati): Change hap, pct from float to double, because they
are used as double.

(nati): Print happiness needed with just two decimals, like the other
levels.
2006-05-06 11:07:35 +00:00
802f69b039 (nukstr): Make it a struct genitem: add members nuk_effic, nuk_mobil,
nuk_tech, nuk_stockpile, nuk_opx, nuk_opy, nuk_mission, nuk_radius.
These have no effect, yet.
(build_nuke): Initialize them.
(nuke_ca): Add genitem selectors: effic, mobil, tech, group, opx, opy,
mission, radius.
(tran_nuke): Zap mission, just in case somebody invents missions for
nukes.
(trade_desc): Show tech and efficiency, for consistency with other
units.
2006-05-06 07:37:00 +00:00
2e40a4bb90 Change nuke storage and commands to match other units:
(nukstr): Hold one nuke instead of a stockpile: replace members nuk_n,
nuk_types by nuk_type, nuk_plane.  Add nuk_land for completeness, like
nuk_ship it's not yet used.
(nuke_ca): Update accordingly: replace selectors number and types by
type and plane.
(build_nuke): Update accordingly.
(ndump, nuke): Update accordingly.  Output is no longer sorted by
location, and nukes in same location no longer share id.  nuke's extra
columns for nuclear plants are repeated for every nuke.
(trade_desc): Update accordingly.
(cede, grab_sect, check_nuke_ok, detonate, trade_nameof): Talk about
nukes instead of nuclear stockpiles.
(arm, disarm): Rewrite, split off new disarm().  Don't remove nuke
from the nuke file on arm.  Allow usual plane syntax, not just plane
number.  Change second argument from nuke type to nuke number.  When
plane is already armed, ignore nuke argument and rearm (broken in
4.2.6).
(tran_nuke): Update for changed struct nukstr, make as similar as
possible to tran_plane.  Change syntax to match transport plane.
(player_coms): Update arm, disarm and transport accordingly.
(prnuke, nuk_on_plane): New.
(nuk_add, nuk_delete): Stockpile management, remove.
2006-05-06 07:20:21 +00:00
7ed308526c Remove redundant casts of argument to (prototyped) double parameter. 2006-05-01 12:34:16 +00:00
898c74a80f (get_couval, get_outstand): Remove. Unused since automatic loans were
removed (buy.c rev. 1.18, trad.c rev. 1.15), should have been removed
then.
2006-04-30 18:20:23 +00:00
ba74075e9a Fix the previous revision. 2006-04-30 16:18:35 +00:00
384555b811 (pln_arm): Change parameter mission from int to char to clearly
document its use.
2006-04-30 16:15:33 +00:00
a292d6f98a Fix insufficiently parenthesized macro expansions. 2006-04-30 16:08:45 +00:00
8cb55944a3 (TERR_MAX): New.
(terr): Use it.

(terr): When the territory number is bad, do not loop prompting, just
fail.  That's what the vast majority of commands do.
2006-04-30 12:56:41 +00:00
e09e6e587b Normalize long int and short int to just long and short. 2006-04-30 12:05:23 +00:00
95de3bccbb Doc fix. 2006-04-30 08:31:52 +00:00
9cf1713892 (lnd_mess): Internal linkage. 2006-04-30 08:29:18 +00:00
0c8c169f88 (s_char): Remove. Use signed char for small integers, plain char for
characters.
2006-04-29 16:25:17 +00:00
a988b907fc s_char purge directed by compiler warnings. 2006-04-29 06:41:45 +00:00
422d8e517f (snxtitem): s_char purge. 2006-04-24 18:27:31 +00:00
ca595ddc3b Fix char / s_char inconsistencies. Build was broken on some systems
since the first one crept in with src/lib/subs/retreat.c rev. 1.34.
2006-04-24 18:24:23 +00:00
da6306b8b0 Fix missing include. Closes #1464069. 2006-04-20 18:39:57 +00:00
6fee3f4535 (CANT_REACH): New. Use it instead of CANT_HAPPEN() where possible.
(oops): Cope with NULL argument passed by CANT_REACH().
2006-04-17 17:36:07 +00:00
e264be1a78 (XYOFFSET): Parenthesize macro parameters in expansion. 2006-04-17 12:51:23 +00:00
75eec5e0e3 Comment grammar fix. 2006-04-05 18:34:54 +00:00
6fdac645ba (bestownedpath, owned_and_navigable): Terrain parameter isn't really
used, remove it.  Use null bigmap argument to ignore terrain (flying),
non-null for navigation.  Callers changed.
2006-04-05 09:50:45 +00:00
b923c951ed (P_NONE, P_WALKING, P_FLYING, P_SAILING, p_mode): Turn into new
enumeration p_mode.  Users changed.  s_char and register purge.
2006-04-05 07:21:49 +00:00
7d5a6b817e (iop): Remove unused members assoc, notify.
(io_open): Remove unused parameters assoc, notify.  Caller changed.
2006-03-29 19:19:47 +00:00
9847e27a2f (genlist): Move from include/mission.h to src/lib/subs/mission.c.
(genlist): Remove unused members x, y.

(genlist): Use void * for generic pointer members cp, thing.  Change
users not to cast.

(oprange): Oops on bad argument.
2006-03-29 07:53:25 +00:00
a1ce7db238 (move_ground): Drop first parameter of map callback, it's not used.
Callers changed.  s_char purge.
2006-03-28 19:46:40 +00:00
9f658368b8 (MINE_LDAMAGE): Change to match damage suffered in lnd_hit_mine().
This increases damage suffered in retreat.  Fix info Damage.
(shp_hit_mine): Use MINE_DAMAGE().
(lnd_hit_mine): Use MINE_LDAMAGE().
2006-03-27 21:47:50 +00:00
8ca2468706 (gift): Fix parameter types: natid instead of int, void * for generic
pointer, char * for string.
2006-03-26 08:18:34 +00:00
38f3f7ea49 (trade_check_item_ok): New.
(trade_check_ok): Use it and simplify.

(set): Use new trade_check_item_ok().  The code replaced by it didn't
work (abusable bug).
2006-03-25 15:26:29 +00:00