(gamehours): All callers ignore the value assigned to hour[]. Remove

parameter.  Remove calls without effect.  Other callers changed.
This commit is contained in:
Markus Armbruster 2004-04-04 14:20:30 +00:00
parent 2df3f002e1
commit ded3daf70d
6 changed files with 8 additions and 23 deletions

View file

@ -119,7 +119,7 @@ extern void filetruncate(s_char *);
/* hap_fact.c */ /* hap_fact.c */
extern double hap_fact(struct natstr *, struct natstr *); extern double hap_fact(struct natstr *, struct natstr *);
/* hours.c */ /* hours.c */
extern int gamehours(time_t, int *); extern int gamehours(time_t);
/* land.c */ /* land.c */
extern int has_units(coord, coord, natid, struct lndstr *); extern int has_units(coord, coord, natid, struct lndstr *);
extern int has_units_with_mob(coord, coord, natid); extern int has_units_with_mob(coord, coord, natid);

View file

@ -49,18 +49,16 @@
/* /*
* returns true if game can be played now. * returns true if game can be played now.
* Sets the number of minutes until the hours
* function must be re-called.
*/ */
int int
gamehours(time_t now, int *hour) gamehours(time_t now)
{ {
register s_char *bp; register s_char *bp;
register struct tm *tm; register struct tm *tm;
int day; int day;
int curtime; int curtime;
int okday[7]; int okday[7];
int tomorrow; int hour[2];
tm = localtime(&now); tm = localtime(&now);
curtime = tm->tm_min + tm->tm_hour * 60; curtime = tm->tm_min + tm->tm_hour * 60;
@ -83,12 +81,6 @@ gamehours(time_t now, int *hour)
break; break;
if (bp == 0) if (bp == 0)
return 0; return 0;
} else {
hour[0] = 0;
hour[1] = 24 * 60;
} }
tomorrow = tm->tm_wday + 1;
if (tomorrow >= 7)
tomorrow = 0;
return 1; return 1;
} }

View file

@ -65,7 +65,6 @@ void
player_main(struct player *p) player_main(struct player *p)
{ {
struct natstr *natp; struct natstr *natp;
int hour[2];
int secs; int secs;
s_char buf[128]; s_char buf[128];
@ -83,7 +82,7 @@ player_main(struct player *p)
pr("You're not a deity!\n"); pr("You're not a deity!\n");
return; return;
} }
if (!gamehours(player->curup, hour)) { if (!gamehours(player->curup)) {
pr("Empire hours restriction in force\n"); pr("Empire hours restriction in force\n");
if ((natp->nat_stat & STAT_GOD) == 0) if ((natp->nat_stat & STAT_GOD) == 0)
return; return;
@ -190,7 +189,6 @@ status(void)
struct natstr *natp; struct natstr *natp;
int minute; int minute;
struct sctstr sect; struct sctstr sect;
int hour[2];
s_char buf[128]; s_char buf[128];
if (player->state == PS_SHUTDOWN) if (player->state == PS_SHUTDOWN)
@ -249,7 +247,7 @@ status(void)
* either day change, or hours restriction * either day change, or hours restriction
*/ */
daychange(player->curup); daychange(player->curup);
if (!gamehours(player->curup, hour)) { if (!gamehours(player->curup)) {
pr("Empire hours restriction in force\n"); pr("Empire hours restriction in force\n");
if ((natp->nat_stat & STAT_GOD) == 0) { if ((natp->nat_stat & STAT_GOD) == 0) {
putnat(natp); putnat(natp);

View file

@ -91,7 +91,6 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
time_t now; time_t now;
int hour[2];
int flags = 0; int flags = 0;
int op; int op;
char *config_file = NULL; char *config_file = NULL;
@ -207,7 +206,6 @@ main(int argc, char **argv)
ef_init(); ef_init();
init_files(); init_files();
io_init(); io_init();
gamehours(now, hour);
if (opt_MOB_ACCESS) { if (opt_MOB_ACCESS) {
/* This fixes up mobility upon restart */ /* This fixes up mobility upon restart */

View file

@ -49,7 +49,6 @@ mobility_check(void *unused)
struct mob_acc_globals timestamps; struct mob_acc_globals timestamps;
time_t now; time_t now;
FILE *fp; FILE *fp;
int hour[2];
while (1) { while (1) {
time(&now); time(&now);
@ -68,7 +67,7 @@ mobility_check(void *unused)
rewind(fp); rewind(fp);
fwrite(&timestamps, sizeof(timestamps), 1, fp); fwrite(&timestamps, sizeof(timestamps), 1, fp);
fclose(fp); fclose(fp);
if (!gamehours(now, hour)) { if (!gamehours(now)) {
if (updating_mob == 1) { if (updating_mob == 1) {
update_all_mob(); update_all_mob();
logerror("Turning off mobility updating (gamehours)."); logerror("Turning off mobility updating (gamehours).");
@ -127,7 +126,7 @@ mobility_init(void)
time(&now); time(&now);
logerror("Done at %s", ctime(&now)); logerror("Done at %s", ctime(&now));
if (now >= timestamps.starttime && gamehours(now, hour)) { if (now >= timestamps.starttime && gamehours(now)) {
logerror("Turning on mobility updating."); logerror("Turning on mobility updating.");
updating_mob = 1; updating_mob = 1;
} else { } else {

View file

@ -50,7 +50,6 @@ void
update_sched(void *unused) update_sched(void *unused)
{ {
s_char *kw; s_char *kw;
int hour[2];
int wind; int wind;
time_t now, delta; time_t now, delta;
@ -58,7 +57,6 @@ update_sched(void *unused)
empth_create(PP_SCHED, update_wait, (50 * 1024), 0, "UpdateWait", empth_create(PP_SCHED, update_wait, (50 * 1024), 0, "UpdateWait",
"Waits until players idle", 0); "Waits until players idle", 0);
time(&now); time(&now);
(void)gamehours(now, hour);
if (s_p_etu <= 0) { if (s_p_etu <= 0) {
logerror("bad value for s_p_etu (%d)", s_p_etu); logerror("bad value for s_p_etu (%d)", s_p_etu);
s_p_etu = 2 * 60; s_p_etu = 2 * 60;
@ -78,7 +76,7 @@ update_sched(void *unused)
empth_sleep(update_time); empth_sleep(update_time);
time(&now); time(&now);
now += adj_update; now += adj_update;
if (!gamehours(now, hour)) { if (!gamehours(now)) {
logerror("No update permitted (hours restriction)"); logerror("No update permitted (hours restriction)");
continue; continue;
} }