]> git.pond.sub.org Git - empserver/log
empserver
16 years ago(player_kill_idle): Don't kill hung player threads. That code was
Markus Armbruster [Wed, 25 Jul 2007 06:10:10 +0000 (06:10 +0000)]
(player_kill_idle): Don't kill hung player threads.  That code was
flawed.  Firstly, when player_kill_idle() ran before the player thread
could react to being aborted by update or shutdown, player_kill_idle()
incorrectly diagnosed it as hung.  Secondly, terminating hung threads
leaks resources and can leave a stale play_lock behind.  It could
perhaps even corrupt game state.  It might salvage some scenarios, but
makes others worse.  Not worth it.

16 years agoRemove the concept of thread priorities from empthread.h. Only LWP
Markus Armbruster [Tue, 24 Jul 2007 05:13:31 +0000 (05:13 +0000)]
Remove the concept of thread priorities from empthread.h.  Only LWP
supports priorities.  Update synchronization used to rely on them,
which naturally worked only with LWP (#1504036).  With that fixed, no
uses of priorities remained, but a minor bug did: players could starve
out threads with priorities below PP_PLAYER, i.e. delete_lostitems()
and player_kill_idle().  Closes #1458175:
(empth_create): Remove parameter prio.  Callers changed.  Also gets
rid of misleading comments in pthread.c and ntthread.c.
(PP_MAIN, PP_UPDATE, PP_SHUTDOWN, PP_SCHED, PP_TIMESTAMP, PP_PLAYER)
(PP_ACCEPT, PP_KILLIDLE): Remove.
(empth_init, empth_create) [EMPTH_LWP]: Pass priority 1.

16 years agoComment.
Markus Armbruster [Tue, 24 Jul 2007 04:10:44 +0000 (04:10 +0000)]
Comment.

16 years ago(dispatch): Set player->command before acquiring play_lock, to make
Markus Armbruster [Sun, 22 Jul 2007 17:23:34 +0000 (17:23 +0000)]
(dispatch): Set player->command before acquiring play_lock, to make
sure the command is reliably aborted on update and shutdown.  Before,
redirection output could block while player->command was still null,
letting players delay the update or shutdown indefinitely.

16 years ago(dispatch): Rwlocks can hand out read locks while a write lock is
Markus Armbruster [Sun, 22 Jul 2007 17:06:00 +0000 (17:06 +0000)]
(dispatch): Rwlocks can hand out read locks while a write lock is
wanted.  Unfair to writers, but possible.  This lets commands run with
!player->aborted, which can then block on input and thus let players
delay the update or shutdown indefinitely.  Avoid by spinning until
the update is done.

16 years ago(set_paths) [_WIN32]: Add a comment to explain the use of _fullpath().
Ron Koenderink [Sat, 21 Jul 2007 00:50:32 +0000 (00:50 +0000)]
(set_paths) [_WIN32]: Add a comment to explain the use of _fullpath().

16 years ago(shutdwn): Failed to set play_wrlock_wanted. This let player threads
Markus Armbruster [Fri, 20 Jul 2007 19:49:42 +0000 (19:49 +0000)]
(shutdwn): Failed to set play_wrlock_wanted.  This let player threads
block on output, which could delay shutdown indefinitely.

16 years ago(update_lock, play_lock, update_pending, play_wrlock_wanted): Move to
Markus Armbruster [Fri, 20 Jul 2007 19:09:34 +0000 (19:09 +0000)]
(update_lock, play_lock, update_pending, play_wrlock_wanted): Move to
main.c and rename to better reflect their purpose.  Fix misleading
comments.

16 years agoLWP failed to wake up threads sleeping in empth_sleep() while other
Markus Armbruster [Fri, 20 Jul 2007 18:12:03 +0000 (18:12 +0000)]
LWP failed to wake up threads sleeping in empth_sleep() while other
threads were runnable.  This let players with a sufficiently fast
connection starve out system threads, including the update.  Fix:
[EMPTH_LWP] (lwpWakeupSleep): External linkage.
[EMPTH_LWP] (lwpReschedule): Call it.

16 years ago(UPDATE_TIME_LEN): New.
Ron Koenderink [Thu, 19 Jul 2007 21:58:05 +0000 (21:58 +0000)]
(UPDATE_TIME_LEN): New.
(update_time): Define with size to make MSVC happy.

16 years ago(main): Fix rev. 1.52.
Markus Armbruster [Thu, 19 Jul 2007 16:39:51 +0000 (16:39 +0000)]
(main): Fix rev. 1.52.

16 years ago(force): Remove unused local variable.
Ron Koenderink [Thu, 19 Jul 2007 01:15:15 +0000 (01:15 +0000)]
(force): Remove unused local variable.

16 years agoNew xdump updates:
Markus Armbruster [Wed, 18 Jul 2007 06:16:33 +0000 (06:16 +0000)]
New xdump updates:
(EF_UPDATES, update_ca): New.
(empfile): Add it.
(update_time): Move to src/lib/global/updtime.c.

16 years ago(update_running): New.
Markus Armbruster [Tue, 17 Jul 2007 06:13:14 +0000 (06:13 +0000)]
(update_running): New.
(update_run): Set it.

Replace incorrect uses of update_pending by update_running, fixing
buggy behavior while the update was trying to gain control:
(sct_do_upd_mob, shp_do_upd_mob, lnd_do_upd_mob, pln_do_upd_mob):
MOB_ACCESS mobility update was skipped.
(telegram_is_new): Fix recognition of new telegrams by timestamp.
(wu): Bulletins got misfiled as production reports.
(shp_nav): Sail path got ignored.
(setrel): Declaration of war failed silently with SLOW_WAR enabled.
Messages got suppressed.
(PR, mpr): Messages got misdirected to bulletins.

16 years ago(util): Add empsched, belatedly.
Markus Armbruster [Mon, 16 Jul 2007 19:39:23 +0000 (19:39 +0000)]
(util): Add empsched, belatedly.

16 years agoFix fallout from misc.h rev. 1.69.
Markus Armbruster [Mon, 16 Jul 2007 19:38:04 +0000 (19:38 +0000)]
Fix fallout from misc.h rev. 1.69.

16 years ago(status): Simplify conditional for the "lost your capital" message.
Markus Armbruster [Sun, 15 Jul 2007 16:15:03 +0000 (16:15 +0000)]
(status): Simplify conditional for the "lost your capital" message.

(player): No uses of member visitor left, remove.

16 years agoNew command show updates:
Markus Armbruster [Sun, 15 Jul 2007 13:34:22 +0000 (13:34 +0000)]
New command show updates:
(show): New sub-command.
(player_coms): Update its c_form.
(show_updates, fmttime2822): New.

(vers): Show game_days and game_hours.

(upda): Mark obsolete and point to show updates.
(vers): Point to show rather than update.

Rewrite much of info zdone.

16 years ago(show): Print tech level later, when we're done prompting for
Markus Armbruster [Sun, 15 Jul 2007 13:22:37 +0000 (13:22 +0000)]
(show): Print tech level later, when we're done prompting for
arguments.  This also prints it only for units, when it's relevant.

16 years agoFix .SA.
Markus Armbruster [Sun, 15 Jul 2007 12:36:35 +0000 (12:36 +0000)]
Fix .SA.

16 years agoUpdate example to current output.
Markus Armbruster [Sun, 15 Jul 2007 12:32:48 +0000 (12:32 +0000)]
Update example to current output.

16 years agoDescribe the effect on the Empire clock.
Markus Armbruster [Sun, 15 Jul 2007 12:05:43 +0000 (12:05 +0000)]
Describe the effect on the Empire clock.

Warn against manual disable/enable and point to the schedule file.

16 years agoDescribe the Empire clock.
Markus Armbruster [Sun, 15 Jul 2007 11:53:32 +0000 (11:53 +0000)]
Describe the Empire clock.

16 years agoUpdate for the new Empire clock, i.e. don't refer to s_p_etu, which no
Markus Armbruster [Sun, 15 Jul 2007 11:38:41 +0000 (11:38 +0000)]
Update for the new Empire clock, i.e. don't refer to s_p_etu, which no
longer exists.

Abbreviate time unit as ETU rather than TU.

max_btus is 640, not 512.

16 years agoRemove references to s_p_etu.
Markus Armbruster [Sun, 15 Jul 2007 11:02:17 +0000 (11:02 +0000)]
Remove references to s_p_etu.

16 years agoInclude reshuffle.
Markus Armbruster [Sun, 15 Jul 2007 10:07:48 +0000 (10:07 +0000)]
Include reshuffle.

16 years ago(s_p_etu): econfig key no longer used, remove.
Markus Armbruster [Sun, 15 Jul 2007 09:59:52 +0000 (09:59 +0000)]
(s_p_etu): econfig key no longer used, remove.

16 years agoUse the new Empire clock for implementing MOB_ACCESS:
Markus Armbruster [Sun, 15 Jul 2007 09:43:57 +0000 (09:43 +0000)]
Use the new Empire clock for implementing MOB_ACCESS:
(lndstr, plnstr, sctstr, shpstr): Change timestamp members lnd_access,
pln_access, sct_access, shp_access from real time (time_t) to ETUs
within a turn (short).
(land_ca, plane_ca, sect_ca, ship_ca): Update accordingly.
(build_ship, build_land, build_bridge, build_plane, build_tower)
(explore, check_trade, bsanct, takeover, takeover_ship)
(takeover_land): Use game_tick_to_now() instead of time() to update
the timestamp.  Change check_trade(), takeover_ship(), takeover_land()
to do that only when MOB_ACCESS is enabled, for consistency.
(lupgr, supgr, pupgr, takeover_ship): Don't touch the timestamp where
mobility isn't touched either.
(sct_do_upd_mob, shp_do_upd_mob, lnd_do_upd_mob, pln_do_upd_mob): Use
game_tick_to_now() instead of increase_mob() to compute ETUs since
the timestamp and update the timestamp.  Closes #1012699.
(increase_mob): Remove.
(mob_sect, mob_ship, mob_land, mob_plane): sct_do_upd_mob() & friends
no longer do the right thing at the update.  Use game_reset_tick() and
pass its result directly to do_mob_sect() & friends.  This is only
correct when argument is etu_per_update, which it always is.  Remove
parameter.  Callers changed.
(do_mob_sect, do_mob_ship, do_mob_land, do_mob_plane): Oops on
negative argument.

(mob_acc_globals, timestampfil, mobupdate, updating_mob)
(update_all_mob, timestamp_fixing, update_timestamps, mobility_check):
The mobupdate command was important to let deities manually
synchronize mobility updating with updates.  That's no longer needed.
The code behind it is somewhat hairy and ugly, and updating it to work
with the Empire clock is just not worth it.  Remove.  Users changed.
(player_coms): Update accordingly.
(upda): Remove display of mobility updating state.

(mobility_init): No need to fix up mobility on startup, as the Empire
clock runs normally even when the server is down.  Remove.  Caller
changed.

16 years ago(game_reset_tick): New.
Markus Armbruster [Sun, 15 Jul 2007 09:01:58 +0000 (09:01 +0000)]
(game_reset_tick): New.
(prod_nat): Use it.

16 years agoUse the new Empire clock for generating BTUs:
Markus Armbruster [Sat, 14 Jul 2007 16:30:12 +0000 (16:30 +0000)]
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.

16 years agoProvide an Empire clock with ETU resolution that is properly
Markus Armbruster [Sat, 14 Jul 2007 15:58:37 +0000 (15:58 +0000)]
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.

16 years agoNew Empire table game, to be used for global stuff:
Markus Armbruster [Sat, 14 Jul 2007 14:49:58 +0000 (14:49 +0000)]
New Empire table game, to be used for global stuff:
(gamestr, EF_GAME, game_ca): New.
(empfile): Declare the table.
(ef_open_srv, ef_close_srv): Open and close it.
(main): Create it.
(empobj_storage): New member game.

(EF_DYNMAX): New.
(EF_IS_GAME_STATE): Use it.

16 years agoRemove the demand update feature veto. It's virtually unused, flawed
Markus Armbruster [Sat, 14 Jul 2007 13:09:33 +0000 (13:09 +0000)]
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'.

16 years ago(do_mob_sect, do_mob_plane): Remove the special case for maxed out
Markus Armbruster [Sat, 14 Jul 2007 09:07:54 +0000 (09:07 +0000)]
(do_mob_sect, do_mob_plane): Remove the special case for maxed out
mobility.  The general case is fine.
(do_mob_ship): Move the special case for maxed out mobility into the
fuel conditional.  The general non-fuel case is fine.
(do_mob_land): Likewise, but continue to call lnd_fortify() only when
needed.

16 years ago(do_mob_land): Simplify fortification. No functional change.
Markus Armbruster [Sat, 14 Jul 2007 08:45:01 +0000 (08:45 +0000)]
(do_mob_land): Simplify fortification.  No functional change.

16 years agoFix missing include.
Markus Armbruster [Fri, 13 Jul 2007 17:15:33 +0000 (17:15 +0000)]
Fix missing include.

16 years agoComment.
Markus Armbruster [Fri, 13 Jul 2007 16:51:31 +0000 (16:51 +0000)]
Comment.

16 years agoNew utility program empsched.
Markus Armbruster [Fri, 13 Jul 2007 16:49:13 +0000 (16:49 +0000)]
New utility program empsched.

16 years agoUpdate for new reload command. Back out a reference to a new utility
Markus Armbruster [Fri, 13 Jul 2007 16:42:10 +0000 (16:42 +0000)]
Update for new reload command.  Back out a reference to a new utility
program that hasn't been committed, yet.

16 years ago(relo): New command.
Markus Armbruster [Fri, 13 Jul 2007 06:04:03 +0000 (06:04 +0000)]
(relo): New command.

16 years agoFix the previous revision.
Markus Armbruster [Thu, 12 Jul 2007 06:10:59 +0000 (06:10 +0000)]
Fix the previous revision.

16 years ago(schedule): New.
Markus Armbruster [Wed, 11 Jul 2007 22:37:31 +0000 (22:37 +0000)]
(schedule): New.
(install): Install a default schedule.

16 years agoDocument the new update scheduler.
Markus Armbruster [Wed, 11 Jul 2007 22:34:21 +0000 (22:34 +0000)]
Document the new update scheduler.

16 years agoNew update scheduler:
Markus Armbruster [Wed, 11 Jul 2007 22:27:29 +0000 (22:27 +0000)]
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.

16 years ago(demand_check): Remove dead code.
Markus Armbruster [Wed, 11 Jul 2007 21:35:47 +0000 (21:35 +0000)]
(demand_check): Remove dead code.

16 years agoFix markup. Reorder so that options appear in alphabetical order.
Markus Armbruster [Wed, 11 Jul 2007 19:59:47 +0000 (19:59 +0000)]
Fix markup.  Reorder so that options appear in alphabetical order.
Document -h and -v for fairland and files.  Supply proper .SA.  Minor
polishing.

16 years agoSome variables were recursively expanded unintentionally. Fix.
Markus Armbruster [Wed, 11 Jul 2007 19:52:24 +0000 (19:52 +0000)]
Some variables were recursively expanded unintentionally.  Fix.

16 years agoInstall all manual pages in section 6, where they belong. Source
Markus Armbruster [Wed, 11 Jul 2007 19:45:28 +0000 (19:45 +0000)]
Install all manual pages in section 6, where they belong.  Source
files renamed.

16 years ago(show_news): Don't show unused elements of rpt[].
Markus Armbruster [Tue, 10 Jul 2007 21:23:29 +0000 (21:23 +0000)]
(show_news): Don't show unused elements of rpt[].

16 years agoUpdate example to current output.
Markus Armbruster [Tue, 10 Jul 2007 21:15:53 +0000 (21:15 +0000)]
Update example to current output.

16 years agoFix indentation.
Markus Armbruster [Tue, 10 Jul 2007 21:03:22 +0000 (21:03 +0000)]
Fix indentation.

16 years agoFix .SA.
Markus Armbruster [Tue, 10 Jul 2007 21:00:49 +0000 (21:00 +0000)]
Fix .SA.

16 years agoClarify. Improve .SA.
Markus Armbruster [Tue, 10 Jul 2007 20:54:15 +0000 (20:54 +0000)]
Clarify.  Improve .SA.

16 years agoFix for N_WELCH_DEAL, N_LND_LOSE, N_BOARD_LAND.
Markus Armbruster [Tue, 10 Jul 2007 20:49:07 +0000 (20:49 +0000)]
Fix for N_WELCH_DEAL, N_LND_LOSE, N_BOARD_LAND.

16 years ago(EMPCFONLYC, EMPCFBOTH): Rename parameter num to flags.
Markus Armbruster [Tue, 10 Jul 2007 18:27:24 +0000 (18:27 +0000)]
(EMPCFONLYC, EMPCFBOTH): Rename parameter num to flags.

16 years ago(natstr): Simplify encoding of member nat_update. Users changed.
Markus Armbruster [Tue, 10 Jul 2007 17:48:57 +0000 (17:48 +0000)]
(natstr): Simplify encoding of member nat_update.  Users changed.
(WUPD_WANT): Unused, remove.

16 years ago(zdon): Simplify. Also gets rid of a compiler warning.
Markus Armbruster [Tue, 10 Jul 2007 17:28:23 +0000 (17:28 +0000)]
(zdon): Simplify.  Also gets rid of a compiler warning.

16 years agoFix the previous revision.
Markus Armbruster [Tue, 10 Jul 2007 16:44:57 +0000 (16:44 +0000)]
Fix the previous revision.

16 years ago(opt_DEMANDUPDATE): Remove. Deities can use update_demandpolicy to
Markus Armbruster [Sun, 8 Jul 2007 15:26:23 +0000 (15:26 +0000)]
(opt_DEMANDUPDATE): Remove.  Deities can use update_demandpolicy to
control demand updates.

16 years ago(prnat): Show nat_missed even when opt_DEMANDUPDATE is off, because
Markus Armbruster [Sun, 8 Jul 2007 11:46:49 +0000 (11:46 +0000)]
(prnat): Show nat_missed even when opt_DEMANDUPDATE is off, because
docountry() lets you edit it even then.

16 years ago(journal_entry): Silence compiler warning in previous revision.
Markus Armbruster [Sun, 27 May 2007 14:00:59 +0000 (14:00 +0000)]
(journal_entry): Silence compiler warning in previous revision.

16 years ago(player): Remove unused member blitz_time.
Markus Armbruster [Sun, 27 May 2007 13:36:14 +0000 (13:36 +0000)]
(player): Remove unused member blitz_time.

16 years ago(show_nuke_build, show_nuke_capab): Fix rounding of research.
Markus Armbruster [Sun, 13 May 2007 14:39:42 +0000 (14:39 +0000)]
(show_nuke_build, show_nuke_capab): Fix rounding of research.
Reported by Doug Wescott.

17 years agoSpelling fixes.
Markus Armbruster [Mon, 9 Apr 2007 09:36:28 +0000 (09:36 +0000)]
Spelling fixes.

17 years ago(powe): Don't tell user to run power new when it is disabled by
Markus Armbruster [Sat, 24 Mar 2007 17:31:36 +0000 (17:31 +0000)]
(powe): Don't tell user to run power new when it is disabled by
AUTO_POWER.

17 years ago(journal_entry): Print unprintable characters in octal instead of a question mark.
Ron Koenderink [Tue, 13 Mar 2007 13:48:11 +0000 (13:48 +0000)]
(journal_entry): Print unprintable characters in octal instead of a question mark.

17 years ago(S_IRUSR, S_IWUSR, S_IEUSR, S_IRWXU,
Ron Koenderink [Sun, 11 Mar 2007 21:29:37 +0000 (21:29 +0000)]
(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.

17 years ago(new): Switch permissions to standard defines instead of magic numbers
Ron Koenderink [Sat, 10 Mar 2007 19:23:44 +0000 (19:23 +0000)]
(new): Switch permissions to standard defines instead of magic numbers
to improve portability.

17 years ago(journal_entry): Add unsigned char cast to isprint() call.
Ron Koenderink [Sat, 10 Mar 2007 18:12:29 +0000 (18:12 +0000)]
(journal_entry): Add unsigned char cast to isprint() call.
(parse): Add unsigned char cast to isspace() call.
Portability bug fix for WIN32.

17 years ago(add, disa, ef_open, logerror, main): Switch permissions to
Ron Koenderink [Sat, 10 Mar 2007 16:29:51 +0000 (16:29 +0000)]
(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.

17 years ago(main): Enable group file permissions.
Ron Koenderink [Mon, 5 Mar 2007 13:31:56 +0000 (13:31 +0000)]
(main): Enable group file permissions.
Makes the group file permissions consist with the rest of the server.

17 years ago(main.c) [_WIN32,WIN32]: Remove the define WIN32.
Ron Koenderink [Mon, 5 Mar 2007 02:43:28 +0000 (02:43 +0000)]
(main.c) [_WIN32,WIN32]: Remove the define WIN32.
Not required for VC8.

17 years ago(init_server): Move log_init() before the mobility_init() so its errors are logged
Ron Koenderink [Mon, 5 Mar 2007 02:40:18 +0000 (02:40 +0000)]
(init_server): Move log_init() before the mobility_init() so its errors are logged
to the server log.

17 years ago(main): Remove the resetting of file permissions.
Ron Koenderink [Mon, 5 Mar 2007 02:03:33 +0000 (02:03 +0000)]
(main): Remove the resetting of file permissions.
This will be prevent some file permissions being changed
unexpectly when running the files command.

17 years ago(logerror): Remove the permissions for others to view the game log file.
Ron Koenderink [Mon, 5 Mar 2007 01:58:54 +0000 (01:58 +0000)]
(logerror): Remove the permissions for others to view the game log file.

17 years ago(logerror): Ensure that logerror() only writes to the log file after log_init()
Ron Koenderink [Sat, 3 Mar 2007 15:23:32 +0000 (15:23 +0000)]
(logerror): Ensure that logerror() only writes to the log file after log_init()
has been called

17 years ago(nuk_on_plane): Ignore destroyed nukes when searching for the nuke that
Ron Koenderink [Sat, 3 Mar 2007 15:12:57 +0000 (15:12 +0000)]
(nuk_on_plane): Ignore destroyed nukes when searching for the nuke that
belongs to a particular plane.

17 years ago(kaboom): Print at least one set of "O O "s.
Ron Koenderink [Sat, 3 Mar 2007 15:09:43 +0000 (15:09 +0000)]
(kaboom): Print at least one set of "O O "s.

17 years ago(empth_create) [_WIN32]: Fix the error return code check for
Ron Koenderink [Sat, 24 Feb 2007 14:05:21 +0000 (14:05 +0000)]
(empth_create) [_WIN32]: Fix the error return code check for
the call to _beginthread() to check for 1L instead of -1.

17 years ago[_WIN32,WIN32]: Remove the define WIN32.
Ron Koenderink [Sat, 24 Feb 2007 13:39:07 +0000 (13:39 +0000)]
[_WIN32,WIN32]: Remove the define WIN32.
Not required for VC8.

17 years ago(accept.c, io.c, nthread.c, tcp_listen.c) [_WIN32,WIN32]:
Ron Koenderink [Fri, 23 Feb 2007 22:51:30 +0000 (22:51 +0000)]
(accept.c, io.c, nthread.c, tcp_listen.c) [_WIN32,WIN32]:
Remove the define WIN32.
Not required for VC8.

17 years ago(add.c, disa.c, log.c, new.c, wantupd.c, wu.c) [_WIN32,__GNUC__]:
Ron Koenderink [Fri, 23 Feb 2007 22:35:50 +0000 (22:35 +0000)]
(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.

17 years ago(shut): Remove unused local variables.
Ron Koenderink [Thu, 22 Feb 2007 21:48:23 +0000 (21:48 +0000)]
(shut): Remove unused local variables.

17 years agoSemaphores are no longer used, remove:
Markus Armbruster [Thu, 8 Feb 2007 12:29:16 +0000 (12:29 +0000)]
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.

17 years agoRewrite how updates are triggered (closes #1504036):
Markus Armbruster [Thu, 8 Feb 2007 11:54:31 +0000 (11:54 +0000)]
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().

17 years agoMake empth_wakeup() and empth_terminate() wake up empth_sleep(), and
Markus Armbruster [Thu, 8 Feb 2007 11:26:43 +0000 (11:26 +0000)]
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.

17 years agoSimplify. Should also be more efficient.
Markus Armbruster [Wed, 31 Jan 2007 20:23:07 +0000 (20:23 +0000)]
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.

17 years agoClean up after removal of wait command:
Markus Armbruster [Wed, 31 Jan 2007 06:08:39 +0000 (06:08 +0000)]
Clean up after removal of wait command:
(player_wakeup_all, player_wakeup): Remove.  Callers changed.
(player): Remove member waiting.

17 years agoRev. 1.16 included time.h to get time_t. Change to sys/types.h.
Markus Armbruster [Sun, 28 Jan 2007 17:22:43 +0000 (17:22 +0000)]
Rev. 1.16 included time.h to get time_t.  Change to sys/types.h.

17 years ago(lwp_rwlock_destroy): Plug memory leak.
Markus Armbruster [Sun, 28 Jan 2007 17:02:46 +0000 (17:02 +0000)]
(lwp_rwlock_destroy): Plug memory leak.

17 years ago(empth_exit, empth_rwlock_destroy): Plug memory leaks.
Markus Armbruster [Sun, 28 Jan 2007 16:59:15 +0000 (16:59 +0000)]
(empth_exit, empth_rwlock_destroy): Plug memory leaks.

17 years ago(lwpSetDesc): Unused, remove.
Markus Armbruster [Sun, 28 Jan 2007 16:40:27 +0000 (16:40 +0000)]
(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.

17 years ago(lwpCreate): Initialize members runtime and fd. Initializing fd is
Markus Armbruster [Sun, 28 Jan 2007 14:34:34 +0000 (14:34 +0000)]
(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.

17 years ago(lwpProc): Change type of member runtime to time_t.
Markus Armbruster [Sun, 28 Jan 2007 14:14:40 +0000 (14:14 +0000)]
(lwpProc): Change type of member runtime to time_t.
(lwpSleepUntil): Change type of parameter to time_t.

17 years ago(LWP_CHECKMARK): Change to int. Should have been done in rev. 1.14.
Markus Armbruster [Sun, 28 Jan 2007 10:17:35 +0000 (10:17 +0000)]
(LWP_CHECKMARK): Change to int.  Should have been done in rev. 1.14.

17 years ago(unit_path): Replace mpr() with pr() as unit_path() is only called
Ron Koenderink [Sat, 27 Jan 2007 02:31:08 +0000 (02:31 +0000)]
(unit_path): Replace mpr() with pr() as unit_path() is only called
from navigate or march command.

17 years ago(unit_view): Replace mpr() with pr() as unit_view() is only called
Ron Koenderink [Sat, 27 Jan 2007 02:20:30 +0000 (02:20 +0000)]
(unit_view): Replace mpr() with pr() as unit_view() is only called
from navigate or march command.

17 years ago(unit_view): New, create by expanding shp_view() to work for
Ron Koenderink [Sat, 27 Jan 2007 02:04:27 +0000 (02:04 +0000)]
(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().

17 years ago(unit_path): New, create by combining shp_path() and lnd_path().
Ron Koenderink [Wed, 24 Jan 2007 23:24:37 +0000 (23:24 +0000)]
(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.

17 years ago(unit_put): New, create by combining shp_put() and lnd_put().
Ron Koenderink [Tue, 23 Jan 2007 23:51:02 +0000 (23:51 +0000)]
(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.