From 89f690eda064e4009748fb4f9aae7d8aade9414e Mon Sep 17 00:00:00 2001 From: Allanis Date: Fri, 8 Mar 2013 14:34:47 +0000 Subject: [PATCH] [Fix] Display '0' properly if you sell al your ammo. --- src/player.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/player.c b/src/player.c index 8384f3d..43a86c8 100644 --- a/src/player.c +++ b/src/player.c @@ -416,14 +416,28 @@ void player_render(void) { } else { f = &gl_defFont; if(player->ammo == NULL) { - i = gl_printWidth(f, "%s", player->secondary->outfit->name); - if(i > (int)gui.weapon.w) - // Font is too big. - f = &gl_smallFont; - - gl_printMid(f, (int)gui.weapon.w, gui.weapon.x, - gui.weapon.y - (gui.weapon.h - f->h)/2., - &cConsole, "%s", player->secondary->outfit->name); + if(outfit_isLauncher(player->secondary->outfit)) { + // Out of ammo. + i = gl_printWidth(f, "%s", player->secondary->outfit->u.lau.ammo); + if(i > (int)gui.weapon.w) + // Font is too big. + f = &gl_smallFont; + gl_printMid(f, (int)gui.weapon.w, + gui.weapon.x, gui.weapon.y - 5, + &cConsole, "%s", player->secondary->outfit->u.lau.ammo); + gl_printMid(&gl_smallFont, (int)gui.weapon.w, + gui.weapon.x, gui.weapon.y - 10 - gl_defFont.h, + NULL, "0"); + } else { + // Not a launcher. + i = gl_printWidth(f, "%s", player->secondary->outfit->name); + if(i > (int)gui.weapon.w) + // Font is too big. + f = &gl_smallFont; + gl_printMid(f, (int) gui.weapon.w, + gui.weapon.x, gui.weapon.y - (gui.weapon.h - f->h)/2., + &cConsole, "%s", player->secondary->outfit->name); + } } else { // Use the ammunitions name. i = gl_printWidth(f, "%s", player->secondary->outfit->name);