Commit graph

2462 commits

Author SHA1 Message Date
d4573ea180 Spelling fix. 2007-07-27 19:13:13 +00:00
83acae02be Update AUTHORS. 2007-07-27 19:12:32 +00:00
1be2d7be4c Comment. 2007-07-27 19:10:39 +00:00
0eeed1c920 (main): Initialize game_turn to one instead of zero. 2007-07-27 18:23:03 +00:00
c329f882a2 (VIS, SANCT, NORM, GOD, CAP, MONEY): Move from nat.h to player.h.
(PS_LOGIN): Unused, remove.
2007-07-27 17:50:09 +00:00
78b7f3547c Fix the previous revision. 2007-07-27 17:43:13 +00:00
3935444408 updates_disabled() moved to game.h, include it. 2007-07-27 17:29:55 +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
Ron Koenderink
812eab5427 Fix the previous revision. 2007-07-26 02:00:49 +00:00
Ron Koenderink
ce6a691126 (fmttime2822): Changed return type for strftime() to size_t.
(fmttime2822) [_WIN32]: %T is not support option for strftime in WIN32
replaced with %H:%M:%S.  Replaced %z in with +/-???? format for WIN32
as the default for WIN32 is the text description for timezone.
2007-07-26 01:59:32 +00:00
f691a07814 Fix the previous revision. 2007-07-25 19:35:09 +00:00
043015e829 (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.
2007-07-25 06:10:10 +00:00
d500a7071c 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.
2007-07-24 05:13:31 +00:00
7536a38e95 Comment. 2007-07-24 04:10:44 +00:00
8fa3ba1b60 (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.
2007-07-22 17:23:34 +00:00
f850968883 (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.
2007-07-22 17:06:00 +00:00
Ron Koenderink
bca365c485 (set_paths) [_WIN32]: Add a comment to explain the use of _fullpath(). 2007-07-21 00:50:32 +00:00
be8e1d068e (shutdwn): Failed to set play_wrlock_wanted. This let player threads
block on output, which could delay shutdown indefinitely.
2007-07-20 19:49:42 +00:00
a9afd1efef (update_lock, play_lock, update_pending, play_wrlock_wanted): Move to
main.c and rename to better reflect their purpose.  Fix misleading
comments.
2007-07-20 19:09:34 +00:00
d4150cc2ee 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.
2007-07-20 18:12:03 +00:00
Ron Koenderink
228a545ff3 (UPDATE_TIME_LEN): New.
(update_time): Define with size to make MSVC happy.
2007-07-19 21:58:05 +00:00
032f14cf7a (main): Fix rev. 1.52. 2007-07-19 16:39:51 +00:00
Ron Koenderink
4926fbfdac (force): Remove unused local variable. 2007-07-19 01:15:15 +00:00
7dd8b8a305 New xdump updates:
(EF_UPDATES, update_ca): New.
(empfile): Add it.
(update_time): Move to src/lib/global/updtime.c.
2007-07-18 06:16:33 +00:00
e9cfbdc241 (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.
2007-07-17 06:13:14 +00:00
c1a0a42024 (util): Add empsched, belatedly. 2007-07-16 19:39:23 +00:00
448918ba7d Fix fallout from misc.h rev. 1.69. 2007-07-16 19:38:04 +00:00
6f1cc795f1 (status): Simplify conditional for the "lost your capital" message.
(player): No uses of member visitor left, remove.
2007-07-15 16:15:03 +00:00
a57645340c 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.
2007-07-15 13:34:22 +00:00
87eeea32c9 (show): Print tech level later, when we're done prompting for
arguments.  This also prints it only for units, when it's relevant.
2007-07-15 13:22:37 +00:00
30217b1b87 Fix .SA. 2007-07-15 12:36:35 +00:00
38992e43b5 Update example to current output. 2007-07-15 12:32:48 +00:00
159cd471b8 Describe the effect on the Empire clock.
Warn against manual disable/enable and point to the schedule file.
2007-07-15 12:05:43 +00:00
c4812b0ea2 Describe the Empire clock. 2007-07-15 11:53:32 +00:00
f427e3d123 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.
2007-07-15 11:38:41 +00:00
315770cae5 Remove references to s_p_etu. 2007-07-15 11:02:17 +00:00
335d9d34ab Include reshuffle. 2007-07-15 10:07:48 +00:00
ab55ea7381 (s_p_etu): econfig key no longer used, remove. 2007-07-15 09:59:52 +00:00
4bd19812af 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.
2007-07-15 09:43:57 +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
654335c621 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.
2007-07-14 14:49:58 +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
ec98ff03f3 (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.
2007-07-14 09:07:54 +00:00
0e6508c556 (do_mob_land): Simplify fortification. No functional change. 2007-07-14 08:45:01 +00:00
78008c69fa Fix missing include. 2007-07-13 17:15:33 +00:00
e04193eabd Comment. 2007-07-13 16:51:31 +00:00
eeb9d3cb04 New utility program empsched. 2007-07-13 16:49:13 +00:00