Start the Empire clock on first break or update
Before, the Empire clock started at the epoch, which effectively made it not tick before the first update.
This commit is contained in:
parent
dc8a7fe3ef
commit
bb7c8665e4
3 changed files with 22 additions and 3 deletions
|
@ -57,6 +57,7 @@ struct gamestr {
|
||||||
|
|
||||||
extern void game_ctrl_update(int);
|
extern void game_ctrl_update(int);
|
||||||
extern int updates_disabled(void);
|
extern int updates_disabled(void);
|
||||||
|
extern void game_note_bsanct(void);
|
||||||
extern void game_record_update(time_t);
|
extern void game_record_update(time_t);
|
||||||
extern struct gamestr *game_tick_tick(void);
|
extern struct gamestr *game_tick_tick(void);
|
||||||
extern int game_tick_to_now(short *);
|
extern int game_tick_to_now(short *);
|
||||||
|
|
|
@ -71,8 +71,24 @@ updates_disabled(void)
|
||||||
return getgamep()->game_upd_disable;
|
return getgamep()->game_upd_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Notice that a player broke sanctuary.
|
||||||
|
* This starts the Empire clock if it hasn't been started yet.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
game_note_bsanct(void)
|
||||||
|
{
|
||||||
|
struct gamestr *game = getgamep();
|
||||||
|
|
||||||
|
if (game->game_rt == 0) {
|
||||||
|
game->game_rt = time(NULL);
|
||||||
|
putgame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Record an update in the game file, the current time is NOW.
|
* Record an update in the game file, the current time is NOW.
|
||||||
|
* This starts the Empire clock if it hasn't been started yet.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
game_record_update(time_t now)
|
game_record_update(time_t now)
|
||||||
|
@ -94,8 +110,8 @@ secs_per_etu(struct gamestr *game)
|
||||||
{
|
{
|
||||||
double secs;
|
double secs;
|
||||||
|
|
||||||
if (!update_time[0])
|
if (!game->game_rt || !update_time[0])
|
||||||
return HUGE_VAL; /* no update scheduled */
|
return HUGE_VAL; /* not started or no update scheduled */
|
||||||
|
|
||||||
secs = update_time[0] - game->game_rt;
|
secs = update_time[0] - game->game_rt;
|
||||||
if (secs < 0)
|
if (secs < 0)
|
||||||
|
|
|
@ -69,6 +69,8 @@ bsanct(void)
|
||||||
(void)putsect(&s);
|
(void)putsect(&s);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (count > 0)
|
if (count > 0) {
|
||||||
|
game_note_bsanct();
|
||||||
nreport(player->cnum, N_BROKE_SANCT, 0, 1);
|
nreport(player->cnum, N_BROKE_SANCT, 0, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue