Commit graph

167 commits

Author SHA1 Message Date
5507e8a1dc Replace the revolting build pointer data structure by a proper data
type.  Make it abstract because that's possible.  Change data layout
so that the slots belonging to a sector are together in memory, it's
nicer to the cache.
(bp): The new type.  Users changed.
(get_wp): Update accordingly.
(alloc_bp): New.
(update_main, calc_all): Use it.  Before, calc_all() allocated 1/7
more than necessary.
2007-01-13 09:07:59 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
6b70720318 New option AUTO_POWER; closes #1009993:
(opt_AUTO_POWER, update_power): New.
(update_main): Implement AUTO_POWER.
(powe): Disable power new when AUTO_POWER is on.

(powe): New power update.
(gen_power): Compute power into buffer passed by caller, make write to
power file optional.
2006-12-31 16:56:34 +00:00
Ron Koenderink
c6577ef2c5 (get_leader, pr_leader_change): New.
(set_leader, set_flagship): Replace with get_leader() and
pr_leader_change().
2006-12-31 12:31:18 +00:00
Ron Koenderink
fd49704a74 (switch_leader): Generalize the code, no functional changes.
(navi): Change switch_flagship() to call switch_leader() instead.
(switch_flagship): Remove, not needed, replaced with switch_leader().
2006-10-10 20:23:19 +00:00
Ron Koenderink
a9a9957a27 (radar): New, moved functionality from rada() except ef_type determination.
(rada): Call radar() with EF_SHIP.
(lrad): New, call radar() with EF_LAND.
(empmod[]): Call lrad() for lradar command.
(march, navi): Call radar() with appropriate type.
2006-08-16 01:16:30 +00:00
Ron Koenderink
f246f86542 (gift): Remove the type argument, can be determined from the ptr
argument. Replace prship/prland/prplane/prnuke code with
obj_nameof().
2006-08-02 13:07:09 +00:00
6db2e6ec63 (swaps): Failed to update coastal flags. Was missed in the changeset
containing coastal.c rev. 1.1.
(set_coastal): New parameter olddes, to simplify fixing swaps().
Callers changed.
2006-07-21 18:10:09 +00:00
Ron Koenderink
51275c753f (do_map): New. map() was split into two parts map() and do_map().
(map): Call new function do_map().
(display_region_map): Modify to use do_map() instead of map().
(tran_nmap, tran_pmap, cmd_move_map): Modify to accomodate
the modified display_region_map() function.
2006-07-12 18:14:31 +00:00
Ron Koenderink
6d90861aae (obj_nameof): New.
(nameofitem): Remove, switch callers to to obj_nameof().
(mission, show_mission): Convert functions to use obj_nameof()
instead of nameofitem().
2006-07-10 23:14:26 +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
Ron Koenderink
df8dc6ab5a (tran_map, tran_nmap, tran_pmap): Split tran_map() into tran_nmap()
and tran_pmap() so that unit number arguments are interpreted
sensibly.  Users changed.

(display_region_map): New.
(cmd_move_map, tran_nmap, tran_pmap): Use it.
2006-07-09 18:24:31 +00:00
Ron Koenderink
5ea9060132 (mission, build_mission_list_type, show_mission, oprange): Remove the
type parameter as it can be determined from the empobj parameter.

