Changeset 38

Show
Ignore:
Timestamp:
04/09/07 19:33:11 (2 years ago)
Author:
takkaria
Message:
  • Add some more variation in welcome messages
  • Fix mistake in store.c
  • Remove CHECK_TIME option (closes #72).
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/Makefile.std

    r27 r38  
    7171# Basic compiler stuff 
    7272CC = gcc 
    73 CFLAGS = -Wall -O2 -fno-strength-reduce 
     73CFLAGS = -Wall -O2 -Wno-unused-parameter 
    7474 
    7575 
  • trunk/src/config.h

    r1 r38  
    364364# define ALLOW_USER_SCRIPTS 
    365365#endif /* SET_UID */ 
    366  
    367  
    368 /* 
    369  * OPTION: Check the "time" against "lib/file/hours.txt" 
    370  */ 
    371 /* #define CHECK_TIME */ 
    372366 
    373367 
  • trunk/src/dungeon.c

    r27 r38  
    617617 
    618618        /*** Check the Time and Load ***/ 
    619  
    620         if (!(turn % 1000)) 
    621         { 
    622                 /* Check time and load */ 
    623                 if (0 != check_time()) 
    624                 { 
    625                         /* Warning */ 
    626                         if (closing_flag <= 2) 
    627                         { 
    628                                 /* Disturb */ 
    629                                 disturb(0, 0); 
    630  
    631                                 /* Count warnings */ 
    632                                 closing_flag++; 
    633  
    634                                 /* Message */ 
    635                                 msg_print("The gates to ANGBAND are closing..."); 
    636                                 msg_print("Please finish up and/or save your game."); 
    637                         } 
    638  
    639                         /* Slam the gate */ 
    640                         else 
    641                         { 
    642                                 /* Message */ 
    643                                 msg_print("The gates to ANGBAND are now closed."); 
    644  
    645                                 /* Stop playing */ 
    646                                 p_ptr->playing = FALSE; 
    647  
    648                                 /* Leaving */ 
    649                                 p_ptr->leaving = TRUE; 
    650                         } 
    651                 } 
    652         } 
    653619 
    654620        /* Play an ambient sound at regular intervals. */ 
  • trunk/src/externs.h

    r36 r38  
    390390extern errr process_pref_file_command(char *buf); 
    391391extern errr process_pref_file(cptr name); 
    392 extern errr check_time(void); 
    393 extern errr check_time_init(void); 
    394392extern void player_flags(u32b *f1, u32b *f2, u32b *f3); 
    395393extern void display_player(int mode); 
  • trunk/src/files.c

    r24 r38  
    10781078 
    10791079 
    1080  
    1081  
    1082 #ifdef CHECK_TIME 
    1083  
    1084 /* 
    1085  * Operating hours for ANGBAND (defaults to non-work hours) 
    1086  */ 
    1087 static char days[7][29] = 
    1088 { 
    1089         "SUN:XXXXXXXXXXXXXXXXXXXXXXXX", 
    1090         "MON:XXXXXXXX.........XXXXXXX", 
    1091         "TUE:XXXXXXXX.........XXXXXXX", 
    1092         "WED:XXXXXXXX.........XXXXXXX", 
    1093         "THU:XXXXXXXX.........XXXXXXX", 
    1094         "FRI:XXXXXXXX.........XXXXXXX", 
    1095         "SAT:XXXXXXXXXXXXXXXXXXXXXXXX" 
    1096 }; 
    1097  
    1098 /* 
    1099  * Restict usage (defaults to no restrictions) 
    1100  */ 
    1101 static bool check_time_flag = FALSE; 
    1102  
    1103 #endif /* CHECK_TIME */ 
    1104  
    1105  
    1106 /* 
    1107  * Handle CHECK_TIME 
    1108  */ 
    1109 errr check_time(void) 
    1110 { 
    1111  
    1112 #ifdef CHECK_TIME 
    1113  
    1114         time_t c; 
    1115         struct tm *tp; 
    1116  
    1117         /* No restrictions */ 
    1118         if (!check_time_flag) return (0); 
    1119  
    1120         /* Check for time violation */ 
    1121         c = time((time_t *)0); 
    1122         tp = localtime(&c); 
    1123  
    1124         /* Violation */ 
    1125         if (days[tp->tm_wday][tp->tm_hour + 4] != 'X') return (1); 
    1126  
    1127 #endif /* CHECK_TIME */ 
    1128  
    1129         /* Success */ 
    1130         return (0); 
    1131 } 
    1132  
    1133  
    1134  
    1135 /* 
    1136  * Initialize CHECK_TIME 
    1137  */ 
    1138 errr check_time_init(void) 
    1139 { 
    1140  
    1141 #ifdef CHECK_TIME 
    1142  
    1143         FILE *fp; 
    1144  
    1145         char buf[1024]; 
    1146  
    1147  
    1148         /* Build the filename */ 
    1149         path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "time.txt"); 
    1150  
    1151         /* Open the file */ 
    1152         fp = my_fopen(buf, "r"); 
    1153  
    1154         /* No file, no restrictions */ 
    1155         if (!fp) return (0); 
    1156  
    1157         /* Assume restrictions */ 
    1158         check_time_flag = TRUE; 
    1159  
    1160         /* Parse the file */ 
    1161         while (0 == my_fgets(fp, buf, sizeof(buf))) 
    1162         { 
    1163                 /* Skip comments and blank lines */ 
    1164                 if (!buf[0] || (buf[0] == '#')) continue; 
    1165  
    1166                 /* Chop the buffer */ 
    1167                 buf[sizeof(days[0]) - 1] = '\0'; 
    1168  
    1169                 /* Extract the info */ 
    1170                 if (prefix(buf, "SUN:")) my_strcpy(days[0], buf, sizeof(days[0])); 
    1171                 if (prefix(buf, "MON:")) my_strcpy(days[1], buf, sizeof(days[1])); 
    1172                 if (prefix(buf, "TUE:")) my_strcpy(days[2], buf, sizeof(days[2])); 
    1173                 if (prefix(buf, "WED:")) my_strcpy(days[3], buf, sizeof(days[3])); 
    1174                 if (prefix(buf, "THU:")) my_strcpy(days[4], buf, sizeof(days[4])); 
    1175                 if (prefix(buf, "FRI:")) my_strcpy(days[5], buf, sizeof(days[5])); 
    1176                 if (prefix(buf, "SAT:")) my_strcpy(days[6], buf, sizeof(days[6])); 
    1177         } 
    1178  
    1179         /* Close it */ 
    1180         my_fclose(fp); 
    1181  
    1182 #endif /* CHECK_TIME */ 
    1183  
    1184         /* Success */ 
    1185         return (0); 
    1186 } 
    11871080 
    11881081 
  • trunk/src/main.c

    r2 r38  
    401401 
    402402#ifdef SET_UID 
    403  
    404         /* Initialize the "time" checker */ 
    405         if (check_time_init() || check_time()) 
    406         { 
    407                 quit("The gates to Angband are closed (bad time)."); 
    408         } 
    409403 
    410404        /* Get the "user name" as a default player name */ 
  • trunk/src/store.c

    r37 r38  
    177177 
    178178                /* Get a title for the character */ 
    179                 if (i == 4)          player_name = c_text + cp_ptr->title[(p_ptr->lev - 1) / 5]; 
    180                 else if (rand_int(2)) player_name = op_ptr->full_name; 
    181                 else                  player_name = "sir"; 
     179                if ((i % 2) && rand_int(2)) player_name = c_text + cp_ptr->title[(p_ptr->lev - 1) / 5]; 
     180                else if (rand_int(2))       player_name = op_ptr->full_name; 
     181                else                        player_name = "sir"; 
    182182 
    183183                /* Balthazar says "Welcome" */ 
     
    15051505 
    15061506        /* Clip the width at a maximum of 104 (enough room for an 80-char item name) */ 
    1507         if (wid > 104) wid = 100
     1507        if (wid > 104) wid = 104
    15081508 
    15091509        /* Clip the text_out function at two smaller than the screen width */