summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-07 22:23:40 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-07 22:23:40 +0200
commitc88c7c7c6e6c687c3d8170cb07a467aa3c4d7f48 (patch)
treee44072afb5a63158df60ff139958364096c09618 /client
parent377a6b80fb766995566bd77047eef08e0a4b5aae (diff)
`make format`
Diffstat (limited to 'client')
-rw-r--r--client/commands.c2
-rw-r--r--client/main.c4
-rw-r--r--client/strings.c2
-rw-r--r--client/ui_errcatch.c2
-rw-r--r--client/ui_modes.c7
-rw-r--r--client/ui_orders.c46
-rw-r--r--client/ui_tabbar.c18
7 files changed, 37 insertions, 44 deletions
diff --git a/client/commands.c b/client/commands.c
index 05b92d9..d2e53c8 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -50,7 +50,7 @@ void w2_send_mode(w2_e_mode mode) {
W2_CREATE_MSG_BIN(w2_s_cmd_sres_rx, msg, msg_bin);
msg->opcode = W2_CMD_SRES | W2_CMDDIR_RX;
- msg->type = W2_CMD_SRES_RX_TYPE_PREVMODE;
+ msg->type = W2_CMD_SRES_RX_TYPE_PREVMODE;
w2_send_bin(msg_bin);
free(msg_bin);
diff --git a/client/main.c b/client/main.c
index dcbc16a..4d7f484 100644
--- a/client/main.c
+++ b/client/main.c
@@ -9,8 +9,8 @@
w2_s_client_state g_w2_state = {
.ping_received = true,
- .map_height = W2_MAP_DEFAULT_HEIGHT,
- .map_width = W2_MAP_DEFAULT_WIDTH,
+ .map_height = W2_MAP_DEFAULT_HEIGHT,
+ .map_width = W2_MAP_DEFAULT_WIDTH,
};
int main(int argc, char **argv) {
diff --git a/client/strings.c b/client/strings.c
index 8d63fcb..1354653 100644
--- a/client/strings.c
+++ b/client/strings.c
@@ -22,7 +22,7 @@ void w2_strings_tabs_init() {
g_w2_tab_strings[W2_UI_TAB_ERRCATCH] = W2_UI_TAB_LABEL_ERRCATCH;
g_w2_tab_strings[W2_UI_TAB_DIRC] = W2_UI_TAB_LABEL_DIRC;
g_w2_tab_strings[W2_UI_TAB_ORDERS] = W2_UI_TAB_LABEL_ORDERS;
- g_w2_tab_strings[W2_UI_TAB_MODES] = W2_UI_TAB_LABEL_MODES;
+ g_w2_tab_strings[W2_UI_TAB_MODES] = W2_UI_TAB_LABEL_MODES;
}
void w2_strings_errors_types() {
diff --git a/client/ui_errcatch.c b/client/ui_errcatch.c
index c25f787..5d5365f 100644
--- a/client/ui_errcatch.c
+++ b/client/ui_errcatch.c
@@ -1,11 +1,11 @@
#include <stdlib.h>
#include <string.h>
+#include "../shared/util.h"
#include "errcatch.h"
#include "i18n.h"
#include "strings.h"
#include "ui.h"
-#include "../shared/util.h"
unsigned int g_w2_errcatch_log_line = 0;
diff --git a/client/ui_modes.c b/client/ui_modes.c
index 829f807..3048ba9 100644
--- a/client/ui_modes.c
+++ b/client/ui_modes.c
@@ -1,6 +1,6 @@
#include "commands.h"
-#include "ui.h"
#include "i18n.h"
+#include "ui.h"
void w2_ui_onkey_modes(int ch) {
if (ch == '1') w2_send_mode(W2_M_MAZE);
@@ -13,7 +13,4 @@ void w2_ui_onkey_modes(int ch) {
if (ch == '0') w2_send_mode(W2_M_PREV);
}
-void w2_ui_tab_modes(bool first) {
- w2_wmvaddstr(g_w2_ui_pad_body, 0, 0, W2_UI_MODES_INFO);
-}
-
+void w2_ui_tab_modes(bool first) { w2_wmvaddstr(g_w2_ui_pad_body, 0, 0, W2_UI_MODES_INFO); }
diff --git a/client/ui_orders.c b/client/ui_orders.c
index 4951ba6..6c5de27 100644
--- a/client/ui_orders.c
+++ b/client/ui_orders.c
@@ -1,36 +1,32 @@
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <stdint.h>
-#include "ui.h"
-#include "errcatch.h"
-#include "../shared/util.h"
#include "../shared/bin.h"
#include "../shared/protocol.h"
-#include "i18n.h"
+#include "../shared/util.h"
#include "commands.h"
+#include "errcatch.h"
+#include "i18n.h"
#include "main.h"
+#include "ui.h"
#define W2_IS_CMD(cmd) strncmp(g_w2_command_buffer, cmd, sizeof(cmd) - 1) == 0
-#define W2_UI_ORDERS_PRINT_CONST(text) \
- w2_wmvaddstr(g_w2_ui_pad_body, g_w2_order_line, 0, text); \
+#define W2_UI_ORDERS_PRINT_CONST(text) \
+ w2_wmvaddstr(g_w2_ui_pad_body, g_w2_order_line, 0, text); \
g_w2_order_line += w2_newline_count(text, sizeof(text));
-char g_w2_command_buffer[W2_UI_ORDER_CMD_BUFFER_SIZE] = { 0x00 };
-int g_w2_command_buffer_index = 0;
-int g_w2_order_line = 0;
-bool g_w2_order_recording = false;
-bool g_w2_order_saved = false;
-uint16_t g_w2_order_buffer[W2_UI_ORDER_BUFFER_SIZE] = { 0 };
-int g_w2_order_buffer_index = 0;
+char g_w2_command_buffer[W2_UI_ORDER_CMD_BUFFER_SIZE] = {0x00};
+int g_w2_command_buffer_index = 0;
+int g_w2_order_line = 0;
+bool g_w2_order_recording = false;
+bool g_w2_order_saved = false;
+uint16_t g_w2_order_buffer[W2_UI_ORDER_BUFFER_SIZE] = {0};
+int g_w2_order_buffer_index = 0;
-void w2_ui_orders_cmd_error() {
- W2_UI_ORDERS_PRINT_CONST(W2_UI_ORDER_MSG_ERROR);
-}
+void w2_ui_orders_cmd_error() { W2_UI_ORDERS_PRINT_CONST(W2_UI_ORDER_MSG_ERROR); }
-void w2_ui_orders_cmd_help() {
- W2_UI_ORDERS_PRINT_CONST(W2_UI_ORDER_MSG_HELP);
-}
+void w2_ui_orders_cmd_help() { W2_UI_ORDERS_PRINT_CONST(W2_UI_ORDER_MSG_HELP); }
void w2_ui_orders_cmd_start() {
if (g_w2_order_recording) {
@@ -60,7 +56,7 @@ void w2_ui_orders_cmd_done() {
} else {
W2_UI_ORDERS_PRINT_CONST(W2_UI_ORDER_MSG_ORDER_DONE_ERR);
}
- g_w2_order_saved = true;
+ g_w2_order_saved = true;
g_w2_order_recording = false;
}
@@ -69,7 +65,7 @@ void w2_ui_orders_cmd_send() {
W2_CREATE_MSG_BIN(w2_s_cmd_bomd_rx, msg, bin);
msg->position = w2_bin_hton16(g_w2_order_buffer[i]);
- msg->id = rand();
+ msg->id = rand();
w2_send_bin(bin);
free(bin);
@@ -91,9 +87,10 @@ void w2_ui_onkey_orders(int ch) {
if (ch >= 'A' && ch <= 'Z') ch += 0x20; // convert uppercase to lowercase
if ((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || (ch == ' ')) {
g_w2_command_buffer[g_w2_command_buffer_index] = ch;
- g_w2_command_buffer_index = W2_MIN(g_w2_command_buffer_index + 1, W2_UI_ORDER_CMD_BUFFER_SIZE - 1);
+ g_w2_command_buffer_index =
+ W2_MIN(g_w2_command_buffer_index + 1, W2_UI_ORDER_CMD_BUFFER_SIZE - 1);
} else if (ch == KEY_BACKSPACE) {
- g_w2_command_buffer_index = W2_MAX(g_w2_command_buffer_index - 1, 0);
+ g_w2_command_buffer_index = W2_MAX(g_w2_command_buffer_index - 1, 0);
g_w2_command_buffer[g_w2_command_buffer_index] = 0x00;
} else if (ch == 0x0a) {
// clear cursor
@@ -113,4 +110,3 @@ void w2_ui_tab_orders(bool first) {
sprintf(temp, "> %s_ ", g_w2_command_buffer);
w2_wmvaddstr(g_w2_ui_pad_body, g_w2_order_line, 0, temp);
}
-
diff --git a/client/ui_tabbar.c b/client/ui_tabbar.c
index 1baf559..637d2f3 100644
--- a/client/ui_tabbar.c
+++ b/client/ui_tabbar.c
@@ -10,15 +10,15 @@ void (*g_w2_tab_ptrs[W2_UI_TAB_COUNT])(bool first);
void (*g_w2_keyhndl_ptrs[W2_UI_TAB_COUNT])(int key);
void w2_ui_tabbar_init() {
- g_w2_tab_ptrs[W2_UI_TAB_START] = &w2_ui_tab_start;
- g_w2_tab_ptrs[W2_UI_TAB_ERRCATCH] = &w2_ui_tab_errcatch;
- g_w2_keyhndl_ptrs[W2_UI_TAB_START] = &w2_ui_onkey_errcatch;
- g_w2_tab_ptrs[W2_UI_TAB_DIRC] = &w2_ui_tab_dirc;
- g_w2_keyhndl_ptrs[W2_UI_TAB_DIRC] = &w2_ui_onkey_dirc;
- g_w2_tab_ptrs[W2_UI_TAB_ORDERS] = &w2_ui_tab_orders;
- g_w2_keyhndl_ptrs[W2_UI_TAB_ORDERS] = &w2_ui_onkey_orders;
- g_w2_tab_ptrs[W2_UI_TAB_MODES] = &w2_ui_tab_modes;
- g_w2_keyhndl_ptrs[W2_UI_TAB_MODES] = &w2_ui_onkey_modes;
+ g_w2_tab_ptrs[W2_UI_TAB_START] = &w2_ui_tab_start;
+ g_w2_tab_ptrs[W2_UI_TAB_ERRCATCH] = &w2_ui_tab_errcatch;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_START] = &w2_ui_onkey_errcatch;
+ g_w2_tab_ptrs[W2_UI_TAB_DIRC] = &w2_ui_tab_dirc;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_DIRC] = &w2_ui_onkey_dirc;
+ g_w2_tab_ptrs[W2_UI_TAB_ORDERS] = &w2_ui_tab_orders;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_ORDERS] = &w2_ui_onkey_orders;
+ g_w2_tab_ptrs[W2_UI_TAB_MODES] = &w2_ui_tab_modes;
+ g_w2_keyhndl_ptrs[W2_UI_TAB_MODES] = &w2_ui_onkey_modes;
}
void w2_ui_paint_tabbar() {