X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/form?a=blobdiff_plain;f=src%2Fmap_object_actions.c;h=9541214d1fadd8d71f6004556c5b09616da27940;hb=10680a2398daf76e6a0cd261c2b247e6902f2ad0;hp=1d3139fd157b1a2fa2fb806457a3a97c49d4600e;hpb=2dccba703435158681552b8a8aefccab79eb13f3;p=plomrogue diff --git a/src/map_object_actions.c b/src/map_object_actions.c index 1d3139f..9541214 100644 --- a/src/map_object_actions.c +++ b/src/map_object_actions.c @@ -12,7 +12,7 @@ #include "misc.h" /* for update_log(), try_malloc() */ #include "map.h" /* for is_passable() */ #include "main.h" /* for world global */ -#include "readwrite.h" /* for try_fopen(), try_fclose(), get_linemax() */ +#include "readwrite.h" /* for try_fopen(), try_fclose(), textfile_sizes() */ #include "rexit.h" /* for exit_err() */ @@ -186,7 +186,7 @@ extern void init_map_object_actions() char * path = "config/map_object_actions"; FILE * file = try_fopen(path, "r", f_name); - uint16_t linemax = get_linemax(file, f_name); + uint16_t linemax = textfile_sizes(file, NULL); char line[linemax + 1]; struct MapObjAct ** moa_ptr_ptr = &world.map_obj_acts; @@ -233,6 +233,23 @@ extern void free_map_object_actions(struct MapObjAct * moa) +extern uint8_t get_moa_id_by_name(char * name) +{ + struct MapObjAct * moa = world.map_obj_acts; + while (NULL != moa) + { + if (0 == strcmp(moa->name, name)) + { + break; + } + moa = moa->next; + } + exit_err(NULL == moa, "get_moa_id_name() did not find map object action."); + return moa->id; +} + + + extern void actor_wait(struct MapObj * mo) { if (mo == get_player())