diff options
| author | Franklin Wei <git@fwei.tk> | 2016-01-24 16:58:59 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2016-01-24 16:58:59 -0500 |
| commit | b346e948cb167c18efc33f32f0e7cfb21050fc96 (patch) | |
| tree | 2a6989023690021c15999ce8fc3fefdca3ab7d83 /src/client.c | |
| parent | e2c2a9878a0fb55923fbd77db1f73085013aa36c (diff) | |
| download | netcosm-b346e948cb167c18efc33f32f0e7cfb21050fc96.zip netcosm-b346e948cb167c18efc33f32f0e7cfb21050fc96.tar.gz netcosm-b346e948cb167c18efc33f32f0e7cfb21050fc96.tar.bz2 netcosm-b346e948cb167c18efc33f32f0e7cfb21050fc96.tar.xz | |
objects partially implemented, fixes some bugs
Diffstat (limited to 'src/client.c')
| -rw-r--r-- | src/client.c | 18 |
1 files changed, 12 insertions, 6 deletions
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"); |