comparison libmlk-core/core/script.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
comparison
equal deleted inserted replaced
297:6151152d009c 298:196264679079
37 handle(struct action *a, const union event *ev) 37 handle(struct action *a, const union event *ev)
38 { 38 {
39 script_handle(a->data, ev); 39 script_handle(a->data, ev);
40 } 40 }
41 41
42 static bool 42 static int
43 update(struct action *a, unsigned int ticks) 43 update(struct action *a, unsigned int ticks)
44 { 44 {
45 return script_update(a->data, ticks); 45 return script_update(a->data, ticks);
46 } 46 }
47 47
63 assert(s); 63 assert(s);
64 64
65 memset(s, 0, sizeof (*s)); 65 memset(s, 0, sizeof (*s));
66 } 66 }
67 67
68 bool 68 int
69 script_append(struct script *s, struct action *a) 69 script_append(struct script *s, struct action *a)
70 { 70 {
71 assert(s); 71 assert(s);
72 assert(a); 72 assert(a);
73 73
74 if (s->actionsz >= SCRIPT_ACTION_MAX) 74 if (s->actionsz >= SCRIPT_ACTION_MAX)
75 return errorf("script is full"); 75 return errorf("script is full");
76 76
77 s->actions[s->actionsz++] = a; 77 s->actions[s->actionsz++] = a;
78 78
79 return true; 79 return 0;
80 } 80 }
81 81
82 void 82 void
83 script_handle(struct script *s, const union event *ev) 83 script_handle(struct script *s, const union event *ev)
84 { 84 {
89 89
90 if (a) 90 if (a)
91 action_handle(a, ev); 91 action_handle(a, ev);
92 } 92 }
93 93
94 bool 94 int
95 script_update(struct script *s, unsigned int ticks) 95 script_update(struct script *s, unsigned int ticks)
96 { 96 {
97 assert(s); 97 assert(s);
98 98
99 struct action *a = current(s); 99 struct action *a = current(s);
100 100
101 if (!a) 101 if (!a)
102 return true; 102 return 1;
103 103
104 if (action_update(a, ticks)) { 104 if (action_update(a, ticks)) {
105 action_end(a); 105 action_end(a);
106 s->cur++; 106 s->cur++;
107 } 107 }
118 118
119 if (a) 119 if (a)
120 action_draw(a); 120 action_draw(a);
121 } 121 }
122 122
123 bool 123 int
124 script_completed(const struct script *s) 124 script_completed(const struct script *s)
125 { 125 {
126 assert(s); 126 assert(s);
127 127
128 return s->cur >= s->actionsz; 128 return s->cur >= s->actionsz;