*/
#include "world.h" /* global world */
+#include "../common/try_malloc.h" /* try_malloc() */
extern void obey_argv(int argc, char * argv[])
world.player_inventory_select = world.player_inventory_select
+ (world.player_inventory_select < n_elems);
}
+
+
+
+extern void array_append(uint32_t old_n, size_t region_size, void * new_region,
+ void ** ptr_old_array)
+{
+ char * f_name = "array_append()";
+ uint32_t old_size = old_n * region_size;
+ uint32_t new_size = old_size + region_size;
+ void * new_array = try_malloc(new_size, f_name);
+ memcpy(new_array, * ptr_old_array, old_size);
+ memcpy(new_array + (old_n * region_size), new_region, region_size);
+ free(* ptr_old_array);
+ * ptr_old_array = new_array;
+}