From dc1b7c0cc558c607973b07ce2da6489c53b66a9c Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Fri, 13 Oct 2023 12:07:29 -0400 Subject: [PATCH] Unify comms client/server help text Signed-off-by: Stephen M. Cameron --- help_text_comms_screen.txt | 5 +++++ snis_server.c | 40 ++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/help_text_comms_screen.txt b/help_text_comms_screen.txt index 3c9d0550..3fdc2c4a 100644 --- a/help_text_comms_screen.txt +++ b/help_text_comms_screen.txt @@ -14,5 +14,10 @@ " * /help\n" " * /channel channel-number - change current channel\n" " * /computer \n" + " * /eject cargo-bay-number - eject cargo\n" " * /hail ship-name - hail ship on current channel\n" + " * /inventory - report inventory of ship's cargo hold\n" + " * /passengers - report list of passengers\n" + " * /antenna - aim the high gain antenna\n" + " * /about - information about the game\n" ESC_OR_F1_HELP_TEXT, diff --git a/snis_server.c b/snis_server.c index 7151daac..9efd3a0b 100644 --- a/snis_server.c +++ b/snis_server.c @@ -15755,30 +15755,28 @@ typedef void (*meta_comms_func)(char *name, struct game_client *c, char *txt); static void meta_comms_help(__attribute__((unused)) char *name, struct game_client *c, __attribute__((unused)) char *txt) { - int i; + char buffer[256]; + int i, j; +#define ESC_OR_F1_HELP_TEXT +#define FKEYS_HELP_TEXT const char *hlptxt[] = { - "COMMUNICATIONS", - " CONTROLS", - " * ZOOM CONTROLS MAIN SCREEN ZOOM", - " * RED ALERT SOUNDS RED ALERT ALARM", - " * TOP ROW OF BUTTONS CONTROLS MAIN SCREEN", - " COMMANDS", - " * COMMANDS ARE PRECEDED BY FORWARD SLASH -> /", - " * /help", - " * /computer ", - " * /channel channel-number - change current channel", - " * /eject cargo-bay-number - eject cargo", - " * /hail ship-name - hail ship or starbase on current channel", - " * /inventory - report inventory of ship's cargo hold", - " * /passengers - report list of passengers", - " * /antenna - aim the high gain antenna", - " * /about - information about the game", - "", - 0, +#include "help_text_comms_screen.txt" }; - for (i = 0; hlptxt[i]; i++) - send_comms_packet(NULL, "", bridgelist[c->bridge].comms_channel, hlptxt[i]); + + for (i = 0, j = 0; 1; i++) { + buffer[j] = hlptxt[0][i]; + if (buffer[j] == '\n' || buffer[j] == '\0') { + buffer[j] = '\0'; + j = 0; + send_comms_packet(NULL, "", bridgelist[c->bridge].comms_channel, buffer); + } else { + j++; + } + if (hlptxt[0][i] == '\0') + break; + } } + static void meta_comms_about(__attribute__((unused)) char *name, struct game_client *c, __attribute__((unused)) char *txt)