~ubuntu-branches/ubuntu/quantal/xshisen/quantal

« back to all changes in this revision

Viewing changes to score.C

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2005-01-27 02:42:26 UTC
  • Revision ID: james.westby@ubuntu.com-20050127024226-ipyta7pqhaj8tm9y
Tags: 1.51-1-1.2
* NMU (at maintainer's request).
* Add NO_GLOBAL_HIGHSCORE define which crudely disables the support for
  a global score file.
* Remove sgid bit. Closes: #291613, #292065
* Comment out code in postinst that set up /var/games/xshisen.scores,
  but for now, do not delete that file on upgrade.
* Add README.Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
372
372
    time_t t;
373
373
    struct tm *tp;
374
374
    struct passwd *pw;
375
 
    char   namebuf[128], myname[NAMELEN+1], gecos[128], *po;
 
375
    char   namebuf[142], myname[NAMELEN+1], gecos[128], *po;
376
376
 
 
377
#ifndef NO_GLOBAL_HIGHSCORE
 
378
    
377
379
    s1 = scoreToRegister / 1000;
378
380
    ms_to_hms(scoreToRegister, h, m, s);
379
381
    pw = getpwuid(getuid());
380
 
    strcpy(gecos, pw->pw_gecos);
 
382
    strncpy(gecos, pw->pw_gecos, sizeof(gecos));
 
383
    gecos[sizeof(gecos) - 1] = '\0';
381
384
    if ((po = strchr(gecos, ',')) != NULL)
382
385
        *po = 0;
383
386
    sprintf(namebuf, "%-8.8s (%s)", pw->pw_name, gecos);
424
427
    sprintf(rec[i].time, "%2.2d:%2.2d:%2.2d", tp->tm_hour, tp->tm_min, tp->tm_sec);
425
428
    if (writefile() == 0)
426
429
        DisplayScore(game);
 
430
#endif /* NO_GLOBAL_HIGHSCORE */
427
431
}
428
432
 
429
433
void
666
670
        bp += strlen(bp);
667
671
    }
668
672
    if (rcount[0]) {
669
 
        x = rtime[0] / rcount[0];
670
 
        y = (double)rlev[0] / (double)rcount[0];
671
 
        ms_to_hms(x, t1, t2, t3);
 
673
        x = rtime[0] / rcount[0];
 
674
        y = (double)rlev[0] / (double)rcount[0];
 
675
        ms_to_hms(x, t1, t2, t3);
672
676
        bp += strlen(bp);
673
677
        sprintf(bp, "    %-14.14s: %2.2d:%2.2d:%2.2d (%4.1f) %6d %s\n",
674
678
                res_strings[8], t1, t2, t3, y, rcount[0], res_strings[11]);