From b346e948cb167c18efc33f32f0e7cfb21050fc96 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 24 Jan 2016 16:58:59 -0500 Subject: objects partially implemented, fixes some bugs --- src/client.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/client.c') diff --git a/src/client.c b/src/client.c index cbfe63b..fef7fab 100644 --- a/src/client.c +++ b/src/client.c @@ -71,7 +71,8 @@ void __attribute__((format(printf,1,2))) out(const char *fmt, ...) /* do some line wrapping */ - int pos = 0, last_space = 0; + static int pos = 0; + int last_space = 0; char *ptr = buf; uint16_t line_width = telnet_get_width() + 1; char *line_buf = malloc(line_width + 2); @@ -168,8 +169,6 @@ void send_master(unsigned char cmd, const void *data, size_t sz) while(!request_complete) poll_requests(); free(req); - - debugf("done with request\n"); } #define BUFSZ 128 @@ -362,7 +361,7 @@ void client_change_room(room_id id) void *dir_map = NULL; -void client_move(const char *dir) +bool client_move(const char *dir) { const struct dir_pair { const char *text; @@ -401,9 +400,16 @@ void client_move(const char *dir) if(pair) { send_master(REQ_MOVE, &pair->val, sizeof(pair->val)); + if(reqdata_type == TYPE_BOOLEAN && returned_reqdata.boolean) + return true; + else + return false; } else + { out("Unknown direction.\n"); + return false; + } } void client_look(void) @@ -695,8 +701,8 @@ auth: if(dir) { all_upper(dir); - client_move(dir); - client_look(); + if(client_move(dir)) + client_look(); } else out("Expected direction after GO.\n"); -- cgit v1.1