summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2011-02-20 19:54:48 +0100
committerBardur Arantsson <bardur@scientician.net>2011-02-20 19:55:50 +0100
commit420428c53fe83064331ac2e06297c8a93abc93cf (patch)
tree4d30f5b8a67036c0fe91f8fdc11e01ba898bddbb
parente04284dc9694c53314403536a27992a9cfc655a2 (diff)
Remove CHECK_LOAD and CHECK_TIME completely.
-rw-r--r--src/config.h12
-rw-r--r--src/dungeon.c41
-rw-r--r--src/externs.h4
-rw-r--r--src/files.c257
-rw-r--r--src/main-sdl-iso.c15
-rw-r--r--src/main.c15
6 files changed, 0 insertions, 344 deletions
diff --git a/src/config.h b/src/config.h
index b1ba2c9d..a2f3b61e 100644
--- a/src/config.h
+++ b/src/config.h
@@ -300,18 +300,6 @@
/*
- * OPTION: Check the "time" against "lib/file/hours.txt"
- */
-/* #define CHECK_TIME */
-
-/*
- * OPTION: Check the "load" against "lib/file/load.txt"
- * This may require the 'rpcsvs' library
- */
-/* #define CHECK_LOAD */
-
-
-/*
* OPTION: For some brain-dead computers with no command line interface,
* namely Macintosh, there has to be some way of "naming" your savefiles.
* The current "Macintosh" hack is to make it so whenever the character
diff --git a/src/dungeon.c b/src/dungeon.c
index b94ae68e..716bc8ac 100644
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -1126,47 +1126,6 @@ static void process_world(void)
}
}
- /*** Check the Time and Load ***/
-
- /*
- * Every 1000 game turns -- which means this section is invoked every
- * 100 player turns under the normal speed, and slightly more than
- * one per move in the reduced map.
- */
- if ((turn % 1000) == 0)
- {
- /* Check time and load */
- if ((0 != check_time()) || (0 != check_load()))
- {
- /* Warning */
- if (closing_flag <= 2)
- {
- /* Disturb */
- disturb(0, 0);
-
- /* Count warnings */
- closing_flag++;
-
- /* Message */
- msg_print("The gates to Middle Earth are closing...");
- msg_print("Please finish up and/or save your game.");
- }
-
- /* Slam the gate */
- else
- {
- /* Message */
- msg_print("The gates to Middle Earth are now closed.");
-
- /* Stop playing */
- alive = FALSE;
-
- /* Leaving */
- p_ptr->leaving = TRUE;
- }
- }
- }
-
/*** Attempt timed autosave ***/
if (autosave_t && autosave_freq)
{
diff --git a/src/externs.h b/src/externs.h
index 868fa968..435bff3e 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -894,10 +894,6 @@ extern cptr describe_player_location(void);
extern errr file_character(cptr name, bool full);
extern errr process_pref_file_aux(char *buf);
extern errr process_pref_file(cptr name);
-extern errr check_time_init(void);
-extern errr check_load_init(void);
-extern errr check_time(void);
-extern errr check_load(void);
extern void read_times(void);
extern bool txt_to_html(cptr head, cptr food, cptr base, cptr ext, bool force, bool recur);
extern bool show_file(cptr name, cptr what, int line, int mode);
diff --git a/src/files.c b/src/files.c
index a1a41c56..7323b426 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1111,263 +1111,6 @@ errr process_pref_file(cptr name)
-
-
-
-#ifdef CHECK_TIME
-
-/*
- * Operating hours for ANGBAND (defaults to non-work hours)
- */
-static char days[7][29] =
- {
- "SUN:XXXXXXXXXXXXXXXXXXXXXXXX",
- "MON:XXXXXXXX.........XXXXXXX",
- "TUE:XXXXXXXX.........XXXXXXX",
- "WED:XXXXXXXX.........XXXXXXX",
- "THU:XXXXXXXX.........XXXXXXX",
- "FRI:XXXXXXXX.........XXXXXXX",
- "SAT:XXXXXXXXXXXXXXXXXXXXXXXX"
- };
-
-/*
- * Restict usage (defaults to no restrictions)
- */
-static bool check_time_flag = FALSE;
-
-#endif
-
-
-/*
- * Handle CHECK_TIME
- */
-errr check_time(void)
-{
-
-#ifdef CHECK_TIME
-
- time_t c;
-
- struct tm *tp;
-
-
- /* No restrictions */
- if (!check_time_flag) return (0);
-
- /* Check for time violation */
- c = time((time_t *)0);
- tp = localtime(&c);
-
- /* Violation */
- if (days[tp->tm_wday][tp->tm_hour + 4] != 'X') return (1);
-
-#endif
-
- /* Success */
- return (0);
-}
-
-
-
-/*
- * !Ran under the game's permission!
- *
- * Initialize CHECK_TIME
- */
-errr check_time_init(void)
-{
-
-#ifdef CHECK_TIME
-
- FILE *fp;
-
- char buf[1024];
-
-
- /* Build the filename */
- path_build(buf, 1024, ANGBAND_DIR_FILE, "time.txt");
-
- /*
- * XXX No need to grab permission here because this function is called
- * only once before the game drops "game" permission
- */
-
- /* Open the file */
- fp = my_fopen(buf, "r");
-
- /* No file, no restrictions */
- if (!fp) return (0);
-
- /* Assume restrictions */
- check_time_flag = TRUE;
-
- /* Parse the file */
- while (0 == my_fgets(fp, buf, 80))
- {
- /* Skip comments and blank lines */
- if (!buf[0] || (buf[0] == '#')) continue;
-
- /* Chop the buffer */
- buf[29] = '\0';
-
- /* Extract the info */
- if (prefix(buf, "SUN:")) strcpy(days[0], buf);
- if (prefix(buf, "MON:")) strcpy(days[1], buf);
- if (prefix(buf, "TUE:")) strcpy(days[2], buf);
- if (prefix(buf, "WED:")) strcpy(days[3], buf);
- if (prefix(buf, "THU:")) strcpy(days[4], buf);
- if (prefix(buf, "FRI:")) strcpy(days[5], buf);
- if (prefix(buf, "SAT:")) strcpy(days[6], buf);
- }
-
- /* Close it */
- my_fclose(fp);
-
-#endif
-
- /* Success */
- return (0);
-}
-
-
-
-#ifdef CHECK_LOAD
-
-#ifndef MAXHOSTNAMELEN
-# define MAXHOSTNAMELEN 64
-#endif
-
-typedef struct statstime statstime;
-
-struct statstime
-{
- int cp_time[4];
- int dk_xfer[4];
- unsigned int v_pgpgin;
- unsigned int v_pgpgout;
- unsigned int v_pswpin;
- unsigned int v_pswpout;
- unsigned int v_intr;
- int if_ipackets;
- int if_ierrors;
- int if_opackets;
- int if_oerrors;
- int if_collisions;
- unsigned int v_swtch;
- long avenrun[3];
- struct timeval boottime;
- struct timeval curtime;
-};
-
-/*
- * Maximal load (if any).
- */
-static int check_load_value = 0;
-
-#endif
-
-
-/*
- * Handle CHECK_LOAD
- */
-errr check_load(void)
-{
-
-#ifdef CHECK_LOAD
-
- struct statstime st;
-
-
- /* Success if not checking */
- if (!check_load_value) return (0);
-
- /* Check the load */
- if (0 == rstat("localhost", &st))
- {
- long val1 = (long)(st.avenrun[2]);
- long val2 = (long)(check_load_value) * FSCALE;
-
- /* Check for violation */
- if (val1 >= val2) return (1);
- }
-
-#endif
-
- /* Success */
- return (0);
-}
-
-
-/*
- * !Ran under the game's permission!
- *
- * Initialize CHECK_LOAD
- */
-errr check_load_init(void)
-{
-
-#ifdef CHECK_LOAD
-
- FILE *fp;
-
- char buf[1024];
-
- char temphost[MAXHOSTNAMELEN + 1];
- char thishost[MAXHOSTNAMELEN + 1];
-
-
- /* Build the filename */
- path_build(buf, 1024, ANGBAND_DIR_FILE, "load.txt");
-
- /*
- * XXX No need to grab permission here because this function is called
- * only once before the game drops "game" permission
- */
-
- /* Open the "load" file */
- fp = my_fopen(buf, "r");
-
- /* No file, no restrictions */
- if (!fp) return (0);
-
- /* Default load */
- check_load_value = 100;
-
- /* Get the host name */
- (void)gethostname(thishost, (sizeof thishost) - 1);
-
- /* Parse it */
- while (0 == my_fgets(fp, buf, 1024))
- {
- int value;
-
- /* Skip comments and blank lines */
- if (!buf[0] || (buf[0] == '#')) continue;
-
- /* Parse, or ignore */
- if (sscanf(buf, "%s%d", temphost, &value) != 2) continue;
-
- /* Skip other hosts */
- if (!streq(temphost, thishost) &&
- !streq(temphost, "localhost")) continue;
-
- /* Use that value */
- check_load_value = value;
-
- /* Done */
- break;
- }
-
- /* Close the file */
- my_fclose(fp);
-
-#endif
-
- /* Success */
- return (0);
-}
-
-
/*
* Print long number with header at given row, column
* Use the color for the number, not the header
diff --git a/src/main-sdl-iso.c b/src/main-sdl-iso.c
index 1461b376..0935d24f 100644
--- a/src/main-sdl-iso.c
+++ b/src/main-sdl-iso.c
@@ -1649,21 +1649,6 @@ int main(int argc, char *argv[])
#ifdef SET_UID
- /* Please note that the game is still running in the game's permission */
-
- /* Initialize the "time" checker */
- if (check_time_init() || check_time())
- {
- sdl_quit("The gates to Angband are closed (bad time).");
- }
-
- /* Initialize the "load" checker */
- if (check_load_init() || check_load())
- {
- sdl_quit("The gates to Angband are closed (bad load).");
- }
-
-
/*
* Become user -- This will be the normal state for the rest of the game.
*
diff --git a/src/main.c b/src/main.c
index bbb50c54..7bb1f0f1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -341,21 +341,6 @@ int main(int argc, char *argv[])
#ifdef SET_UID
- /* Please note that the game is still running in the game's permission */
-
- /* Initialize the "time" checker */
- if (check_time_init() || check_time())
- {
- quit("The gates to Angband are closed (bad time).");
- }
-
- /* Initialize the "load" checker */
- if (check_load_init() || check_load())
- {
- quit("The gates to Angband are closed (bad load).");
- }
-
-
/*
* Become user -- This will be the normal state for the rest of the game.
*