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));
|
memcpy(item, def, sizeof(Entity));
|
||||||
|
|
||||||
|
item->next = NULL;
|
||||||
|
|
||||||
item->action = action;
|
item->action = action;
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -91,8 +93,11 @@ void addRandomItem(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
item = spawnEntity();
|
item = spawnEntity();
|
||||||
|
|
||||||
memcpy(item, def, sizeof(Entity));
|
memcpy(item, def, sizeof(Entity));
|
||||||
|
|
||||||
|
item->next = NULL;
|
||||||
|
|
||||||
item->x = x;
|
item->x = x;
|
||||||
item->y = y;
|
item->y = y;
|
||||||
item->speed = 1;
|
item->speed = 1;
|
||||||
|
|
Loading…
Reference in New Issue