player.pos.x = read_uint16_bigendian(file) - 1;
player.hitpoints = fgetc(file);
read_map_objects (&world.monster, file, sizeof(struct Monster), read_map_objects_monsterdata);
- read_map_objects (&world.item, file, sizeof(struct Item), readwrite_map_objects_dummy);
+ read_map_objects (&world.item, file, sizeof(struct Item), NULL);
fclose(file); }
// For non-interactive mode, try to load world state from record file.
free(defline);
fclose(file); };
-extern void readwrite_map_objects_dummy (void * dummy, FILE * file) {
-// Dummy function for calls of (write|read)_map_objects on map objects without specific attributes.
- ; }
-
extern void write_map_objects_monsterdata (void * start, FILE * file) {
// Write to file data specific to map objects of type monster.
struct Monster * m = (struct Monster *) start;
write_uint16_bigendian(map_obj->pos.y + 1, file);
write_uint16_bigendian(map_obj->pos.x + 1, file);
fputc(map_obj->type, file);
- w_typedata (map_obj, file); }
+ if (w_typedata)
+ w_typedata (map_obj, file); }
write_uint16_bigendian(0, file); }
extern void read_map_objects_monsterdata (void * start, FILE * file) {
map_obj->pos.y = test - 1;
map_obj->pos.x = read_uint16_bigendian(file) - 1;
map_obj->type = fgetc(file);
- r_typedata (map_obj, file); }
+ if (r_typedata)
+ r_typedata (map_obj, file); }
if (!first)
map_obj->next = 0; }
unsigned char hitpoints_start; };
extern void init_map_object_defs (struct World *, char *);
-extern void readwrite_map_objects_dummy (void *, FILE *);
extern void write_map_objects_monsterdata (void *, FILE *);
extern void write_map_objects (void * start, FILE *, void (*) (void *, FILE *) );
extern void read_map_objects_monsterdata (void *, FILE *);
write_uint16_bigendian(world->player->pos.x + 1, file);
fputc(world->player->hitpoints, file);
write_map_objects (world->monster, file, write_map_objects_monsterdata);
- write_map_objects (world->item, file, readwrite_map_objects_dummy);
+ write_map_objects (world->item, file, NULL);
fclose(file); }
extern void toggle_window (struct WinMeta * win_meta, struct Win * win) {