Package: xgalaga
Version: 2.0.34-39
Followup-For: Bug #386718
Try this patch instead - the other patch was wrong.
Regards, Thue
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.27
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages xgalaga depends on:
ii libc6 2.3.6.ds1-4 GNU C Library: Shared libraries
ii libx11-6 2:1.0.0-8 X11 client-side library
ii libxext6 1:1.0.1-2 X11 miscellaneous extension librar
ii libxmu6 1:1.0.2-2 X11 miscellaneous utility library
ii libxpm4 1:3.5.5-2 X11 pixmap library
ii libxt6 1:1.0.2-2 X11 toolkit intrinsics library
ii libxxf86vm1 1:1.0.0-4 X11 XFree86 video mode extension l
xgalaga recommends no packages.
-- no debconf information
diff -ur xgalaga-2.0.34/highscore.c xgalaga_min/highscore.c
--- xgalaga-2.0.34/highscore.c 2006-09-09 18:21:37.000000000 +0200
+++ xgalaga_min/highscore.c 2006-09-09 19:13:59.000000000 +0200
@@ -125,7 +125,7 @@
}
/* shorten to 20 chars */
- fullname[20] = 0;
+ fullname[19] = 0;
/* Return their name without any trailing stuff */
return(fullname);
@@ -205,12 +205,24 @@
return;
}
+void normalize_name(char* name) {
+ int len = strlen(name);
+ int i;
+
+ for (i=len; i<19; i++) {
+ name[i] = ' ';
+ }
+ name[19] = 0;
+}
+
void add_score(char *name, int score)
{
int i,j ; /* ,k; */
thisplace = my_thisplace = -1;
+ normalize_name(name);
+
load_scores();
#ifndef NO_GLOBAL_SCORES
@@ -368,7 +380,7 @@
W_MakeLine(baseWin, WINWIDTH/2-((strlen(buf)*W_Textwidth)/2), 111,
WINWIDTH/2 + ((strlen(buf)*W_Textwidth)/2), 111, W_Red);
for(i=0;i<NUM_GLOBAL_SCORES;i++) {
- sprintf(buf, " %2d. %-20s %7ld %5ld", i+1,
+ sprintf(buf, " %2d. %-19s %7ld %5ld", i+1,
global_scores[i].name, global_scores[i].score,global_scores[i].level);
center_text(buf, 112+i*W_Textheight, (i==thisplace ? color : W_Grey));
}
@@ -380,7 +392,7 @@
W_MakeLine(baseWin, WINWIDTH/2-((strlen(buf)*W_Textwidth)/2), 123+(NUM_GLOBAL_SCORES+1)*W_Textheight,
WINWIDTH/2 + ((strlen(buf)*W_Textwidth)/2), 123+(NUM_GLOBAL_SCORES+1)*W_Textheight, W_Red);
for(i=0;i<NUM_MY_SCORES;i++) {
- sprintf(buf, " %2d. %-20s %7ld %5ld", i+1,
+ sprintf(buf, " %2d. %-19s %7ld %5ld", i+1,
my_scores[i].name, my_scores[i].score,my_scores[i].level);
center_text(buf, 124+(NUM_GLOBAL_SCORES+1)*W_Textheight + i*W_Textheight,
(i==my_thisplace ? color : W_Grey));
@@ -425,6 +437,9 @@
}
}
close(hsf);
+ for(i=0;i<NUM_MY_SCORES;i++) {
+ normalize_name(global_scores[i].name);
+ }
#endif /* NO_GLOBAL_SCORES */
if((home = getenv("HOME"))) {
@@ -458,6 +473,9 @@
my_scores[i].level = 0;
}
}
+ for(i=0;i<NUM_MY_SCORES;i++) {
+ normalize_name(my_scores[i].name);
+ }
return;
#ifndef NO_GLOBAL_SCORES
error:
@@ -468,6 +486,7 @@
global_scores[i].uid = 0;
#endif
global_scores[i].name[0]=0;
+ normalize_name(global_scores[i].name);
global_scores[i].score = 0;
global_scores[i].level = 0;
}
@@ -479,6 +498,7 @@
printf("Error reading high scores file '%s'\n", my_file_name);
for(i=0;i<NUM_MY_SCORES;i++) {
my_scores[i].name[0]=0;
+ normalize_name(my_scores[i].name);
my_scores[i].score = 0;
my_scores[i].level = 0;
}