summary refs log tree commit diff stats
path: root/hslist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hslist.cpp')
-rw-r--r--hslist.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/hslist.cpp b/hslist.cpp index a0debd7..3e11e41 100644 --- a/hslist.cpp +++ b/hslist.cpp
@@ -40,21 +40,21 @@ SDL_Surface* HighscoreList::render()
40 Highscore* h = *it; 40 Highscore* h = *it;
41 41
42 int posw, posh; 42 int posw, posh;
43 char pos[3]; // 2 max characters in rank plus the colon at the end 43 char pos[4]; // 2 max characters in rank plus the colon at the end, plus terminator
44 sprintf(pos, "%d:", h->getRank()); 44 sprintf(pos, "%d:", h->getRank());
45 TTF_SizeText(posFont, pos, &posw, &posh); 45 TTF_SizeText(posFont, pos, &posw, &posh);
46 SDL_Rect posSpace = {0, (i+1)*40, posw, posh}; 46 SDL_Rect posSpace = {0, (i+1)*40, posw, posh};
47 SDL_BlitSurface(TTF_RenderText_Blended(posFont, pos, fontColor), NULL, tmp, &posSpace); 47 SDL_BlitSurface(TTF_RenderText_Blended(posFont, pos, fontColor), NULL, tmp, &posSpace);
48 48
49 int namew, nameh; 49 int namew, nameh;
50 char name[26]; // 25 max characters in username plus the space at the beginning 50 char name[27]; // 25 max characters in username plus the space at the beginning, plus terminator
51 sprintf(name, " %s", h->getName()); 51 sprintf(name, " %s", h->getName());
52 TTF_SizeText(dataFont, name, &namew, &nameh); 52 TTF_SizeText(dataFont, name, &namew, &nameh);
53 SDL_Rect nameSpace = {posw, (i+1)*40+((posh/2)-(nameh/2)), namew, nameh}; 53 SDL_Rect nameSpace = {posw, (i+1)*40+((posh/2)-(nameh/2)), namew, nameh};
54 SDL_BlitSurface(TTF_RenderText_Blended(dataFont, name, fontColor), NULL, tmp, &nameSpace); 54 SDL_BlitSurface(TTF_RenderText_Blended(dataFont, name, fontColor), NULL, tmp, &nameSpace);
55 55
56 int lvlw, lvlh; 56 int lvlw, lvlh;
57 char lvl[10]; // 10 max characters in level (based off the fact that 2^32-1 is 10 characters long, and is the highest int) 57 char lvl[11]; // 10 max characters in level (based off the fact that 2^32-1 is 10 characters long, and is the highest int), plus terminator
58 sprintf(lvl, "%d", h->getLevel()); 58 sprintf(lvl, "%d", h->getLevel());
59 TTF_SizeText(dataFont, lvl, &lvlw, &lvlh); 59 TTF_SizeText(dataFont, lvl, &lvlw, &lvlh);
60 SDL_Rect lvlSpace = {480-lvlw, (i+1)*40+((posh/2)-(nameh/2)), lvlw, lvlh}; 60 SDL_Rect lvlSpace = {480-lvlw, (i+1)*40+((posh/2)-(nameh/2)), lvlw, lvlh};