Always set next to null after memcpy.

This commit is contained in:
Steve 2016-05-12 09:34:48 +01:00
parent bd1dac445a
commit a04c3321e7
1 changed files with 5 additions and 0 deletions

View File

@ -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;