Commit graph

44 commits

Author SHA1 Message Date
7465574195 Break long lines more tastefully 2010-06-20 18:36:44 +02:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
a61e673a07 Clean up poorly chosen loop control variable names
Calling a counting loop's control variable q or x is tasteless
bordering on actively misleading.
2009-05-21 09:30:05 +02:00
6ae4eca045 Don't use 0 as null pointer constant, part 3
This part replaces E == 0 by !E, where E has pointer type.
2009-03-24 21:46:01 +01:00
615681ce16 Don't use 0 as null pointer constant, part 1
Use NULL instead of 0, for clarity.  Except in pointer comparisons;
leave that to the next two commits.
2009-03-24 21:45:44 +01:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
b27298d4c5 New option RAILWAYS
With RAILWAYS, highway-like sectors double as rail.  They need to be
at least 5% efficient to be operational, and then they additionally
extend rail into adjacent sectors that are at least 60% efficient.

New opt_RAILWAYS, SCT_HAS_RAIL(), sct_rail_track().  Update
sector_mcost(), bp_neighbors(), lnd_mar_one_sector() for RAILWAYS
mobility rules.  Update sinfra(), spyline(), satdisp_sect() to show
rail track instead of rail infrastructure for RAILWAYS.

New virtual sector selector track, implemented by nsc_sct_track().
2008-11-01 11:40:15 -04:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
3812cde100 Include system headers before ours 2008-03-14 20:25:11 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
56de7a2151 (WORLD_SZ): New.
(isok, ef_init, bmaps_intersect, bp_init, player_accept)
(finish_sects, main): Use it.

(bp_neighbors, bp_lbcost, pathcost): Use XYOFFSET().  No
functional change.
2007-07-28 12:12:17 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +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
df6f365a71 (dchrstr): Replace int members d_mcst and d_emcst (mobility cost * 5)
by float d_mob0 and d_mob1 (straight costs).  Impassable terrain now
encoded as negative d_mob0 instead of zero d_mcst.  Users changed.
sect.config updated.
(dchr_ca): Replace selectors mcst and emcst by mob0 and mob1.
(show_sect_stats): Show real mobility costs.
2006-06-17 14:08:20 +00:00
07de857b88 (sector_mcost, bp_neighbors, lnd_mar_one_sector): Deal with disabled
road/rail infrastructure.
2006-06-16 21:11:25 +00:00
5ad86bc7ce 4.0.2 made land unit mobility costs differ significantly from normal
move costs, but failed to make A* use these costs.  This broke land
unit path finding.  Fix:
(MOB_ROAD, MOB_MOVE, MOB_MARCH): Split MOB_ROAD into MOB_MOVE and
MOB_MARCH.  Users changed.
(lnd_mobcost, sector_mcost): Move minimum mobcost logic to
sector_mcost(), where it is visible to A*.  Also fixes unit reaction
path cost.

