Codacy fixes

This commit is contained in:
Linus Probert 2018-01-29 18:30:14 +01:00
parent 6e6a9641ae
commit 76ddc6c529
2 changed files with 2 additions and 5 deletions

View File

@ -245,7 +245,6 @@ monster_drop_loot(Monster *monster, Map *map)
static unsigned int item_drop_chance = 3; static unsigned int item_drop_chance = 3;
static unsigned int treasure_drop_chance = 2; static unsigned int treasure_drop_chance = 2;
bool dropped_something = false; bool dropped_something = false;
unsigned int item_drop;
Item *item; Item *item;
// TODO(Linus): // TODO(Linus):
@ -258,8 +257,7 @@ monster_drop_loot(Monster *monster, Map *map)
linkedlist_append(&map->items, item); linkedlist_append(&map->items, item);
} }
if ((rand() % item_drop_chance) == 0) { if ((rand() % item_drop_chance) == 0) {
item_drop = rand() % TREASURE; item = item_builder_build_item(rand() % TREASURE);
item = item_builder_build_item(item_drop);
item->sprite->pos = monster->sprite->pos; item->sprite->pos = monster->sprite->pos;
dropped_something = true; dropped_something = true;
linkedlist_append(&map->items, item); linkedlist_append(&map->items, item);

View File

@ -59,9 +59,8 @@ has_collided(Player *player, RoomMatrix *matrix)
if (space->items != NULL) { if (space->items != NULL) {
LinkedList *items = space->items; LinkedList *items = space->items;
Item *item;
while (items != NULL) { while (items != NULL) {
item = items->data; Item *item = items->data;
items = items->next; items = items->next;
if (item->effect) if (item->effect)
item->effect(item, player); item->effect(item, player);