Commit graph

2408 commits

Author SHA1 Message Date
94e0fe46bf Document the new update scheduler. 2007-07-11 22:34:21 +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
b8a1833438 Fix markup. Reorder so that options appear in alphabetical order.
Document -h and -v for fairland and files.  Supply proper .SA.  Minor
polishing.
2007-07-11 19:59:47 +00:00
8da8e3fb3a Some variables were recursively expanded unintentionally. Fix. 2007-07-11 19:52:24 +00:00
530deef2fe Install all manual pages in section 6, where they belong. Source
files renamed.
2007-07-11 19:45:28 +00:00
de19a17aaf (show_news): Don't show unused elements of rpt[]. 2007-07-10 21:23:29 +00:00
097692a373 Update example to current output. 2007-07-10 21:15:53 +00:00
20f3d0ef0e Fix indentation. 2007-07-10 21:03:22 +00:00
8ad279e84c Fix .SA. 2007-07-10 21:00:49 +00:00
2de92d99d8 Clarify. Improve .SA. 2007-07-10 20:54:15 +00:00
fea01b7dd8 Fix for N_WELCH_DEAL, N_LND_LOSE, N_BOARD_LAND. 2007-07-10 20:49:07 +00:00
ba1c7e3267 (EMPCFONLYC, EMPCFBOTH): Rename parameter num to flags. 2007-07-10 18:27:24 +00:00
1fa61af843 (natstr): Simplify encoding of member nat_update. Users changed.
(WUPD_WANT): Unused, remove.
2007-07-10 17:48:57 +00:00
bd16520e7c (zdon): Simplify. Also gets rid of a compiler warning. 2007-07-10 17:28:23 +00:00
32f20dc511 Fix the previous revision. 2007-07-10 16:44:57 +00:00
6ca5e47f69 (opt_DEMANDUPDATE): Remove. Deities can use update_demandpolicy to
control demand updates.
2007-07-08 15:26:23 +00:00
d0e2834ca9 (prnat): Show nat_missed even when opt_DEMANDUPDATE is off, because
docountry() lets you edit it even then.
2007-07-08 11:46:49 +00:00
1fb03c5662 (journal_entry): Silence compiler warning in previous revision. 2007-05-27 14:00:59 +00:00
b9324da31d (player): Remove unused member blitz_time. 2007-05-27 13:36:14 +00:00
1cfeeb6e0c (show_nuke_build, show_nuke_capab): Fix rounding of research.
Reported by Doug Wescott.
2007-05-13 14:39:42 +00:00
06f61d1a4e Spelling fixes. 2007-04-09 09:36:28 +00:00
2e3ca36369 (powe): Don't tell user to run power new when it is disabled by
AUTO_POWER.
2007-03-24 17:31:36 +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
568ef6048d (S_IRUSR, S_IWUSR, S_IEUSR, S_IRWXU,
S_IRGRP, S_IWGRP, S_IEGRP, S_IRWXG,
S_IROTH, S_IWOTH, S_IEOTH, S_IRWXO) [_WIN32]:
Add #ifndef for standard defines as the the MinGW environment has the
user defines already created.  Correct EXEC permision to use S_IEXEC.
Set the group and other permssions to 0 as they do not exist in WIN32.
2007-03-11 21:29:37 +00:00
Ron Koenderink
e60f653d2d (new): Switch permissions to standard defines instead of magic numbers
to improve portability.
2007-03-10 19:23:44 +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
32d62797d2 (main): Enable group file permissions.
Makes the group file permissions consist with the rest of the server.
2007-03-05 13:31:56 +00:00
Ron Koenderink
d640c8cc4e (main.c) [_WIN32,WIN32]: Remove the define WIN32.
Not required for VC8.
2007-03-05 02:43:28 +00:00
Ron Koenderink
c2d0528178 (init_server): Move log_init() before the mobility_init() so its errors are logged
to the server log.
2007-03-05 02:40:18 +00:00
Ron Koenderink
ead51d369e (main): Remove the resetting of file permissions.
This will be prevent some file permissions being changed
unexpectly when running the files command.
2007-03-05 02:03:33 +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
8babf97d81 (nuk_on_plane): Ignore destroyed nukes when searching for the nuke that
belongs to a particular plane.
2007-03-03 15:12:57 +00:00
Ron Koenderink
2437a7a551 (kaboom): Print at least one set of "O O "s. 2007-03-03 15:09:43 +00:00
Ron Koenderink
e19229ad98 (empth_create) [_WIN32]: Fix the error return code check for
the call to _beginthread() to check for 1L instead of -1.
2007-02-24 14:05:21 +00:00
Ron Koenderink
91504142c3 [_WIN32,WIN32]: Remove the define WIN32.
Not required for VC8.
2007-02-24 13:39:07 +00:00
Ron Koenderink
0978c0c4fc (accept.c, io.c, nthread.c, tcp_listen.c) [_WIN32,WIN32]:
Remove the define WIN32.
Not required for VC8.
2007-02-23 22:51:30 +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
Ron Koenderink
d7780fdcda (shut): Remove unused local variables. 2007-02-22 21:48:23 +00:00
c69cf0d1fd Semaphores are no longer used, remove:
(empth_sem_t, empth_sem_create, empth_sem_signal, empth_sem_wait):
Remove.
[EMPTH_LWP] (lwpSem, lwpCreateSem, lwpSignal, lwpWait): Remove.
[EMPTH_W32] (loc_sem): Remove.
2007-02-08 12:29:16 +00:00
c1eb1bd5d2 Rewrite how updates are triggered (closes #1504036):
(update_init, update_sched, update_run, update_wait): Don't create a
separate UpdateSched thread, run update_sched() in the Update thread.
Run the update by calling update_run() instead of by signalling its
thread.  update_run() replaces update_wait(); it just runs the update
and returns instead of waiting for the signal to update in a loop.
Move initialization of the Update thread's *player to its new thread
entry point.
(update_sem, update_init): Remove update_sem.
(update_thread): New.
(update_init): Initialize it.
(update_forced): New.
(update_trigger, update_force): Wake up update_thread with
update_force set.
(update_sched): Reset it before sleep, test it after sleep so that
schedule checking is only done for scheduled updates, not forced
updates.

(update_sched, update_init): Move sanity test of s_p_etu to
update_init().
2007-02-08 11:54:31 +00:00
cea39829af Make empth_wakeup() and empth_terminate() wake up empth_sleep(), and
empth_sleep() return whether that happened:
[EMPTH_LWP] (lwpWakeupSleep): New, factored out of lwpSelect().
[EMPTH_LWP] (lwpSelect): Use it.
[EMPTH_LWP] (lwpWakeup): New.  Call lwpWakeupFd() if sleeping in
lwpSleepFd(), lwpWakeupSleep() if sleeping in lwpSleepUntil().
[EMPTH_LWP] (lwpTerminate, empth_wakeup): Use it rather than
lwpWakeupFd().
[EMPTH_LWP] (lwpWakeupFd): Internal linkage.
[EMPTH_LWP] (lwpSleepUntil): Reset member runtime, so that lwpWakeup()
can test it reliably.  Return how sleep woke up.
[EMPTH_LWP] (empth_sleep): Return value of lwpSleepUntil().
[EMPTH_POSIX] (EMPTH_INTR): New.
[EMPTH_POSIX] (empth_wakeup): Set state to it.
[EMPTH_POSIX] (empth_restorectx): Clear state.
[EMPTH_POSIX] (empth_sleep): Don't re-seleep when state is not clear,
i.e. thread was woken up prematurely.  Return how sleep woke up.
[EMPTH_W32] (empth_sleep): Implement by waiting on hThreadEvent with a
timeout rather than a straight Sleep().  Return how sleep woke up.
2007-02-08 11:26:43 +00:00
fe2de3d743 Simplify. Should also be more efficient.
(LwpSigCheck): New.
(lwpCatchAwaitedSig): Set it.
(lwpSigWait): Clear it.
(lwpSigWakeup): Test it.
(lwpSigWakeup): Unblock LwpSigWaiter without testing LwpSigCatched.
(lwpSigWait): Test LwpSigCatched after wakeup.
(LwpSigAwaited, LwpSigPtr): Remove.
2007-01-31 20:23:07 +00:00
3788676530 Clean up after removal of wait command:
(player_wakeup_all, player_wakeup): Remove.  Callers changed.
(player): Remove member waiting.
2007-01-31 06:08:39 +00:00
fcef921437 Rev. 1.16 included time.h to get time_t. Change to sys/types.h. 2007-01-28 17:22:43 +00:00
3340fdf7f5 (lwp_rwlock_destroy): Plug memory leak. 2007-01-28 17:02:46 +00:00
3db0e2eb15 (empth_exit, empth_rwlock_destroy): Plug memory leaks. 2007-01-28 16:59:15 +00:00
d0ab92b944 (lwpSetDesc): Unused, remove.
[EMPTH_LWP] (lwpProc): Remove member desc.
[EMPTH_LWP] (lwpCreate, lwpDestroy): Don't initialize / finalize it.

[EMPTH_POSIX] (empth_t): Remove member desc.
[EMPTH_POSIX] (empth_init, empth_create): Don't initialize it.

[EMPTH_W32] (loc_Thread): Remove member szDesc.
[EMPTH_W32] (empth_init, empth_create): Don't initialize it.

(empth_create, lwpCreate): Remove parameter desc.  Callers changed.
2007-01-28 16:40:27 +00:00