diff libmlk-core/core/action.c @ 298:196264679079

misc: remove usage of bool
author David Demelier <markand@malikania.fr>
date Wed, 10 Mar 2021 18:49:08 +0100
parents 71b3b7036de7
children d01e83210ca2
line wrap: on
line diff
--- a/libmlk-core/core/action.c	Wed Mar 10 18:49:00 2021 +0100
+++ b/libmlk-core/core/action.c	Wed Mar 10 18:49:08 2021 +0100
@@ -35,7 +35,7 @@
 		act->handle(act, ev);
 }
 
-bool
+int
 action_update(struct action *act, unsigned int ticks)
 {
 	assert(act);
@@ -43,7 +43,8 @@
 	if (act->update)
 		return act->update(act, ticks);
 
-	return false;
+	/* No function means immortal action. */
+	return 0;
 }
 
 void
@@ -81,7 +82,7 @@
 	memset(st, 0, sizeof (*st));
 }
 
-bool
+int
 action_stack_add(struct action_stack *st, struct action *act)
 {
 	assert(st);
@@ -90,11 +91,11 @@
 	for (size_t i = 0; i < ACTION_STACK_MAX; ++i) {
 		if (!st->actions[i]) {
 			st->actions[i] = act;
-			return true;
+			return 0;
 		}
 	}
 
-	return false;
+	return -1;
 }
 
 void
@@ -110,7 +111,7 @@
 			action_handle(act, ev);
 }
 
-bool
+int
 action_stack_update(struct action_stack *st, unsigned int ticks)
 {
 	assert(st);
@@ -146,7 +147,7 @@
 			action_draw(act);
 }
 
-bool
+int
 action_stack_completed(const struct action_stack *st)
 {
 	assert(st);
@@ -155,9 +156,9 @@
 
 	ACTION_FOREACH(st, act)
 		if (act)
-			return false;
+			return 0;
 
-	return true;
+	return 1;
 }
 
 void