From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4db,898056ca7bc8edb4,start X-Google-Attributes: gid10d4db,public X-Google-ArrivalTime: 1993-09-09 13:06:54 PST Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!gatech!concert!samba.oit.unc.edu!bounce-bounce From: Frank Hoffmeister Newsgroups: comp.os.linux.announce Subject: Patch for xboing-1.7 Followup-To: comp.os.linux.misc Date: 9 Sep 1993 19:53:39 GMT Organization: None Message-ID: <26o1k3$ejc@samba.oit.unc.edu> Reply-To: Frank Hoffmeister NNTP-Posting-Host: calypso.oit.unc.edu Keywords: xboing, games, X11 Originator: mdw@sunSITE Hello Everybody, Xboing a break-out like game with fancy graphics and sound effects (sound blaster, /dev/audio, etc) for all sorts of UNIX X11 platforms, eg. linux. Recently I stumbled across xboing-1.7 but found out that the highscore table isn't handled well. The bug actually is in highscore.c where the internal data is stored and to be handled in ``network representation''. Unfortunately, some uses of HighScoreEntry are not handled properly resulting in a complete wrecked highscore table. The patch below fixes the problem. Have fun, Frank Hoffmeister hoffmeister@LS11.Informatik.Uni-Dortmund.DE Tel: +49-231-755-4678 University of Dortmund Fax: +49-231-755-2450 Department of Computer Science Systems Analysis Research Group D - 44221 Dortmund, Germany PS: I sent the patch also to jck@citri.edu.au ------------------------------------------------------------------------ *** highscore.c Wed Sep 8 23:44:49 1993 --- highscore.c.fixed Wed Sep 8 23:36:32 1993 *************** *** 253,259 **** /* Draw the score */ sprintf(string, "%ld", ntohl(highScores[i].score)); ! if (highScores[i].score != score) DrawShadowText(display, window, textFont, string, xs, y, red); else DrawShadowText(display, window, textFont, string, xs, y, green); --- 253,259 ---- /* Draw the score */ sprintf(string, "%ld", ntohl(highScores[i].score)); ! if (ntohl(highScores[i].score) != score) DrawShadowText(display, window, textFont, string, xs, y, red); else DrawShadowText(display, window, textFont, string, xs, y, green); *************** *** 520,526 **** theTime = (time_t) ntohl(highScores[i].time); strftime(string, 10, "%d %b %y", localtime(&theTime)); ! if (ntohl(highScores[i].score) > 0) { /* Print out the actual record */ fprintf(stdout, "%d\t%ld\t %ld\t%d'%d\"\t%s %s\n", --- 520,526 ---- theTime = (time_t) ntohl(highScores[i].time); strftime(string, 10, "%d %b %y", localtime(&theTime)); ! if (ntohl(highScores[i].score) > (u_long) 0) { /* Print out the actual record */ fprintf(stdout, "%d\t%ld\t %ld\t%d'%d\"\t%s %s\n", *************** *** 557,563 **** theTime = (time_t) ntohl(highScores[i].time); strftime(string, 10, "%d %b %y", localtime(&theTime)); ! if (ntohl(highScores[i].score) > 0) { /* Print out the actual record */ fprintf(stdout, "%d\t%ld\t %ld\t%d'%d\"\t%s %s\n", --- 557,563 ---- theTime = (time_t) ntohl(highScores[i].time); strftime(string, 10, "%d %b %y", localtime(&theTime)); ! if (ntohl(highScores[i].score) > (u_long) 0) { /* Print out the actual record */ fprintf(stdout, "%d\t%ld\t %ld\t%d'%d\"\t%s %s\n", *************** *** 846,852 **** for (j = NUM_HIGHSCORES - 1; j > i; --j) { /* Who has the higher score */ ! if (highScores[j-1].score < highScores[j].score) { /* Swap the entries around - use memcpy in future */ tempHighScore.score = highScores[j-1].score; --- 846,852 ---- for (j = NUM_HIGHSCORES - 1; j > i; --j) { /* Who has the higher score */ ! if (ntohl(highScores[j-1].score) < ntohl(highScores[j].score)) { /* Swap the entries around - use memcpy in future */ tempHighScore.score = highScores[j-1].score; *************** *** 1101,1106 **** --- 1101,1115 ---- strcpy(filename, str); else strcpy(filename, HIGH_SCORE_FILE); + + #ifndef F_LOCK + #define F_LOCK LOCK_EX + #define F_ULOCK LOCK_UN + #endif + #ifndef LOCK_EX + #define LOCK_EX F_LOCK + #define LOCK_UN F_ULOCK + #endif /* Open the highscore file for both read & write */ if (cmd == F_LOCK || cmd == LOCK_EX) -- Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu