Commit graph

146 commits

Author SHA1 Message Date
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
Ron Koenderink
14d94c2509 (sect_has_dock): New.
(fuel, load, nav_loadship): Use it.
2006-01-17 23:38:51 +00:00
Ron Koenderink
1d58f58e1b (check_nav, shp_check_nav, sail_nav_fleet, retreat_ship1):
Make shp_check_nav() public.
Remove check_nav(), replace with shp_check_nav().
No functional change as check_nav() and shp_check_nav() are
identical.
2006-01-17 13:11:24 +00:00
Ron Koenderink
04a8b84592 (ship_bomb, deli, do_demo, fuel, grin, look_ship)
(ltend, multifire, quite_bigdef, mine, landmine)
(do_loan, prod, printdiff, sell, sona, stre)
(tend, fire_dchrg, vers, work, ac_planedamage)
(ac_shipflak, ask_off, get_mine_dsupport, att_fight)
(ask_move_in_off, detonate, sd, land_gun)
(land_unitgun, lnd_fort_interdiction, lnd_fortify)
(perform_mission, pln_mine, pln_mobcost)
(retreat_ship1, retreat_land1, shp_sweep)
(shp_fort_interdiction, shp_missle_defense)
(new_work, growfood, upd_land, land_repair)
(get_materials, do_mob_ship, do_mob_land)
(load_it, unload_it, prod_plane, produce)
(guerrilla, upd_buildeff, spread_fallout)
(upd_ship, ship_repair, min, dmin, MIN):
Remove min() and dmin() functions and replace
with a MIN macro in misc.h.  Remove local MIN
macros and use the new one in misc.h.  This
change removes the need for the special
case for _WIN32.

(fuel, look_ship, multifire, mission, sona)
(plane_sona, ef_open, player_accept, player_main)
(ac_dog, att_get_combat, calc_mobcost)
(ask_move_in_off, intelligence_report)
(build_mission_list_type, perform_mission)
(show_mission, use_supply, dodistribute)
(allocate_memory, max, dmax, MAX):
Remove max() and dmax() functions and replace
with a MAX macro in misc.h.  Remove local MAX
macros and use the new one in misc.h.  This
change removes the need for the special
case for _WIN32.
2006-01-12 14:23:55 +00:00
402c47b66e (natargp): New, factored out of natarg(). 2006-01-06 20:27:17 +00:00
ffa21cf379 (cnumb): Return the same error values as stmtch(). Callers don't
(yet) care for the difference.
2006-01-06 19:42:27 +00:00
6a5d398c6d (natarg): Don't attempt to hide names of countries not yet contacted
with HIDDEN.

(natarg): Clearer error messages.
2006-01-06 17:00:18 +00:00
8e5d576fff (nxtitemp): Use void * for generic pointer function value. 2006-01-06 16:55:17 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
8329b8884a (comtch): Parameter god permitted execution of any command, even when
com->c_permit disagreed.  Doesn't make sense and is inconsistent with
output of list.  Remove parameter.  The only command affected is
break.
2006-01-04 19:12:44 +00:00
b69173eea4 (orig): Allow moving origin to another country's origin. This is a
superset of the offset command.
(offs): Redundant, underdocumented, remove.

(orig): Allow deities to reset origin to absolute 0,0.
2006-01-04 14:36:21 +00:00
c3900f8424 (empfile, fileinit, lnd_init, lnd_postread, lnd_prewrite, nuk_init)
(nuk_postread, nuk_prewrite, pln_init, pln_postread, pln_prewrite)
(sct_postread, sct_prewrite, shp_init, shp_postread, shp_prewrite)
(ef_extend): Use void * for generic pointer parameter.
2005-12-31 12:52:18 +00:00
fa52e6944d Normalize inclusion guards: use NAME_H for name.h. Some headers
lacked them, others used reserved identifiers.
2005-12-29 10:16:01 +00:00
19d88af312 Support for IPv6:
(tcp_listen, player_addrlen): New.  IPv4-only code factored out of
player_init().
(player_init): Use them.
(player_accept): Address family independence.
(tcp_connect): New.
(main): Use it.
(hostaddr, hostconnect, hostport): Internal linkage.
2005-12-28 18:50:08 +00:00
Ron Koenderink
233181c50d (player_new, player_accept, update_wait, market_update) [_WIN32]:
Move assignment of hostaddr and hostname from player_new() to
player_accept().  This solves the necessary of adding the socket include
file to prototypes.h for player_new().  The socket include file creates
a namespace conflict for WIN32.
2005-12-26 03:53:21 +00:00
320322cda9 (oops): Move declaration to misc.h, to make CANT_HAPPEN() usable
with just misc.h included.
2005-12-05 22:13:35 +00:00
Ron Koenderink
40c821d28b (ef_init_srv): Add a call ef_verify() to verify game data and game
configuration consistency.

(ef_verify): New.  Verifies game data and game
configuration consistency.
2005-11-30 19:17:58 +00:00
Ron Koenderink
e89fb0bb17 (close_files, finish_server, panic):
Rename close_files() to ef_close_srv() and move to fileinit.c.
Replace calls to close_files() with ef_fin_srv().
Call ef_close_srv() from ef_fin_srv().

(ef_close_srv, ef_fin_srv): New.

(init_files, init_server, ef_init_srv):
Rename init_files() to ef_open_srv() and move to fileinit.c.
Remove call to init_files() from init_server() and replace
with a call to ef_open_srv() from ef_init_srv().

(ef_open_srv): New.

(ef_load, init_server, ef_init_srv):
Move the call to ef_load() from init_server() to ef_init_srv().

(global_init, init_server, ef_init_srv):
Move the call to global_init() from init_server() to ef_init_srv().

(nullify_objects, global_init, init_server):
Split nullify_objects() into init_lchr() and init_dchr().
Locate init_lchr() and init_dchr() in init.c.
Add calls to init_lchr() and to init_dchr() from global_init().

(init_lchr(), init_dchr()): New.
2005-11-29 03:57:44 +00:00
Ron Koenderink
7b94794365 (cens, desi, dump, do_desi, doland, file_sct_init, grow_continents)
(grow_islands, set_coastal, update_coastal_flag, coast_sea_to_land)
(coast_land_to_sea): Determine sct_coastal flag when the sector type
is set.  Old method only updated the sct_coastal flag when doing
cens() or a dump().  Other uses of sct_coastal could get stale values,
including selector coastal.  Rework set_coastal() into NEW functions
update_coastal_flag(), coast_sea_to_land(), coast_land_to_sea() and
set_coastal().  Fix a bug where the deity designation would not
properly set the coastal flag.  Fix a bug where the one sector lake
would not properly compute coastal flag.  Fix a bug that makes
fairland treat the last sector it adds to an island as non-coastal.
2005-11-17 03:21:32 +00:00
Ron Koenderink
d581485d32 (plurize): Fix the strncat() len parameter to prevent an overflow of buf.
(numstr, esplur, splur, iesplur, plurize): Move the prototype defintions from
misc.h to prototypes.h.  Remove unneccessary headers in plur.c.
2005-11-13 23:18:37 +00:00
Ron Koenderink
d8422caa84 (init_server, ef_load, xundump): Add ability to customize game
configurations.  The custom game configurations are loaded via
text files in the data directory.  Closes #752881.
2005-11-12 16:53:52 +00:00
Ron Koenderink
1b74e7ac42 (mission_short_name): Remove mission_short_name, not used. 2005-11-04 18:27:28 +00:00