now creating world array with 16 elements if world array length is 0
parent
544f18e9c6
commit
c1fa6e2956
|
@ -14,6 +14,9 @@ struct {
|
|||
static inline
|
||||
int _expand_world() {
|
||||
size_t new_num = _world_objects.num * 2;
|
||||
if(new_num == 0) {
|
||||
new_num = 16;
|
||||
}
|
||||
object_t** new_list = realloc(_world_objects.objects, new_num * sizeof(object_t*));
|
||||
if(new_list == NULL) {
|
||||
printf("ERROR: failed to expand world when requesting additional objects\n");
|
||||
|
|
Loading…
Reference in New Issue