diff libmlk-rpg/mlk/rpg/battle-indicator.c @ 486:d6757c30658e

core: rework errors
author David Demelier <markand@malikania.fr>
date Tue, 28 Feb 2023 13:04:13 +0100
parents bc5483849614
children 2af25db99273
line wrap: on
line diff
--- a/libmlk-rpg/mlk/rpg/battle-indicator.c	Tue Feb 28 08:40:35 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-indicator.c	Tue Feb 28 13:04:13 2023 +0100
@@ -55,6 +55,7 @@
 
 	char buf[128];
 	const struct theme *theme = THEME(bti);
+	int err;
 
 	snprintf(buf, sizeof (buf), "%u", bti->amount);
 
@@ -62,9 +63,9 @@
 	bti->elapsed = 0;
 	bti->alpha = 250;
 
-	if (mlk_font_render(theme->fonts[THEME_FONT_INTERFACE], &bti->tex[0], buf, bti->cur) < 0||
-	    mlk_font_render(theme->fonts[THEME_FONT_INTERFACE], &bti->tex[1], buf, 0x000000ff) < 0)
-		mlk_panic();
+	if ((err = mlk_font_render(theme->fonts[THEME_FONT_INTERFACE], &bti->tex[0], buf, bti->cur)) < 0 ||
+	    (err = mlk_font_render(theme->fonts[THEME_FONT_INTERFACE], &bti->tex[1], buf, 0x000000ff)) < 0)
+		mlk_panic(err);
 }
 
 int