-// Write to file data specific tto map objects of type monster.
- struct Monster * monster = (struct Monster *) start;
- fputc(monster->hitpoints, file); }
-
-extern void write_map_objects (void * start, FILE * file, void (* f) (void *, FILE *) ) {
-// Write into file the map object chain starting at start, use f() for object-type specific data.
- struct ChainMapObject * cmo;
- for (cmo = start; cmo != 0; cmo = cmo->next) {
- write_uint16_bigendian(cmo->pos.y + 1, file);
- write_uint16_bigendian(cmo->pos.x + 1, file);
- fputc(cmo->name, file);
- f (cmo, file); }
+// Write to file data specific to map objects of type monster.
+ struct Monster * m = (struct Monster *) start;
+ fputc(m->hitpoints, file); }
+
+extern void write_map_objects (void * start, FILE * file, void (* w_typedata) (void *, FILE *) ) {
+// Write into file the map object chain starting at start, use write_type() for object-type specific data.
+ struct MapObj * map_obj;
+ for (map_obj = start; map_obj != 0; map_obj = map_obj->next) {
+ 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); }