X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fserver%2Fmap_object_actions.c;h=6c92d07577eaade92234e042b2d64beb0d3c572e;hb=4266e8b48fc5481ce24c0bf02fdd517217f8390a;hp=987f13581eb86d9a51d521e712035b06763ba4ca;hpb=cc4ed0c49279f08a053a3e3a9a4acba22283a01f;p=plomrogue diff --git a/src/server/map_object_actions.c b/src/server/map_object_actions.c index 987f135..6c92d07 100644 --- a/src/server/map_object_actions.c +++ b/src/server/map_object_actions.c @@ -9,6 +9,7 @@ #include "../common/rexit.h" /* exit_err() */ #include "../common/try_malloc.h" /* try_malloc() */ #include "../common/yx_uint8.h" /* struct yx_uint8 */ +#include "field_of_view.h" /* build_fov_map() */ #include "map_objects.h" /* structs MapObj, MapObjDef, get_player(), * set_object_position(), own_map_object(), * get_map_object_def() @@ -22,10 +23,6 @@ /* Append "text" to game log, or a "." if "text" is the same as the last one. */ static void update_log(char * text); -/* If "name" fits "moa"->name, set "moa"->func to "func". */ -//static uint8_t try_func_name(struct MapObjAct * moa, -// char * name, void (* func) (struct MapObj *)); - /* One actor "wounds" another actor, decrementing his lifepoints and, if they * reach zero in the process, killing it. Generates appropriate log message. */ @@ -143,14 +140,12 @@ static uint8_t match_dir(char d, char ** dsc_d, char match, char * dsc_match) static void playerbonus_move(char d, uint8_t passable) { - char * dsc_dir = "north"; - if ( match_dir(d, &dsc_dir, '6', "east") - || match_dir(d, &dsc_dir, '2', "south") - || match_dir(d, &dsc_dir, '4', "west") - || match_dir(d, &dsc_dir, '7', "north-west") - || match_dir(d, &dsc_dir, '9', "north-east") - || match_dir(d, &dsc_dir, '1', "south-west") - || match_dir(d, &dsc_dir, '3', "south-east")) + char * dsc_dir = "north-east"; + if ( match_dir(d, &dsc_dir, 'd', "east") + || match_dir(d, &dsc_dir, 'c', "south-east") + || match_dir(d, &dsc_dir, 'x', "south-west") + || match_dir(d, &dsc_dir, 's', "west") + || match_dir(d, &dsc_dir, 'w', "north-west")) { ; } @@ -268,6 +263,8 @@ extern void actor_move(struct MapObj * mo) if (passable) { set_object_position(mo, target); + free(mo->fov_map); + mo->fov_map = build_fov_map(mo); } if (mo == get_player()) {