From 72cdce40b5750662fcb5957a1565948eeaa8a16e Mon Sep 17 00:00:00 2001 From: danij Date: Mon, 19 Jun 2006 21:07:06 +0000 Subject: [PATCH] Fixed a bug with the hud-frags-all debug display which led to a seg violation when enabled. --- doomsday/plugins/common/src/hu_stuff.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/doomsday/plugins/common/src/hu_stuff.c b/doomsday/plugins/common/src/hu_stuff.c index 92a7c85081..3a25cbd5b5 100644 --- a/doomsday/plugins/common/src/hu_stuff.c +++ b/doomsday/plugins/common/src/hu_stuff.c @@ -283,6 +283,7 @@ void HU_Drawer(void) #ifdef __JDOOM__ int i, k, x, y; char buf[80]; + player_t *plr; #endif HUMsg_Drawer(); @@ -290,16 +291,27 @@ void HU_Drawer(void) #ifdef __JDOOM__ if(hu_showallfrags) { - for(y = 8, i = 0; i < MAXPLAYERS; i++, y += 10) + for(y = 8, i = 0; i < MAXPLAYERS; i++) { - sprintf(buf, "%i%s", i, i == consoleplayer ? "=" : ":"); + plr = &players[i]; + if(!plr->plr || !plr->plr->ingame) + continue; + + sprintf(buf, "%i%s", i, (i == consoleplayer ? "=" : ":")); + M_WriteText(0, y, buf); + x = 20; for(k = 0; k < MAXPLAYERS; k++, x += 18) { - sprintf(buf, "%i", players[i].frags[k]); + if(players[k].plr || !players[k].plr->ingame) + continue; + + sprintf(buf, "%i", plr->frags[k]); M_WriteText(x, y, buf); } + + y += 10; } } #endif @@ -659,7 +671,7 @@ void M_LetterFlash(int x, int y, int w, int h, int bright, float red, */ void M_WriteText(int x, int y, char *string) { - M_WriteText2(x, y, string, 0, 1, 1, 1, 1); + M_WriteText2(x, y, string, hu_font_a, 1, 1, 1, 1); } void M_WriteText2(int x, int y, char *string, dpatch_t *font, float red,