Commit graph

382 commits

Author SHA1 Message Date
7d88a783de (defellipsis): Set ellipsis to 1 instead of field number, because all
uses just compare to 0.  Parameter now unused, remove.  Caller
changed.
2007-08-05 18:42:24 +00:00
bfee6962fc Fix fields checks for split tables:
(caseen): Remove.
(xufldhdr, deffld): Record only fields in this part in caflds[].  This
fixes the check for duplicate fields in parts other than the first.
(cafldspp): New, to record fields in previous parts.
(xundump): Initialize and finalize it.
(xufooter): Update it.  Requires new parameter ca.  Caller changed.
(fldval_must_match): Use it to do the right thing for split arrays.
(chkflds): Adapt for changed caflds[].
(chkflds): The check for missing fields was skipped for all parts of a
split table instead of for all but the final part.
2007-08-05 18:38:37 +00:00
26d45adf8a (xufldhdr): ellipsis wasn't cleared for machine-readable input. This
broke reading machine-readable input after reading a split table
failed before seeing the last part.  Luckily, callers never tried
that.
2007-08-05 18:23:09 +00:00
6e2a666882 (xutail): Remove parameter type. Use cur_type instead. Caller
changed.
2007-08-05 17:36:01 +00:00
b8b231be42 (getobj, setnum): Move override of cur_id from getobj() to setnum().
Remove the now unused parameters of getobj().  Callers changed.
2007-08-05 17:34:24 +00:00
94324f7966 (xuheader1, xufldhdr, xutrailer, xufooter, xundump2, xutail)
(xundump1, xubody): Rename.
2007-08-05 17:25:01 +00:00
8fead20ac4 (xundump1, xundump2): Move call of xutrailer() from xundump1() to its
caller xundump2().  Make xundump1() return number of records read for
that.
2007-08-05 17:19:52 +00:00
5a8aea24f4 (xundump1): Remove parameter type. Use cur_type instead. Caller
changed.
2007-08-05 17:05:22 +00:00
b031e34738 (xuheader1, xutrailer, xundump1): Remove unused parameters. Callers
changed.
2007-08-05 17:03:07 +00:00
971515ccc9 (xundump): Count lines in a saner way: pass line number in and out.
Callers changed.
2007-08-05 16:22:41 +00:00
1999751782 (bmaps_intersect): Simplify. No functional change. 2007-08-03 04:05:04 +00:00
e1926d9ce9 (ef_open): Leaked file descriptor when fcntl() failed. 2007-07-31 05:03:25 +00: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
cc2629d6cf (sctoff): Oops on bad arguments. Recovery by returning -1 seems
dangerous.  Not touching that now.

