diff --git a/include/game.h b/include/game.h index f441ccd7..5d6bec91 100644 --- a/include/game.h +++ b/include/game.h @@ -44,6 +44,7 @@ struct gamestr { time_t game_timestamp; /* end of part matching struct empobj */ char game_upd_disable; /* updates disabled? */ + char game_down; /* playing disabled? */ /* * The Empire clock. * Access it through game_tick_tick(), or else it'll be late. @@ -58,6 +59,8 @@ struct gamestr { extern void game_ctrl_update(int); extern int updates_disabled(void); +extern void game_ctrl_play(int); +extern int game_play_disabled(void); extern void game_note_bsanct(void); extern void game_record_update(time_t); extern struct gamestr *game_tick_tick(void); diff --git a/src/lib/commands/turn.c b/src/lib/commands/turn.c index 8f78626b..64a32298 100644 --- a/src/lib/commands/turn.c +++ b/src/lib/commands/turn.c @@ -35,6 +35,7 @@ #include #include +#include "game.h" #include "tel.h" #include "commands.h" #include "optlist.h" @@ -64,6 +65,7 @@ turn(void) logerror("Could not remove no-login file (%s).\n", downfil); return RET_FAIL; } + game_ctrl_play(1); return RET_OK; } else { msgfilepath = motdfil; @@ -122,5 +124,6 @@ turn(void) pr("\n"); + game_ctrl_play(0); return RET_OK; } diff --git a/src/lib/common/game.c b/src/lib/common/game.c index 29624624..74634a2c 100644 --- a/src/lib/common/game.c +++ b/src/lib/common/game.c @@ -51,7 +51,7 @@ #include "server.h" /* - * Disable updates + * Enable / disable updates */ void game_ctrl_update(int enable) @@ -71,6 +71,27 @@ updates_disabled(void) return getgamep()->game_upd_disable; } +/* + * Enable / disable play + */ +void +game_ctrl_play(int enable) +{ + struct gamestr *game = getgamep(); + + game->game_down = !enable; + putgame(); +} + +/* + * Is playing enabled? + */ +int +game_play_disabled(void) +{ + return getgamep()->game_down; +} + /* * Notice that a player broke sanctuary. * This starts the Empire clock if it hasn't been started yet. diff --git a/src/lib/common/nsc.c b/src/lib/common/nsc.c index b14e6284..8a3dadb8 100644 --- a/src/lib/common/nsc.c +++ b/src/lib/common/nsc.c @@ -619,6 +619,7 @@ struct castr game_ca[] = { EF_BAD, NSC_EXTRA}, {"upd_disable", fldoff(game_upd_disable), NSC_CHAR, 0, NULL, EF_BAD, 0}, + {"down", fldoff(game_down), NSC_CHAR, 0, NULL, EF_BAD, 0}, {"turn", fldoff(game_turn), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"tick", fldoff(game_tick), NSC_SHORT, 0, NULL, EF_BAD, NSC_DEITY}, {"rt", fldoff(game_rt), NSC_TIME, 0, NULL, EF_BAD, NSC_DEITY}, diff --git a/src/lib/player/empdis.c b/src/lib/player/empdis.c index 0ae85156..adf589dc 100644 --- a/src/lib/player/empdis.c +++ b/src/lib/player/empdis.c @@ -40,6 +40,7 @@ #include "com.h" #include "empio.h" #include "file.h" +#include "game.h" #include "match.h" #include "misc.h" #include "nat.h" @@ -187,8 +188,13 @@ gamedown(int suppress_deity_message) struct telstr tgm; char buf[MAXTELSIZE + 1]; /* UTF-8 */ - if ((down_fp = fopen(downfil, "rb")) == NULL) + if (!game_play_disabled()) return 0; + + if ((down_fp = fopen(downfil, "rb")) == NULL) { + logerror("Could not open downfil.\n"); + return 1; + } if (fread(&tgm, sizeof(tgm), 1, down_fp) != 1) { logerror("bad header on login message (downfil)"); fclose(down_fp);