comparison libmlk-rpg/rpg/character.c @ 298:196264679079

misc: remove usage of bool
author David Demelier <markand@malikania.fr>
date Wed, 10 Mar 2021 18:49:08 +0100
parents 3991779aaba9
children f04b4ee04db3
comparison
equal deleted inserted replaced
297:6151152d009c 298:196264679079
25 25
26 #include "character.h" 26 #include "character.h"
27 #include "equipment.h" 27 #include "equipment.h"
28 #include "save.h" 28 #include "save.h"
29 29
30 bool 30 int
31 character_ok(const struct character *ch) 31 character_ok(const struct character *ch)
32 { 32 {
33 return ch && ch->name && ch->reset && sprite_ok(ch->sprites[CHARACTER_SPRITE_NORMAL]); 33 return ch && ch->name && ch->reset && sprite_ok(ch->sprites[CHARACTER_SPRITE_NORMAL]);
34 } 34 }
35 35
68 68
69 if (ch->exec) 69 if (ch->exec)
70 ch->exec(ch, bt); 70 ch->exec(ch, bt);
71 } 71 }
72 72
73 bool 73 int
74 character_save(const struct character *ch, struct save *s) 74 character_save(const struct character *ch, struct save *s)
75 { 75 {
76 assert(ch); 76 assert(ch);
77 assert(save_ok(s)); 77 assert(save_ok(s));
78 78
89 ch->agtbonus, 89 ch->agtbonus,
90 ch->luckbonus 90 ch->luckbonus
91 ); 91 );
92 } 92 }
93 93
94 bool 94 int
95 character_load(struct character *ch, struct save *s) 95 character_load(struct character *ch, struct save *s)
96 { 96 {
97 assert(ch); 97 assert(ch);
98 assert(save_ok(s)); 98 assert(save_ok(s));
99 99
100 struct save_stmt stmt; 100 struct save_stmt stmt;
101 bool ret; 101 int ret;
102 102
103 if (!save_stmt_init(s, &stmt, (const char *)sql_character_load, "s", ch->name)) 103 if (save_stmt_init(s, &stmt, (const char *)sql_character_load, "s", ch->name) < 0)
104 return false; 104 return -1;
105 105
106 ret = save_stmt_next(&stmt, "iii i iiiiii", 106 ret = save_stmt_next(&stmt, "iii i iiiiii",
107 &ch->hp, 107 &ch->hp,
108 &ch->mp, 108 &ch->mp,
109 &ch->level, 109 &ch->level,
116 &ch->luckbonus 116 &ch->luckbonus
117 ); 117 );
118 118
119 save_stmt_finish(&stmt); 119 save_stmt_finish(&stmt);
120 120
121 return ret; 121 return 0;
122 } 122 }