X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=64cbcc25962907eaa5090d9caf8758dbc37ee8da;hb=3cab4c74ceb97d865c501a24352a35e944fc44ce;hp=d310511196e7dc177f044c9317972abea7ab0467;hpb=4b38930413ff066d2aa7a6ea9b06763251454119;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index d3105111..64cbcc25 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5392,6 +5392,24 @@ int map_element_EM_to_RND(int element_em) #endif +int map_direction_RND_to_EM(int direction) +{ + return (direction == MV_UP ? 0 : + direction == MV_RIGHT ? 1 : + direction == MV_DOWN ? 2 : + direction == MV_LEFT ? 3 : + -1); +} + +int map_direction_EM_to_RND(int direction) +{ + return (direction == 0 ? MV_UP : + direction == 1 ? MV_RIGHT : + direction == 2 ? MV_DOWN : + direction == 3 ? MV_LEFT : + MV_NONE); +} + int get_next_element(int element) { switch(element)