X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fmap_objects.h;h=cf575f38b5d4389f206268c7867b5602d496dc12;hb=b8597a6c0a7eedbbc95cecc3058e02edabf54cc2;hp=0796c3c02d4db02f476922ee5bb88d7622607b69;hpb=6052be616897d692fc57ab15b56266b4b3f4668b;p=plomrogue diff --git a/src/server/map_objects.h b/src/server/map_objects.h index 0796c3c..cf575f3 100644 --- a/src/server/map_objects.h +++ b/src/server/map_objects.h @@ -7,8 +7,10 @@ #ifndef MAP_OBJECTS_H #define MAP_OBJECTS_H -#include /* uint8_t */ -#include "../common/yx_uint16.h" /* yx_uint16 structs */ +#include /* uint8_t, uint32_t */ +#include /* FILE */ +#include "../common/yx_uint8.h" /* yx_uint8 structs */ +struct EntrySkeleton; @@ -16,29 +18,33 @@ struct MapObj { struct MapObj * next; /* pointer to next one in map object chain */ struct MapObj * owns; /* chain of map objects owned / in inventory */ - struct yx_uint16 pos; /* coordinate on map */ + struct yx_uint8 pos; /* coordinate on map */ uint8_t id; /* individual map object's unique identifier */ uint8_t type; /* ID of appropriate map object definition */ uint8_t lifepoints; /* 0: object is inanimate; >0: hitpoints */ - uint8_t command; /* map object's current action */ + uint8_t command; /* map object's current action; 0 if none */ uint8_t arg; /* optional field for .command argument */ uint8_t progress; /* turns already passed to realize .command */ }; struct MapObjDef { + uint8_t id; /* map object definition identifier / sets .type */ struct MapObjDef * next; char char_on_map; /* map object symbol to appear on map */ char * name; /* string to describe object in game log */ - uint8_t id; /* map object definition identifier / sets .type */ uint8_t corpse_id; /* type to change map object into upon destruction */ uint8_t lifepoints; /* default start value for map object's .lifepoints */ + uint8_t consumable; /* can be eaten if !0, for so much hitpoint win */ }; -/* Initialize map object definitions chain. */ -extern void init_map_object_defs(); +/* Read-in to "entry" multi-line entry from MapObjDef config "file", using + * pre-allocated "line", "linemax" and "context" as input for err_try_fgets(). + */ +extern void read_map_object_def(char * line, uint32_t linemax, char * context, + struct EntrySkeleton * entry, FILE * file); /* Free map object definitions chain starting at "mod_start". */ extern void free_map_object_defs(struct MapObjDef * mod_start); @@ -62,7 +68,7 @@ extern struct MapObj * get_player(); extern struct MapObjDef * get_map_object_def(uint8_t id); /* Move not only "mo" to "pos", but also all map objects owned by it. */ -extern void set_object_position(struct MapObj * mo, struct yx_uint16 pos); +extern void set_object_position(struct MapObj * mo, struct yx_uint8 pos);