From: Frank Hoffmeister <iwan@gorbi.informatik.uni-dortmund.de>
Subject: Patch for xboing-1.7
Date: 9 Sep 1993 19:53:39 GMT [thread overview]
Message-ID: <26o1k3$ejc@samba.oit.unc.edu> (raw)
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
reply other threads:[~1993-09-09 19:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox