/* src/server/map_objects.c */
#include "map_objects.h"
+#include <stddef.h> /* NULL */
#include <stdio.h> /* FILE typedef */
#include <stdint.h> /* uint8_t, uint16_t */
#include <stdlib.h> /* free(), atoi() */
-#include <string.h> /* strlen(), memcpy(), strtok() */
+#include <string.h> /* strlen(), memcpy(), strtok(), memset() */
#include "../common/readwrite.h" /* try_fopen(), try_fclose(), try_fgets(),
* textfile_sizes()
*/
-static struct yx_uint16 find_passable_pos() // struct Map * map)
+static struct yx_uint16 find_passable_pos()
{
struct yx_uint16 pos;
for (pos.y = pos.x = 0; 0 == is_passable(pos);)
char * f_name = "add_map_object()";
struct MapObjDef * mod = get_map_object_def(type);
struct MapObj * mo = try_malloc(sizeof(struct MapObj), f_name);
+ memset(mo, 0, sizeof(struct MapObj));
mo->id = world.map_obj_count++;
mo->type = mod->id;
mo->lifepoints = mod->lifepoints;
break;
}
}
- mo->progress = 0;
- mo->command = 0;
- mo->arg = 0;
- mo->owns = NULL;
- mo->next = NULL;
struct MapObj ** mo_ptr_ptr = &world.map_objs;
for (; NULL != * mo_ptr_ptr; mo_ptr_ptr = &(*mo_ptr_ptr)->next);
* mo_ptr_ptr = mo;