(sctoff): Use XYOFFSET().  No functional change.
2007-07-28 07:08:45 +00:00
f915f91b47 Update known contributors comment. 2007-07-27 20:16:19 +00:00
d4573ea180 Spelling fix. 2007-07-27 19:13:13 +00:00
78b7f3547c Fix the previous revision. 2007-07-27 17:43:13 +00:00
286dda725e Store update disable flag in the game table to make it visible in
xdump:
(gamestr): New member game_upd_disable.
(game_ca): Update accordingly.
(game_ctrl_update): New.
(disa, enab): Use it.
(updates_disabled): Rewrite and move to game.c
(disablefil): Remove.
2007-07-27 05:58:40 +00:00
e7e8717e86 (parse_time): Fix for arguments describing a time when DST is in
effect.
2007-07-27 04:26:20 +00:00
aa34ef2b7b (game_reset_tick): New.
(prod_nat): Use it.
2007-07-15 09:01:58 +00:00
d3e0597f0e Use the new Empire clock for generating BTUs:
(natstr): New member nat_access.
(cou_ca): New selector access.
(grant_btus, accrued_btus): New.
(prod_nat, init_nat): Use grant_btus().  BTUs are now made at the
update in addition to login, because that lets us get away with a
simple ETU stamp (nat_access).
(nat_cap): Replaced by grant_btus(), remove.
2007-07-14 16:30:12 +00:00
dd2daaaab3 Provide an Empire clock with ETU resolution that is properly
synchronized to updates (the one based on s_p_etu isn't synchronized):
(gamestr): New members game_turn, game_tick, game_rt.
(game_ca): New selectors for them.  Restrict tick and rt to deity for
now.  We'd need xdump update the Empire clock to make them safe for
players.
(game_record_update): New.
(update_main): Call it.
(game_tick_tick, game_tick_to_now, game_step_a_tick): New, not yet
used.
2007-07-14 15:58:37 +00:00
4ba4cd98c6 Remove the demand update feature veto. It's virtually unused, flawed
by design (by voting last players can tactically vote no and thus
build up veto rights), and its implementation is buggy:
(update_missed): Remove.
(zdone): Don't show it.
(demand_check): Remove veto check.
(natstr, cou_ca): Remove member nat_missed and its selector.
(zdone): Don't clear and don't show it.
(update_removewants): Don't increment it.  This was buggy anyway; it
incremented even on non-demand updates.
(prnat): Don't show it, remove key 'U'.
(docountry): Don't change it, deprecate the now useless key 'U'.
2007-07-14 13:09:33 +00:00
71320ed67f New update scheduler:
(schedulefil): New.
(set_dirs, set_paths): Rename.  Initialize schedulfil.
(read_schedule): New.  Can read several updates, which will be used in
later changesets.
(update_time): Change to array.  Will be used in later changesets.
(update_schedule_anchor): New.
(update_init): Initialize it.
(update_get_schedule): New.
(update_init): Call it to initialize update_time[].
(update_sched): Rewrite.
(update_forced, update_wanted): Replace.
(update_reschedule): New.
(main): Call it on SIGHUP to reload the schedule.
(update_trigger, update_force, force, player_coms): Drop force's
capability to schedule updates in the future, because it's not worth
the trouble to implement again.  Deities can simply edit the schedule
file to schedule updates.  Remove update_force() and
update_trigger()'s parameter.
(upda): Update for new scheduler.  Take care to keep output the same
as far as possible, even though it's ugly, to avoid breaking clients.
(update_policy, adj_update, update_times, hourslop, blitz_time):
econfig keys removed.
(update_demand, UPD_DEMAND_NONE, UPD_DEMAND_SCHED, UPD_DEMAND_ASYNC)
(update_demandpolicy, UDP_NORMAL, UDP_TIMES, UDP_NORMAL, UDP_BLITZ)
(UDP_MAX, UDP_DEFAULT, UDDEM_TMCHECK, UDDEM_COMSET, UDDEM_DISABLE)
(UDDEM_MAX, UDDEM_DEFAULT): econfig key and values replaced.  Users
changed.  wantupd.h is now empty, remove.
(demand_check): External linkage.
(update_policy_check): Now pointless, remove.
(is_daytime_near, min_to_next_daytime, regular_update_time)
(scheduled_update_time, next_scheduled_time, updatetime)
(next_update_time, next_update_check_time): Unused, Remove.

(demand_check, demandupdatecheck): Move call of demand_update_time()
from demand_check(), which controls all demand updates, to
demandupdatecheck(), which controls only unscheduled ones.  Fixes
update command not to lie about the next scheduled demand update.

(demandupdatecheck): Check updates_disabled() so that zdone no longer
claims to trigger an update when it can't.
2007-07-11 22:27:29 +00:00
15f8f48353 (demand_check): Remove dead code. 2007-07-11 21:35:47 +00:00
1fa61af843 (natstr): Simplify encoding of member nat_update. Users changed.
(WUPD_WANT): Unused, remove.
2007-07-10 17:48:57 +00:00
6ca5e47f69 (opt_DEMANDUPDATE): Remove. Deities can use update_demandpolicy to
control demand updates.
2007-07-08 15:26:23 +00:00
1fb03c5662 (journal_entry): Silence compiler warning in previous revision. 2007-05-27 14:00:59 +00:00
Ron Koenderink
2cdfec6a3a (journal_entry): Print unprintable characters in octal instead of a question mark. 2007-03-13 13:48:11 +00:00
Ron Koenderink
856dcb7c5c (journal_entry): Add unsigned char cast to isprint() call.
(parse): Add unsigned char cast to isspace() call.
Portability bug fix for WIN32.
2007-03-10 18:12:29 +00:00
Ron Koenderink
c97d79c0ee (add, disa, ef_open, logerror, main): Switch permissions to
standard defines instead of magic numbers to improve portability.
Also define WIN32 equivalents to the standard defines.
2007-03-10 16:29:51 +00:00
Ron Koenderink
d4759f0dbb (logerror): Remove the permissions for others to view the game log file. 2007-03-05 01:58:54 +00:00
Ron Koenderink
3afb3925a2 (logerror): Ensure that logerror() only writes to the log file after log_init()
has been called
2007-03-03 15:23:32 +00:00
Ron Koenderink
7356da4775 (add.c, disa.c, log.c, new.c, wantupd.c, wu.c) [_WIN32,__GNUC__]:
Remove the !defined(__GNUC__) for <io.h>.
Not required for VC8.
2007-02-23 22:35:50 +00:00
befac7cf83 Fix server not to create a journal on SIGHUP when !keep_journal:
(journal_reopen): New.
(main): Use it.  Fixes failure to obey !keep_journal.
(journal_open): Internal linkage, changed semantics and return value.
Callers changed.
(journal_close): One caller left, inline and remove.
2007-01-21 17:34:22 +00:00
d38fcc6cf4 (exit_nomem): New.
(update_init): New.
(start_server): Call it.
(start_server, update_sched): Move initialization stuff to it, with
error checking added.
(update_sched): Internal linkage.
2007-01-16 19:26:31 +00:00
7db3523f62 Update known contributors comment. 2007-01-13 10:16:43 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
aafb4fdf8a (setstr): Fix type error in variadic argument. 2006-12-31 17:21:11 +00:00
Ron Koenderink
ce63991c9f (ef_open) [_WIN32]: Fix to get a read lock instead of a write lock for
EFF_RDONLY and to get a write lock instead of a total file lock for
file opened for writing.
2006-11-29 12:16:43 +00:00
Ron Koenderink
ebf588b713 (empobj_chr): New, create a new (imcomplete) structure for
empobj characteristics.
(get_empobj_chr):  Update get_empobj_chr() to use new
struct empobj_chr.
2006-08-18 23:32:45 +00:00
7e474afa32 (obj_nameof): Return safer error value.
(get_empobjp, get_empobj_chr, emp_obj_chr_name, get_empobj_mob_max):
Style.
2006-08-13 07:18:11 +00:00
Ron Koenderink
2742a2db62 (ef_open) [_WIN32]: Add shared.h for MinGW environment,
needed for WIN32 file locking. Broken (missed) in rev 1.70.
2006-08-08 22:43:18 +00:00
Ron Koenderink
a89e21037e (ef_open) [_WIN32]: Provide file locking for WIN32. 2006-08-07 17:15:04 +00:00
Ron Koenderink
74b263f3d8 (unit_map): Replace player->owner with direct owner check and
player->god check.  player->owner is not set if ef_ptr() is used
as no post_read() is done. Broken in rev 1.38.  Not completely fixed
in rev 1.40.
2006-08-02 18:39:22 +00:00
de124108de (ef_open): Lock the file. This prevents two programs (servers in
particular) running on the same game state.  fairland does not use
ef_open() at this time, and thus ignores the lock.
2006-08-02 18:05:04 +00:00
Ron Koenderink
55107731cc (unit_map): Replace player->owner with direct owner check.
player->owner if not set if ef_ptr() is used as no post_read() is done.
Broken in rev 1.38.
2006-07-30 01:05:17 +00:00
Ron Koenderink
28eb5d28fa (draw_map): Use struct empobj to generalize the code. 2006-07-27 23:32:55 +00:00
Ron Koenderink
22e529a93d (get_empobj_chr, obj_nameof): Switch CANT_HAPPEN() to
CANT_REACH().

(get_empobj_mob_max): Remove carriage return.
2006-07-26 01:09:11 +00:00
Ron Koenderink
5f6e5ef4b1 (get_empobj_mob_max): Move the return -1 to the end of function. 2006-07-26 01:01:14 +00:00