Mercurial > molko
comparison libmlk-rpg/rpg/inventory.c @ 298:196264679079
misc: remove usage of bool
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 10 Mar 2021 18:49:08 +0100 |
parents | 9948e288925b |
children | d01e83210ca2 |
comparison
equal
deleted
inserted
replaced
297:6151152d009c | 298:196264679079 |
---|---|
29 return &iv->items[i]; | 29 return &iv->items[i]; |
30 | 30 |
31 return NULL; | 31 return NULL; |
32 } | 32 } |
33 | 33 |
34 bool | 34 int |
35 inventory_add(struct inventory *iv, const struct item *item, unsigned int amount) | 35 inventory_add(struct inventory *iv, const struct item *item, unsigned int amount) |
36 { | 36 { |
37 assert(iv); | 37 assert(iv); |
38 assert(item); | 38 assert(item); |
39 | 39 |
42 /* Find one existing, otherwise find one empty. */ | 42 /* Find one existing, otherwise find one empty. */ |
43 if (!(slot = find(iv, item))) | 43 if (!(slot = find(iv, item))) |
44 slot = find(iv, NULL); | 44 slot = find(iv, NULL); |
45 | 45 |
46 if (!slot) | 46 if (!slot) |
47 return false; | 47 return 0; |
48 | 48 |
49 slot->item = item; | 49 slot->item = item; |
50 slot->amount += amount; | 50 slot->amount += amount; |
51 | 51 |
52 return true; | 52 return -1; |
53 } | 53 } |
54 | 54 |
55 void | 55 void |
56 inventory_consume(struct inventory *iv, const struct item *item, unsigned int amount) | 56 inventory_consume(struct inventory *iv, const struct item *item, unsigned int amount) |
57 { | 57 { |