Commit graph

106 commits

Author SHA1 Message Date
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
087c0aae36 Simplify write_sects() sector loop nest
No functional change.
2008-05-17 22:24:27 +02:00
ba1a320ce2 Make fairland obey file locks
Do that by making it use file.h instead of stdio.

This doesn't overwrite the sector file completely anymore, it just
sets sct_type, sct_newtype, sct_elev and sct_coastal.  You really need
to run files first now.
2008-05-17 20:10:45 +02:00
d2a7bb6b6f Make fairland finish argument parsing before reading econfig 2008-05-17 19:52:38 +02:00
4a0732375d Remove redundant initializations from fairland's fl_sct_init() 2008-03-14 20:25:09 +01:00
191c5bea0f Clean up confusing loop control in fairland 2008-03-14 20:25:09 +01:00
49780e2c6c Extend the common header of struct empobj to include uid
Make sure all members of unit empobj_storage share uid in addition to
ef_type.

Add matching uid member to struct gamestr, struct natstr and struct
sctstr, and set them.

Swap struct empobj members uid and own to make that easier, and update
struct comstr, struct lndstr, struct lonstr, struct loststr, struct
nwsstr, struct nukstr, struct plnstr, struct realmstr, struct shpstr,
struct trdstr, struct trtstr accordingly.

