From 5ad510a9317ff0b027842d3f7910e8b8db4febe0 Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Mon, 20 Feb 2017 17:09:45 +0900 Subject: [PATCH] ifdef-ed official patches --- include/you.h | 7 +++++++ src/allmain.c | 11 +++++++++++ src/end.c | 5 +++++ src/restore.c | 10 ++++++++++ src/save.c | 9 +++++++++ src/topten.c | 8 ++++++++ win/win32/mhsplash.c | 10 ++++++++-- win/win32/mswproc.c | 4 ++++ 8 files changed, 62 insertions(+), 2 deletions(-) diff --git a/include/you.h b/include/you.h index 5f6f191..e434f30 100644 --- a/include/you.h +++ b/include/you.h @@ -68,11 +68,18 @@ struct u_achieve { }; struct u_realtime { +#if 0 /*C360-19*/ + long + realtime; /* actual playing time up until the last restore, seconds */ + time_t restored; /* time the game was started or restored */ + time_t endtime; +#else long realtime; /* accumulated playing time in seconds */ time_t start_timing; /* time game was started or restored or 'realtime' was last updated (savegamestate for checkpoint) */ time_t finish_time; /* end of 'realtime' interval: time of save or end of game; used for topten/logfile/xlogfile */ +#endif }; /* KMH, conduct -- diff --git a/src/allmain.c b/src/allmain.c index 68cc103..3c54ceb 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -607,13 +607,24 @@ newgame() com_pager(1); } +#if 1 /*C360-19*/ urealtime.realtime = 0L; urealtime.start_timing = getnow(); +#endif #ifdef INSURANCE save_currentstate(); #endif program_state.something_worth_saving++; /* useful data now exists */ +#if 0 /*C360-19*/ + urealtime.realtime = 0L; +#if defined(BSD) && !defined(POSIX_TYPES) + (void) time((long *) &urealtime.restored); +#else + (void) time(&urealtime.restored); +#endif + +#endif /* Success! */ welcome(TRUE); return; diff --git a/src/end.c b/src/end.c index 307d8dd..e884ec1 100644 --- a/src/end.c +++ b/src/end.c @@ -1115,8 +1115,13 @@ int how; /* remember time of death here instead of having bones, rip, and topten figure it out separately and possibly getting different time or even day if player is slow responding to --More-- */ +#if 0 /*C360-19*/ + endtime = getnow(); + urealtime.realtime += (long) (endtime - urealtime.restored); +#else urealtime.finish_time = endtime = getnow(); urealtime.realtime += (long) (endtime - urealtime.start_timing); +#endif /* Sometimes you die on the first move. Life's not fair. * On those rare occasions you get hosed immediately, go out diff --git a/src/restore.c b/src/restore.c index bd012f7..3ece4f1 100644 --- a/src/restore.c +++ b/src/restore.c @@ -579,10 +579,20 @@ unsigned int *stuckid, *steedid; foo = time_from_yyyymmddhhmmss(timebuf); ReadTimebuf(ubirthday); +#if 0 /*C360-19*/ + mread(fd, &urealtime.realtime, sizeof(urealtime.realtime)); + ReadTimebuf(urealtime.restored); +#if defined(BSD) && !defined(POSIX_TYPES) + (void) time((long *) &urealtime.restored); +#else + (void) time(&urealtime.restored); +#endif +#else mread(fd, &urealtime.realtime, sizeof urealtime.realtime); ReadTimebuf(urealtime.start_timing); /** [not used] **/ /* current time is the time to use for next urealtime.realtime update */ urealtime.start_timing = getnow(); +#endif set_uasmon(); #ifdef CLIPPING diff --git a/src/save.c b/src/save.c index 7dc5fb9..a20b2ea 100644 --- a/src/save.c +++ b/src/save.c @@ -309,6 +309,14 @@ register int fd, mode; #ifdef SYSFLAGS bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); #endif +#if 0 /*C360-19*/ + urealtime.realtime += (long) (getnow() - urealtime.restored); + bwrite(fd, (genericptr_t) &u, sizeof(struct you)); + bwrite(fd, yyyymmddhhmmss(ubirthday), 14); + bwrite(fd, (genericptr_t) &urealtime.realtime, + sizeof(urealtime.realtime)); + bwrite(fd, yyyymmddhhmmss(urealtime.restored), 14); +#else urealtime.finish_time = getnow(); urealtime.realtime += (long) (urealtime.finish_time - urealtime.start_timing); @@ -318,6 +326,7 @@ register int fd, mode; bwrite(fd, yyyymmddhhmmss(urealtime.start_timing), 14); /** Why? **/ /* this is the value to use for the next update of urealtime.realtime */ urealtime.start_timing = urealtime.finish_time; +#endif save_killers(fd, mode); /* must come before migrating_objs and migrating_mons are freed */ diff --git a/src/topten.c b/src/topten.c index 8195ce8..dbd1266 100644 --- a/src/topten.c +++ b/src/topten.c @@ -372,8 +372,13 @@ struct toptenentry *tt; Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP, encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve()); Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP, +#if 0 /*C360-19*/ + (long) urealtime.realtime, XLOG_SEP, (long) ubirthday, XLOG_SEP, + (long) urealtime.endtime); +#else (long) urealtime.realtime, XLOG_SEP, (long) ubirthday, XLOG_SEP, (long) urealtime.finish_time); +#endif Fprintf(rfile, "%cgender0=%s%calign0=%s", XLOG_SEP, genders[flags.initgend].filecode, XLOG_SEP, aligns[1 - u.ualignbase[A_ORIGINAL]].filecode); @@ -558,6 +563,9 @@ time_t when; t0->birthdate = yyyymmdd(ubirthday); t0->deathdate = yyyymmdd(when); t0->tt_next = 0; +#if 0 /*C360-19*/ + urealtime.endtime = when; +#endif #ifdef UPDATE_RECORD_IN_PLACE t0->fpos = -1L; #endif diff --git a/win/win32/mhsplash.c b/win/win32/mhsplash.c index 5625081..19e4b3b 100644 --- a/win/win32/mhsplash.c +++ b/win/win32/mhsplash.c @@ -94,9 +94,14 @@ mswin_display_splash_window(BOOL show_ver) if (show_ver) { /* Show complete version information */ dlb *f; + +#if 0 /*W360-1*/ + getversionstring(buf + strsize); + strcat(buf, "\r\n\r\n"); +#else char verbuf[BUFSZ]; int verstrsize = 0; - + getversionstring(verbuf); verstrsize = strlen(verbuf); if (verstrsize + strlen("\r\n\r\n") + 1 < BUFSZ - 1) @@ -110,8 +115,9 @@ mswin_display_splash_window(BOOL show_ver) panic("out of memory"); } strcat(buf, verbuf); +#endif strsize = strlen(buf); - + /* Add compile options */ f = dlb_fopen(OPTIONS_USED, RDTMODE); if (f) { diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 03e58a5..377f1ff 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -16,7 +16,9 @@ #include "func_tab.h" /* for extended commands */ #include "winMS.h" #include +#if 1 /*W360-1*/ #include +#endif #include "mhmap.h" #include "mhstatus.h" #include "mhtext.h" @@ -1653,8 +1655,10 @@ mswin_getlin(const char *question, char *input) len--; #endif input[len] = '\0'; +#if 1 /*W360-1*/ } else if (len>=(BUFSZ-1)) { PlaySound((LPCSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID|SND_ASYNC); +#endif } else { input[len++] = c; #if 1 /*JP*//*2ƒoƒCƒg•¶Žš‚È‚ç‚»‚̏ê‚Å‚à‚¤1ƒoƒCƒg“ǂݍž‚Þ*/ -- 2.11.0