shithub: choc

Download patch

ref: e88fdf26badf3a88ce30a0faa58e85758d42e315
parent: fab333edc567d814a20d4b318c5aaf46c2cb930b
parent: f523e59e1db0015b5e6e25da863c387f19841eea
author: Turo Lamminen <turol@users.noreply.github.com>
date: Mon Apr 27 15:37:24 EDT 2020

Merge pull request #1274 from turol/const

doom: Refactor chat macro defaults for const correctness

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -321,6 +321,22 @@
 // Add configuration file variable bindings.
 //
 
+
+static const char * const chat_macro_defaults[10] =
+{
+    HUSTR_CHATMACRO0,
+    HUSTR_CHATMACRO1,
+    HUSTR_CHATMACRO2,
+    HUSTR_CHATMACRO3,
+    HUSTR_CHATMACRO4,
+    HUSTR_CHATMACRO5,
+    HUSTR_CHATMACRO6,
+    HUSTR_CHATMACRO7,
+    HUSTR_CHATMACRO8,
+    HUSTR_CHATMACRO9
+};
+
+
 void D_BindVariables(void)
 {
     int i;
@@ -363,6 +379,7 @@
     {
         char buf[12];
 
+        chat_macros[i] = M_StringDuplicate(chat_macro_defaults[i]);
         M_snprintf(buf, sizeof(buf), "chatmacro%i", i);
         M_BindStringVariable(buf, &chat_macros[i]);
     }
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -63,19 +63,7 @@
 
 
 
-char *chat_macros[10] =
-{
-    HUSTR_CHATMACRO0,
-    HUSTR_CHATMACRO1,
-    HUSTR_CHATMACRO2,
-    HUSTR_CHATMACRO3,
-    HUSTR_CHATMACRO4,
-    HUSTR_CHATMACRO5,
-    HUSTR_CHATMACRO6,
-    HUSTR_CHATMACRO7,
-    HUSTR_CHATMACRO8,
-    HUSTR_CHATMACRO9
-};
+char *chat_macros[10];
 
 const char *player_names[] =
 {