home
·
contact
·
privacy
projects
/
plomrogue
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Use bit shifting instead of magic number in rrand().
[plomrogue]
/
src
/
yx_uint16.c
1
/* yx_uint16.c */
2
3
4
5
#include "yx_uint16.h" /* for uint16_t */
6
7
8
9
extern char yx_uint16_cmp(struct yx_uint16 a, struct yx_uint16 b)
10
{
11
if (a.y == b.y && a.x == b.x)
12
return 1;
13
else
14
return 0;
15
}
16
17
18
19
extern struct yx_uint16 mv_yx_in_dir(enum dir d, struct yx_uint16 yx)
20
{
21
if (d == NORTH)
22
yx.y--;
23
else if (d == EAST)
24
yx.x++;
25
else if (d == SOUTH)
26
yx.y++;
27
else if (d == WEST)
28
yx.x--;
29
return yx;
30
}