summaryrefslogtreecommitdiff
path: root/lib/input.c
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2015-03-31 16:20:39 -0300
committerRaúl Benencia <rul@kalgan.cc>2015-03-31 16:20:39 -0300
commitd8143db289b441562a69dcfa783d7d80c2f544c6 (patch)
tree928c22c4598a670019dbb1d31af687d59ba3ed27 /lib/input.c
parenta9b35e6086ff71e351b3861aa897777e278a4059 (diff)
input_move instead of coordinates. Introduce game_is_move_valid()
Diffstat (limited to 'lib/input.c')
-rw-r--r--lib/input.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/input.c b/lib/input.c
index 63df8c5..8b696e1 100644
--- a/lib/input.c
+++ b/lib/input.c
@@ -3,6 +3,7 @@
#include "coordinate.h"
#include "input.h"
+#include "move.h"
#define LENGTH 80
@@ -25,14 +26,21 @@ static Coord _input_coord() {
return coord_init(line);
}
-Coord input_orig_coord() {
+static Coord _input_orig_coord() {
printf("Orig coordinate: ");
return _input_coord();
}
-Coord input_dest_coord() {
+static Coord _input_dest_coord() {
printf("Dest coordinate: ");
return _input_coord();
}
+
+Move input_move() {
+ Coord orig = _input_orig_coord();
+ Coord dest = _input_dest_coord();
+
+ return move_init(orig, dest);
+}
nihil fit ex nihilo