(oprange): Remove getting the unit information again as it is contained
in the empobj parameter passed in.
2006-07-09 10:57:24 +00:00
Ron Koenderink
79ee88f7c6 (nxtitemp, trade_getitem, trade_desc, trade_check_item_ok, nxtitem,
oprange, show_mission, nameofitem, build_mission_list_type,
unit_map, xdvisible, trdswitchown, ontradingblock, trad, check_trade,
unit_type_name, start_stop_unit, scut, scra, mission, multifire,
perform_mission, fuel, NSC_GENITEM): Replace struct genitem with
struct empobj.  Remove genitem.h and create a new file empobj.h.
Replace multiple instances of unions of ef_type structures with
one standard union empobj_storage which is a superset of the individual
instances.
2006-07-07 15:15:43 +00:00
cdfb17d28a (satdisp, satdisp_sect, satdisp_units): Split satdisp() into
satdisp_sect() and satdisp_units().
(satmap): Call only satdisp_sect().  No functional change.
(aircombat): Call both, and call satdisp_units() even over sea.  This
lets spy planes spot surface ships at sea.  Closes #906035.
2006-06-14 17:38:16 +00:00
f900ac68cb (shp_sweep): New parameter takemob. Charge mobility only if it's
true.
(shp_nav_one_sector): Pass false.  This lets minesweepers move at the
speed their stats indicate.  Closes #1498801.
(navi): Pass true.  This ensures sweeping without moving still costs
mobility.
2006-06-11 18:09:09 +00:00
32e4fbd284 Move signal stuff into src/lib/empthread/, no functional change:
(empth_init_signals): New, factored out of start_server().  Call from
empth_init().
(panic): Move to posix.c, internal linkage.
(empth_obj): Add new posix.o

(empth_start, empth_alarm) [EMPTH_POSIX]: Clean up pointless messing
with signal handlers.
(empth_init, empth_wakeup) [EMPTH_POSIX]: Clean up a bit.
2006-06-05 08:51:02 +00:00
20c02295a6 (BestDistPath): All callers pass MOB_ROAD to parameter mob_type,
remove it.  Callers changed.
2006-06-04 16:49:24 +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
6fadcf6e8e (buil): Use ef_elt_byname() instead of typematch().
(typematch): Unused, remove.
2006-06-01 18:57:03 +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
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
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
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
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
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
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
384555b811 (pln_arm): Change parameter mission from int to char to clearly
document its use.
2006-04-30 16:15:33 +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
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
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
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
8ca2468706 (gift): Fix parameter types: natid instead of int, void * for generic
pointer, char * for string.
2006-03-26 08:18:34 +00:00
79714720cc (ontradingblock, trdswitchown): Second parameter is a generic pointer,
change it from int * to void *.  Callers changed not to cast to int *.
2006-03-25 15:11:17 +00:00
8054aafb9a (u_char, u_short, u_int): BSDisms. Figuring out whether sys/types.h
defines them would be possible, but isn't worth the trouble.  Replace
by unabbreviated types.
2006-03-25 07:05:34 +00:00
38fdf1ba43 (config_tables, custom_tables, read_config_tables, read_custom_tables)
(read_config_table_file, read_custom_table_file): Rename.
2006-02-23 18:31:23 +00:00
02ddee69fb (banfil, authfil): Remove. Matching user is useless, because the
player can send whatever he wants.  Banning IPs is better done with a
packet filter.  That leaves restricting deity IPs.
(privip): New econfig key to restrict deity IPs.
(may_play): Implement it.
(match_user): Unused, remove.
2006-02-22 20:57:51 +00:00
9a30f30107 (builtindir): New econfig key, variable and make variable.
(subst.in): Substitute it.  Fix prerequisites.
(read_builtin_tables): New.
(main): Call it.  This doesn't do anything, because no builtin tables
have been defined.
2006-02-19 07:04:30 +00:00
bd65a84eb5 New way to read configuration tables:
(config_tables): New econfig key.
(read_config_tables): New, implements config_tables.
(main): Call it.  Need to call ef_init() and chdir(configdir) first.
(ef_init_srv): Don't call ef_init(), since main() did it already.

Remove old way to do the same:
(ef_load): Remove, along with calls.
(empfile): Set configuration tables' member file back to NULL.
2006-02-18 13:57:52 +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
Ron Koenderink
74e4e2810a (fuel, load, shp_check_nav, retreat_ship1, shp_nav_one_sector)
(shp_check_nav, sail_nav_fleet, bigcity_dchr[], sector_navigation[])
(d_navigation): Add a NEW d_navigation enum NAV_CANAL to
indicate that a sector has canal capability. Add canal determination
logic to shp_check_nav(). Update sector_navigation[] with new
canal navigation enum.  Use shp_check_nav() to determine the
sector can be navigated.
2006-01-21 20:56:50 +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