]> git.pond.sub.org Git - empserver/blobdiff - src/lib/player/empdis.c
Avoid repeated hours and game down status notifications
[empserver] / src / lib / player / empdis.c
index 685fc7a5ada6f10e1823a73bf8b72cf796419370..b2bdff77c949c893db19e44f60ed727c56a1576b 100644 (file)
@@ -177,24 +177,6 @@ disable_coms(void)
     free(tmp);
 }
 
-/*
- * returns true if down
- */
-static int
-gamedown(int suppress_deity_message)
-{
-    if (!game_play_disabled())
-       return 0;
-    if (player->god) {
-       if (!suppress_deity_message)
-           pr("The game is down\n");
-       return 0;
-    }
-    show_first_tel(downfil);
-    pr("\nThe game is down\n");
-    return 1;
-}
-
 static int
 seconds_since_midnight(time_t time)
 {
@@ -249,21 +231,34 @@ enforce_minimum_session_time(void)
 }
 
 int
-may_play_now(struct natstr *natp, time_t now,
-            int suppress_deity_message)
+may_play_now(struct natstr *natp, time_t now)
 {
     if (CANT_HAPPEN(natp->nat_cnum != player->cnum))
        return 0;
 
-    if (!gamehours(now)) {
-       if (natp->nat_stat != STAT_GOD || !suppress_deity_message)
-           pr("Empire hours restriction in force\n");
+    if (gamehours(now)) {
+       if (player->flags & PF_HOURS) {
+           pr("\nEmpire hours restriction lifted\n");
+           player->flags &= ~PF_HOURS;
+       }
+    } else {
+       if (!(player->flags & PF_HOURS)) {
+           pr("\nEmpire hours restriction in force\n");
+           player->flags |= PF_HOURS;
+       }
        if (natp->nat_stat != STAT_GOD)
            return 0;
     }
 
-    if (gamedown(suppress_deity_message))
-       return 0;
+    if (game_play_disabled()) {
+       if (!(player->flags & PF_DOWN)) {
+           show_first_tel(downfil);
+           pr("\nThe game is down\n");
+           player->flags |= PF_DOWN;
+       }
+       if (natp->nat_stat != STAT_GOD)
+           return 0;
+    }
 
     if ((natp->nat_stat != STAT_GOD && natp->nat_stat != STAT_VIS)
        && natp->nat_timeused > m_m_p_d * 60) {