Skip to content

Commit

Permalink
reduce hu_widget_t array sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Dec 3, 2023
1 parent 07bb00c commit 4883073
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ static hu_multiline_t w_fps;
static hu_multiline_t w_rate;

#define MAX_HUDS 3
#define MAX_WIDGETS 15
#define MAX_WIDGETS_D 5
#define MAX_WIDGETS_B 12

static hu_widget_t doom_widgets[MAX_HUDS][MAX_WIDGETS] = {
static hu_widget_t doom_widgets[MAX_HUDS][MAX_WIDGETS_D] = {
{
{&w_title, align_direct, align_bottom, 0},
{&w_message, align_direct, align_top, 0},
Expand All @@ -148,7 +149,7 @@ static hu_widget_t doom_widgets[MAX_HUDS][MAX_WIDGETS] = {
}
};

static hu_widget_t boom_widgets[MAX_HUDS][MAX_WIDGETS] = {
static hu_widget_t boom_widgets[MAX_HUDS][MAX_WIDGETS_B] = {
{
{&w_monsec, align_left, align_top},
{&w_sttime, align_left, align_top},
Expand Down Expand Up @@ -1909,7 +1910,7 @@ static boolean HU_ReplaceInDoomWidgets (hu_multiline_t *multiline, int hud, alig
return false;
}

for (i = 0; i < MAX_WIDGETS - 1; i++)
for (i = 0; i < MAX_WIDGETS_D - 1; i++)
{
if (doom_widgets[hud][i].multiline == multiline)
{
Expand All @@ -1934,15 +1935,15 @@ static boolean HU_AddToBoomWidgets (hu_multiline_t *multiline, int hud, align_t
return false;
}

for (i = 0; i < MAX_WIDGETS - 1; i++)
for (i = 0; i < MAX_WIDGETS_B - 1; i++)
{
if (boom_widgets[hud][i].multiline == NULL)
{
break;
}
}

if (i + 1 >= MAX_WIDGETS)
if (i + 1 >= MAX_WIDGETS_B)
{
return false;
}
Expand Down

0 comments on commit 4883073

Please sign in to comment.