home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f222ace
)
Make map_scroll() use new direction macros and slightly re-styled its code.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 23 Jun 2013 22:57:07 +0000
(
00:57
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 23 Jun 2013 22:57:07 +0000
(
00:57
+0200)
src/roguelike.c
patch
|
blob
|
history
diff --git
a/src/roguelike.c
b/src/roguelike.c
index 058ed07809bbfdec6e52fbbace0fe48fbf48b53b..c2e3c4cbb4da4c5cfc3ff006cf810ebd14090d9f 100644
(file)
--- a/
src/roguelike.c
+++ b/
src/roguelike.c
@@
-188,14
+188,10
@@
void growshrink_active_window (struct WinMeta * win_meta, char change) {
void map_scroll (struct Map * map, char dir) {
// Scroll map into direction dir if possible by changing the offset.
void map_scroll (struct Map * map, char dir) {
// Scroll map into direction dir if possible by changing the offset.
- if ('n' == dir && map->offset_y > 0)
- map->offset_y--;
- else if ('s' == dir)
- map->offset_y++;
- else if ('w' == dir && map->offset_x > 0)
- map->offset_x--;
- else if ('e' == dir)
- map->offset_x++; }
+ if (NORTH == dir && map->offset_y > 0) map->offset_y--;
+ else if (SOUTH == dir) map->offset_y++;
+ else if (WEST == dir && map->offset_x > 0) map->offset_x--;
+ else if (EAST == dir) map->offset_x++; }
unsigned char meta_keys(int key, struct World * world, struct WinMeta * win_meta, struct Win * win_keys,
struct Win * win_map, struct Win * win_info, struct Win * win_log) {
unsigned char meta_keys(int key, struct World * world, struct WinMeta * win_meta, struct Win * win_keys,
struct Win * win_map, struct Win * win_info, struct Win * win_log) {
@@
-239,13
+235,13
@@
unsigned char meta_keys(int key, struct World * world, struct WinMeta * win_meta
else if (key == get_action_key(world->keybindings, "keys mod"))
keyswin_mod_key (world, win_meta);
else if (key == get_action_key(world->keybindings, "map up"))
else if (key == get_action_key(world->keybindings, "keys mod"))
keyswin_mod_key (world, win_meta);
else if (key == get_action_key(world->keybindings, "map up"))
- map_scroll (world->map,
'n'
);
+ map_scroll (world->map,
NORTH
);
else if (key == get_action_key(world->keybindings, "map down"))
else if (key == get_action_key(world->keybindings, "map down"))
- map_scroll (world->map,
's'
);
+ map_scroll (world->map,
SOUTH
);
else if (key == get_action_key(world->keybindings, "map right"))
else if (key == get_action_key(world->keybindings, "map right"))
- map_scroll (world->map,
'e'
);
+ map_scroll (world->map,
EAST
);
else if (key == get_action_key(world->keybindings, "map left"))
else if (key == get_action_key(world->keybindings, "map left"))
- map_scroll (world->map,
'w'
);
+ map_scroll (world->map,
WEST
);
return 0; }
int main (int argc, char *argv[]) {
return 0; }
int main (int argc, char *argv[]) {