Always set next to null after memcpy.
This commit is contained in:
parent
bd1dac445a
commit
a04c3321e7
|
@ -71,6 +71,8 @@ Entity *spawnItem(char *name)
|
|||
|
||||
memcpy(item, def, sizeof(Entity));
|
||||
|
||||
item->next = NULL;
|
||||
|
||||
item->action = action;
|
||||
|
||||
return item;
|
||||
|
@ -91,8 +93,11 @@ void addRandomItem(int x, int y)
|
|||
}
|
||||
|
||||
item = spawnEntity();
|
||||
|
||||
memcpy(item, def, sizeof(Entity));
|
||||
|
||||
item->next = NULL;
|
||||
|
||||
item->x = x;
|
||||
item->y = y;
|
||||
item->speed = 1;
|
||||
|
|
Loading…
Reference in New Issue