(lnd_path): Fix confusing message: don't claim there's no path when
all we really know is that there's no railway.
2006-06-04 17:41:12 +00:00
6ab05ae8a1 Path finding for trains never worked; it ignored the need for rail:
(sector_mcost, bp_neighbors): Fix for MOB_RAIL and sct_rail == 0.
Closes #781528.
2006-06-04 17:27:17 +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
cd73a47dfa Remove superflous casts and parenthesis. 2006-05-21 12:24:30 +00:00
29c61d574c (bp_lbcost): Don't convert the cost from double to float and back.
Simplify.
2006-05-07 09:19:21 +00:00
a988b907fc s_char purge directed by compiler warnings. 2006-04-29 06:41:45 +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
8383f33229 (as_data): Use void * for userdata member and userdata parameter of
callbacks.  Users changed.
2006-03-28 21:00:00 +00:00
aa5a8ec0dc (bp_init): Use semantically correct return type instead of s_char *.
Caller changed.
2006-03-28 20:42:57 +00:00
21bf6b41d4 Use NULL instead of (FOO *)0, it's easier to read. 2006-03-23 20:48:49 +00:00
3252f8a907 (dirchar, neighsects, login_coms, lookup_list, g_distptrs, level_easy)
(level_log, levelnames): Internal linkage.
2006-03-23 20:32:29 +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
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
e29f288289 Remove silly superflous parenthesis. 2005-12-03 21:14:26 +00:00
e59f9a43d1 (ep): Global variable pointing to sector cache. Gross. Remove.
(bp_neighbors, bp_lbcost, pathcost): Replace pointer arithmetic by
array subscript.
2005-10-30 16:22:29 +00:00
ca517d5a44 (pathcost): Fix the previous rev. 2005-09-25 16:03:22 +00:00
a88f12017e (dirindex): Narrow member type to signed char to save cache.
(pathcost): Catch bad direction characters (should not happen).
2005-09-25 09:15:27 +00:00
380b063f9c Remove some redundant parenthesis; no functional change. 2005-07-23 19:48:35 +00:00
4f59fc9967 Remove a bunch of redundant casts. 2005-06-12 06:31:48 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
8f40f5ad6d [DO_EFF_MEM_CHECKING]: Dead for some ten years. Bury. 2005-03-12 13:40:24 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
69d06bad46 (sctcache, bestp) [!DO_EFF_MEM_CHECKING]: cache isn't used, don't
define it.
2004-03-01 14:16:31 +00:00
237baffca9 Supply prototypes where possible. This uncovered type errors with
thread entrypoints:
(lwpSelect, shutdown_sequence): Parameters didn't match thread entry
point prototype.
(lwpEntryPoint): Arguments didn't match thread entry point prototype.

Change linkage of functions without prototype declaration to static
where possible.

Remove some superflous declarations, replace others by suitable
includes.
2004-02-17 17:59:30 +00:00
4ae9c417b3 (bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without
effect.  Replace calls by struct assignment where possible.  Replace
clear buffer, copy string to buffer by strncpy().  Use assignment to
clear when that's clearer.  Replace overlapping copy through bounce
buffer by memmove().  Replace rest by standard memset() and memcpy().
Also use sizeof() instead of literal array sizes for robustness, and
instead of symbolic array sizes for clarity.
2004-01-08 17:54:28 +00:00
2fe312adac (at_minimum, blocksig, emp_bitinit, filelogerror, iceil, ifloor,
mapdsq, mask, signame, strscan, sys_siglist, typed_wire, unblocksig):
Unused, remove.

(add_airport, add_to_fired_queue, air_damage, anti_torp, best_path,
bitinit2, blankrow, bmnxtsct, bp_init, build_mission_list,
build_mission_list_type, buildeff, candchrg, canshoot, cantorp,
cede_sect, cede_ship, checksect, client_cmd, coun_cmd,
deity_build_land, divide, do_conv, do_defdam, do_demo, do_desi,
do_mob_land, do_mob_plane, do_mob_sect, do_mob_ship, do_prod,
docountry, doland, doplane, doship, dosupport, dotsprintf, dounit,
empth_start, enlist, errcheck, filereport, find_airport, find_escorts,
findcondition, fire_dchrg, fire_torp, fltp_to_list, get_minimum,
getin, goodsect, grab_sect, grab_ship, grow_people, growfood, in_addr,
infect_people, init_mchr, init_pchr, init_plchr, is_engineer,
itemname, kill_cmd, landrepair, limit_level, list_cmd, lupgr,
materials_charge, materials_cost, meltitems, mission_pln_arm,
mission_pln_sel, move_map, nat_cap, num_units, outid, pass_cmd,
perform_mission, pinflak_planedamage, play_cmd, pln_equip, prexpense,
print_res, prplanes, prunits, pupgr, quiet_bigdef, quit_cmd, radmap2,
retreat_land1, retreat_ship1, s_commod, sanc_cmd, sarg_getrange,
scuttle_it, scuttle_land, set_target, share_incr, shiprepair,
shp_check_mines, shp_check_nav, shp_check_one_mines, shp_hit_mine,
shp_interdict, shp_mess, sort_lookup_list, starvation, supgr, swap,
take_casualties, trunc_people, upd_buildeff, upd_land, upd_ship,
use_ammo, user_cmd): Change linkage to static.
2003-12-17 23:13:50 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00