Rewrite accounting of play time

Replace daychange() and gettimeleft() by update_timeused_login(),
update_timeused() and enforce_minimum_session_time().  The new
code doesn't assume the day is always 24 hours long which can
occur when transitioning into or out of DST and such.  Logging
in after more a multiple of 128 days now resets nat_timeused
properly.

Fix nat_timeused calculation on midnight rollover to include
the time since midnight.

struct natstr member nat_dayno and struct player member timeleft
are now unused, remove them.
This commit is contained in:
Ron Koenderink 2008-11-15 13:08:19 -06:00
parent f46dc55254
commit 875a80d14f
8 changed files with 69 additions and 74 deletions

View file

@ -563,7 +563,6 @@ struct castr cou_ca[] = {
EF_BAD, NSC_DEITY | NSC_EXTRA},
{"yorg", fldoff(nat_yorg), NSC_YCOORD, 0, NULL,
EF_BAD, NSC_DEITY | NSC_EXTRA},
{"dayno", fldoff(nat_dayno), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"update", fldoff(nat_update), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"tgms", fldoff(nat_tgms), NSC_USHORT, 0, NULL, EF_BAD, 0},
{"ann", fldoff(nat_ann), NSC_USHORT, 0, NULL, EF_BAD, 0},