From: Christian Heller Date: Sat, 6 Sep 2014 01:29:36 +0000 (+0200) Subject: Server: Minor optimization of mv_yx_in_dir_legal(). X-Git-Tag: tce~635 X-Git-Url: https://plomlompom.com/repos/te"st.html?a=commitdiff_plain;h=0720a8a7ee586548b096674c61cd8ae3067e508e;p=plomrogue Server: Minor optimization of mv_yx_in_dir_legal(). --- diff --git a/src/server/map.c b/src/server/map.c index a5a189d..807083d 100644 --- a/src/server/map.c +++ b/src/server/map.c @@ -3,7 +3,6 @@ #include "map.h" #include /* uint8_t, int8_t, uint16_t, uint32_t, (U)INT*_(MIN|MAX) */ #include /* free() */ -#include /* strchr() */ #include "../common/rexit.h" /* exit_err() */ #include "../common/try_malloc.h" /* try_malloc() */ #include "../common/yx_uint8.h" /* yx_uint8 */ @@ -205,19 +204,19 @@ extern uint8_t mv_yx_in_dir_legal(char dir, struct yx_uint8 * yx) original.y = yx->y; original.x = yx->x; mv_yx_in_dir(dir, yx); - if (strchr("edc", dir) && yx->x < original.x) + if (('e' == dir || 'd' == dir || 'c' == dir) && yx->x < original.x) { wrap_west_east++; } - else if (strchr("xsw", dir) && yx->x > original.x) + else if (('x' == dir || 's' == dir || 'w' == dir) && yx->x > original.x) { wrap_west_east--; } - if (strchr("we", dir) && yx->y > original.y) + if (('w' == dir || 'e' == dir) && yx->y > original.y) { wrap_north_south--; } - else if (strchr("xc", dir) && yx->y < original.y) + else if (('x' == dir || 'c' == dir) && yx->y < original.y) { wrap_north_south++; }