Note that the uid isn't properly set for struct nwsstr, struct lonstr,
struct trdstr, struct comstr and struct loststr.  To be fixed.
2008-03-05 22:48:20 +01:00
Ron Koenderink
eb473a6a24 Add missing expansion island
The number of islands was off by one.  The last island was
created, but not actually placed on the map.
2008-01-27 14:20:51 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
Ron Koenderink
3fcee8ddd1 (set_fert): Limit fertility to 100 instead of 120, like the other
resources
2007-11-24 02:08:19 +00:00
404095d2fa Trim system includes. 2007-08-18 17:03:14 +00:00
Ron Koenderink
1d438880ff Real unistd.h declares getopt() & friends. Approximate that in
src/lib/w32/unistd.h by including getopt.h.  Simplify users
2007-08-14 00:15:21 +00:00
6e3da4e1d0 Moving getopt.h to src/lib/w32/ broke the Windows build. Fix. 2007-08-08 05:27:49 +00:00
990eb46b91 (fl_sct_init, write_sects, file_sct_init, main): Do not initialize
sector and realm timestamps to current time.  It's not useful, and it
facilitates attacks against the PRNG.  This backs out fairland.c
rev. 1.27 and files.c rev. 1.31 and partly backs out files.c
rev. 1.38.
2007-07-29 13:40:47 +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
053847beac (file_sct_init, fl_sct_init): Fix parameter type from s_char * to
struct sctstr *.  Callers changed not to cast.
2006-03-26 15:07:32 +00:00
0d0a305bf3 Remove silly superflous parenthesis. 2006-03-26 07:46:49 +00:00
5282f500b5 (datadir, edatadir, gamedir): Rename to avoid confusion with Autoconf
output variable datadir and with configuration data.
2006-02-18 09:16:50 +00:00
68a7ae71b0 (main, usage): New option -v.
(usage): Improve usage message.
2006-01-27 18:00:47 +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
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
c6979cb0e0 (output, translate_continents): When BLITZ is enabled, country numbers
in the newcap script used to be permuted so that start islands are
ordered from top left to bottom right.  Undocumented, unobvious.
Deathtrap if a deity disables BLITZ after running fairland for a real
game.  Remove.
2006-01-05 16:10:39 +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
d343fee727 Remove superflous include. 2005-12-11 10:09:09 +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
8f98e53a23 (file_sct_init, main, fl_sct_init, write_sects): Assign sct_timestamp with the
time the sector was created in files and fairland programs.
2005-11-17 02:20:28 +00:00
380b063f9c Remove some redundant parenthesis; no functional change. 2005-07-23 19:48:35 +00:00
8585ec930f Remove some redundant casts. 2005-06-12 08:17:13 +00:00
4f59fc9967 Remove a bunch of redundant casts. 2005-06-12 06:31:48 +00:00
3c58b1ae83 (program_name, help): New.
(main): New option -h.  Terminate unsuccessfully on invalid option.
(usage, parse_args): Factored usage() out of parse_args().
(parse_args): More useful diagnostics.
2005-05-30 15:15:33 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
29da4b6cf4 (empfile, teldir, motdfil, downfil, disablefil, telfil, annfil)
(banfil, authfil, timestampfil): Make file names relative to DATADIR.
(main): emp_server and files change to the data directory.  fairland
has to write newcap_script to the initial current directory, so it
keeps it and makes file names relative to DATADIR absolute.
(fixup_files): Nothing to do, remove.  This fixes the following bug:
fixup_files() formed file names by appending ep->name instead of the
base name of ep->file to datadir.  Thus, fixup_files() changed file
names even when datadir had the compiled-in value.  When emp_config()
couldn't open econfig, it failed to call fixup_files(), and different
file names got used.  Note that with this revision the file names
revert to the names used before fixup_files() was introduced.  Closes
#1146080.
(print_config): Printing file names as comments is not really useful,
remove.
(otherfiles, ofiles): Unused, remove.
(emp_config, main): Previously, pconfig had to call emp_config() even
when it didn't want to read econfig, just to run fixup_files().  This
is no longer necessary.  Simplify.
2005-03-09 18:44:50 +00:00
1583d0c6a2 (dflt_econfig): New.
(emp_config): Use it when argument is NULL.  This simplifies callers
except pconfig's main(), which now has to suppress reading the default
file.  Also fix callers to check the return value.  Previously, a typo
could easily start a grossly misconfigured program, with potentially
disastrous results.
2005-03-09 17:11:58 +00:00
Ron Koenderink
55e6aca9e0 (wrmakesrc,wripglob,wrgamesdef,info,apro,mobupdate,rea,turn
upda,ef_open,logerror,emp_config,match_user,show_motd,gamedown,
typed_wu,delete_old_announcements,mobility_check,mobility_init,
allocate_memory,write_newcap_script,main,files,fairland,doconfig,)
[_WIN32]: Switchback to default mode of text.
"t" (text) is not included the ISO/ANSI C standard but "b" (binary)
is included.
2005-03-02 12:47:15 +00:00
Ron Koenderink
826c14ef79 (write_file,allocate_memory): Convert to stdio. 2005-03-01 13:50:56 +00:00
Ron Koenderink
c3ac61e1e4 (main,allocate_memory) [_WIN32]: switch the default file mode to
binary to match POSIX.  Remove the now unneccessary ifdef for
the open.
2004-12-29 23:34:08 +00:00
Ron Koenderink
331aac2afa (main) [_WIN32]: remove getpid() from the random seed as
it did not improve the randomness of the seed.
2004-12-29 23:20:24 +00:00
Ron Koenderink
f6666518c7 (main): switch to use standard srandom() and random().
Remove the SRANDOM and RANDOM defines.
2004-12-29 23:15:04 +00:00
Ron Koenderink
750f351a94 (parse_args): fix the print usage for script file name to print the
default instead of the current file name as per the description.
2004-12-29 23:01:43 +00:00
Ron Koenderink
2629b92102 (main) [_WIN32]: enable command line options for WIN32. 2004-12-29 22:52:05 +00:00
Ron Koenderink
f9c5f2f70b (main): Remove the extern for optarg, get from include file. 2004-12-12 22:48:22 +00:00
Marc Olzheim
e9a040adb9 Do not include var.h where no longer needed. Clean up register keywords in these file at the same time. No functional changes. 2004-10-12 20:08:51 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
16761c8c29 (qprint): Change it into a printf()-like function. Simplify callers.
No functional changes.  From Marc Olzheim.
2004-03-23 15:20:17 +00:00
0608bff5b4 (RANDOM, SRANDOM): New, to allow overriding the PRNG on the compiler
command line for reproducible automated tests.  This is expected to be
a temporary solution until we get more capable system configuration.
Callers of random(), srandom() changed.  From Marc Olzheim.
2004-03-23 15:05:20 +00:00
43c511e8ad (rnd_seed, main, parse_args, allocate_memory): New option -R to set
the PRNG seed.  Print the seed.  From Marc Olzheim.
2004-03-23 14:54:48 +00:00
07dd220699 (main, write_newcap_script): Don't warn when resources were added,
that's expected nowadays.  Warn when resources were not added.  Don't
mention the ore program, as it doesn't work and we no longer
distribute it.
2004-03-17 06:53:57 +00:00