patch投げ用
Revision | ca836324a1540c6dc76f7e3ecc212bf66fc1d36e (tree) |
---|---|
Time | 2016-02-10 22:21:32 |
Author | SHIRAKATA Kentaro <argrath@ub32...> |
Commiter | SHIRAKATA Kentaro |
fix C360-19
@@ -68,10 +68,11 @@ struct u_achieve { | ||
68 | 68 | }; |
69 | 69 | |
70 | 70 | struct u_realtime { |
71 | - long | |
72 | - realtime; /* actual playing time up until the last restore, seconds */ | |
73 | - time_t restored; /* time the game was started or restored */ | |
74 | - time_t endtime; | |
71 | + long realtime; /* accumulated playing time in seconds */ | |
72 | + time_t start_timing; /* time game was started or restored or 'realtime' | |
73 | + was last updated (savegamestate for checkpoint) */ | |
74 | + time_t finish_time; /* end of 'realtime' interval: time of save or | |
75 | + end of game; used for topten/logfile/xlogfile */ | |
75 | 76 | }; |
76 | 77 | |
77 | 78 | /* KMH, conduct -- |
@@ -587,18 +587,13 @@ newgame() | ||
587 | 587 | com_pager(1); |
588 | 588 | } |
589 | 589 | |
590 | + urealtime.realtime = 0L; | |
591 | + urealtime.start_timing = getnow(); | |
590 | 592 | #ifdef INSURANCE |
591 | 593 | save_currentstate(); |
592 | 594 | #endif |
593 | 595 | program_state.something_worth_saving++; /* useful data now exists */ |
594 | 596 | |
595 | - urealtime.realtime = 0L; | |
596 | -#if defined(BSD) && !defined(POSIX_TYPES) | |
597 | - (void) time((long *) &urealtime.restored); | |
598 | -#else | |
599 | - (void) time(&urealtime.restored); | |
600 | -#endif | |
601 | - | |
602 | 597 | /* Success! */ |
603 | 598 | welcome(TRUE); |
604 | 599 | return; |
@@ -951,8 +951,8 @@ int how; | ||
951 | 951 | /* remember time of death here instead of having bones, rip, and |
952 | 952 | topten figure it out separately and possibly getting different |
953 | 953 | time or even day if player is slow responding to --More-- */ |
954 | - endtime = getnow(); | |
955 | - urealtime.realtime += (long) (endtime - urealtime.restored); | |
954 | + urealtime.finish_time = endtime = getnow(); | |
955 | + urealtime.realtime += (long) (endtime - urealtime.start_timing); | |
956 | 956 | |
957 | 957 | /* Sometimes you die on the first move. Life's not fair. |
958 | 958 | * On those rare occasions you get hosed immediately, go out |
@@ -568,13 +568,10 @@ unsigned int *stuckid, *steedid; | ||
568 | 568 | foo = time_from_yyyymmddhhmmss(timebuf); |
569 | 569 | |
570 | 570 | ReadTimebuf(ubirthday); |
571 | - mread(fd, &urealtime.realtime, sizeof(urealtime.realtime)); | |
572 | - ReadTimebuf(urealtime.restored); | |
573 | -#if defined(BSD) && !defined(POSIX_TYPES) | |
574 | - (void) time((long *) &urealtime.restored); | |
575 | -#else | |
576 | - (void) time(&urealtime.restored); | |
577 | -#endif | |
571 | + mread(fd, &urealtime.realtime, sizeof urealtime.realtime); | |
572 | + ReadTimebuf(urealtime.start_timing); /** [not used] **/ | |
573 | + /* current time is the time to use for next urealtime.realtime update */ | |
574 | + urealtime.start_timing = getnow(); | |
578 | 575 | |
579 | 576 | set_uasmon(); |
580 | 577 | #ifdef CLIPPING |
@@ -289,12 +289,15 @@ register int fd, mode; | ||
289 | 289 | #ifdef SYSFLAGS |
290 | 290 | bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); |
291 | 291 | #endif |
292 | - urealtime.realtime += (long) (getnow() - urealtime.restored); | |
292 | + urealtime.finish_time = getnow(); | |
293 | + urealtime.realtime += (long) (urealtime.finish_time | |
294 | + - urealtime.start_timing); | |
293 | 295 | bwrite(fd, (genericptr_t) &u, sizeof(struct you)); |
294 | 296 | bwrite(fd, yyyymmddhhmmss(ubirthday), 14); |
295 | - bwrite(fd, (genericptr_t) &urealtime.realtime, | |
296 | - sizeof(urealtime.realtime)); | |
297 | - bwrite(fd, yyyymmddhhmmss(urealtime.restored), 14); | |
297 | + bwrite(fd, (genericptr_t) &urealtime.realtime, sizeof urealtime.realtime); | |
298 | + bwrite(fd, yyyymmddhhmmss(urealtime.start_timing), 14); /** Why? **/ | |
299 | + /* this is the value to use for the next update of urealtime.realtime */ | |
300 | + urealtime.start_timing = urealtime.finish_time; | |
298 | 301 | save_killers(fd, mode); |
299 | 302 | |
300 | 303 | /* must come before migrating_objs and migrating_mons are freed */ |
@@ -330,8 +330,8 @@ struct toptenentry *tt; | ||
330 | 330 | Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP, |
331 | 331 | encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve()); |
332 | 332 | Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP, |
333 | - (long) urealtime.realtime, XLOG_SEP, (long) ubirthday, XLOG_SEP, | |
334 | - (long) urealtime.endtime); | |
333 | + (long) urealtime.realtime, XLOG_SEP, | |
334 | + (long) ubirthday, XLOG_SEP, (long) urealtime.finish_time); | |
335 | 335 | Fprintf(rfile, "%cgender0=%s%calign0=%s", XLOG_SEP, |
336 | 336 | genders[flags.initgend].filecode, XLOG_SEP, |
337 | 337 | aligns[1 - u.ualignbase[A_ORIGINAL]].filecode); |
@@ -516,7 +516,6 @@ time_t when; | ||
516 | 516 | t0->birthdate = yyyymmdd(ubirthday); |
517 | 517 | t0->deathdate = yyyymmdd(when); |
518 | 518 | t0->tt_next = 0; |
519 | - urealtime.endtime = when; | |
520 | 519 | #ifdef UPDATE_RECORD_IN_PLACE |
521 | 520 | t0->fpos = -1L; |
522 | 521 | #endif |