Commit graph

2686 commits

Author SHA1 Message Date
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
ee46f55e6e (lwpCreate): Initialize members runtime and fd. Initializing fd is
necessary to make lwpWakeupFd() work reliably.  Initializing runtime
isn't strictly necessary, as it is used only while the thread is on
LwpDelayq, and putting it there sets runtime.
2007-01-28 14:34:34 +00:00
e501656b4a (lwpProc): Change type of member runtime to time_t.
(lwpSleepUntil): Change type of parameter to time_t.
2007-01-28 14:14:40 +00:00
8e6300b620 (LWP_CHECKMARK): Change to int. Should have been done in rev. 1.14. 2007-01-28 10:17:35 +00:00
Ron Koenderink
fb49865a42 (unit_path): Replace mpr() with pr() as unit_path() is only called
from navigate or march command.
2007-01-27 02:31:08 +00:00
Ron Koenderink
2b79442a82 (unit_view): Replace mpr() with pr() as unit_view() is only called
from navigate or march command.
2007-01-27 02:20:30 +00:00
Ron Koenderink
7434da679e (unit_view): New, create by expanding shp_view() to work for
land_unit as well.
(do_unit_move): Add view option for land units using unit_view().
Combine ship and land viewing using the unit_view().
(shp_view): Remove, not used any more, replaced by unit_view().
2007-01-27 02:04:27 +00:00
Ron Koenderink
aee2bc78e2 (unit_path): New, create by combining shp_path() and lnd_path().
(do_unit_move): Replace shp_path() and lnd_path() with unit_path().
(shp_path, lnd_path): Remove shp_path() and lnd_path(),
not used any more.
2007-01-24 23:24:37 +00:00
Ron Koenderink
d94d269769 (unit_put): New, create by combining shp_put() and lnd_put().
(sail_nav_fleet, shp_nav_one_sector): Replace shp_put() with unit_put().
(lnd_mar_one_sector, att_fight, move_in_land): Replace lnd_put() with unit_put().
(shp_put, lnd_put): Remove.
2007-01-23 23:51:02 +00:00
Ron Koenderink
038cc74d4e (unit_list): New, create by combining shp_list() and lnd_list().
(do_unit_move): Replace call to shp_list() and lnd_list() with unit_list().
(shp_list, lnd_list): Remove, not needed, replaced by unit_list().
2007-01-23 01:41:37 +00:00
Ron Koenderink
99e30073f2 (do_unit_move): Rename unit_list parameter to ulist
to prevent a future conflict with unit_list().
2007-01-21 23:11:59 +00:00
d62355e76d (ef_open_srv, start_server): Journal must not be written before
empth_init(), because writing calls empth_self().  Move call of
journal_startup().
(ef_close_srv, finish_server, panic): Move call of journal_shutdown()
for symmetry.
2007-01-21 17:58:01 +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
Ron Koenderink
139086fd20 (do_unit_move): Combine the two length checks and type check for
printing the ship path into one if statement.  No functional changes.
2007-01-21 12:28:40 +00:00
aaaf5bdc82 (PS_KILL): Nobody can observe this state, as player is deleted right
after entering it.  Remove.
(player_kill_idle, player_login): Simplify.
2007-01-21 12:16:54 +00:00
d8fbfda100 (shutdwn): Take exclusive update lock for shutdown. This makes the
shutdown block until all aborted commands terminated and gave up their
lock.  Remove the cheesy one second wait for commands to finish.  This
also locks out further commands to execute during shutdown.  However,
it also makes it impossible to kill hung player threads here.  Rely on
player_kill_idle() for that.  That doesn't quite work right now,
because it leaves a stale shared lock behind, which blocks shutdown.
2007-01-21 12:04:16 +00:00
Ron Koenderink
e8f74e0f7e (do_look): Make public.
(do_unit_move): Switch look() and llook() to use
do_look() instead.
2007-01-21 11:48:14 +00:00
Ron Koenderink
b0a9e3579f (do_unit_move): Change unit type to be determined at the
beginning of function instead using the leader.  The leader
becomes unknown when stopping or unit list becomes
empty.  This broke printing the path for ships.  Broken
in rev 1.43.
2007-01-21 11:39:52 +00:00
Ron Koenderink
4693fb6076 (do_mob_ship): Combine to two duplicate blocks of code. 2007-01-21 11:38:04 +00:00
Ron Koenderink
d296fc18b8 (do_look): New, created by combining by look() and llook().
(look, llook): Use the do_look() and remove the unneeded code.
2007-01-21 11:34:21 +00:00
32fcbee3bd Update known contributors comment. 2007-01-20 21:02:08 +00:00
84cfd670ce Abstract from shutdown initiation mechanism:
(shutdown_initiate): New.
(shut): Use it.  Shutdown in zero minutes no longer cancels the
shutdown, it just works.  Use negative argument to cancel.  Logging is
less detailed.
(shutdown_sequence): Internal linkage.

(pr_wall): All callers prefix text it with the same header.  Move it
into the function.
2007-01-20 20:40:52 +00:00
516f42e063 (player_coms): Fix shutdown's c_form: first argument is not optional. 2007-01-20 20:19:16 +00:00