From bcad7c994b3018bb3484805b04f7fcdac5687615 Mon Sep 17 00:00:00 2001 From: Nico <122193236+Nico8340@users.noreply.github.com> Date: Wed, 30 Oct 2024 05:33:43 +0100 Subject: [PATCH 1/4] Modify to remove trailing commas from arrays --- Client/core/CNickGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/core/CNickGen.cpp b/Client/core/CNickGen.cpp index a4cb2738e2f..fe6254c1198 100644 --- a/Client/core/CNickGen.cpp +++ b/Client/core/CNickGen.cpp @@ -106,7 +106,7 @@ const char* const CNickGen::m_szAdjectives[] = { "Warm", "Wary", "Wasteful", "Watery", "Weak", "Wealthy", "Weary", "Well-made", "Well-off", "Well-to-do", "Wet", "Whimsical", "Whispering", "White", "Whole", "Wholesale", "Wicked", "Wide", "Wide-eyed", "Wiggly", "Wild", "Willing", "Windy", "Wiry", "Wise", "Wistful", "Witty", "Woebegone", "Womanly", "Wonderful", "Wooden", "Woozy", "Workable", - "Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry", + "Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry" }; const char* const CNickGen::m_szNouns[] = { @@ -193,7 +193,7 @@ const char* const CNickGen::m_szNouns[] = { "Crook", "Hijacker", "Carjacker", "Villain", "Convict", "Fugitive", "Mug", "Outlaw", "Ruffian", "Cutthroat", "Devil", "Murderer", "Psycho", "Punk", "ASBO", "Offender", "Drifter", "Rioter", "Goon", "Roughneck", "Brute", "Hacker", "Cabbie", "Wheeler", "Driver", "Rider", "Cyclist", "Cowboy", "Operative", "Carrier", "Transporter", "Trucker", "Wheelman", - "Vampire", "Parasite", "Tramp", "Bum", "Hobo", "Hitchhiker", "Deadbeat", "Acrobat", + "Vampire", "Parasite", "Tramp", "Bum", "Hobo", "Hitchhiker", "Deadbeat", "Acrobat" }; SString CNickGen::GetRandomNickname() From 7f6a513c2f8828939db8e77ac9cda820b315c4fe Mon Sep 17 00:00:00 2001 From: Nico <122193236+Nico8340@users.noreply.github.com> Date: Wed, 30 Oct 2024 05:34:23 +0100 Subject: [PATCH 2/4] Modify the number of adjectives and nouns Modifies the hardcoded numbers that determine the length of the arrays and leads to names containing a null value --- Client/core/CNickGen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/core/CNickGen.h b/Client/core/CNickGen.h index b98254f01b5..76adce26c97 100644 --- a/Client/core/CNickGen.h +++ b/Client/core/CNickGen.h @@ -9,8 +9,8 @@ #pragma once -#define NICKGEN_NUM_ADJECTIVES 1048 -#define NICKGEN_NUM_NOUNS 934 +#define NICKGEN_NUM_ADJECTIVES 1040 +#define NICKGEN_NUM_NOUNS 921 class CNickGen { From a416613ac2197057c0527225a5b0aec21dc295a5 Mon Sep 17 00:00:00 2001 From: Nico <122193236+Nico8340@users.noreply.github.com> Date: Wed, 30 Oct 2024 20:45:48 +0100 Subject: [PATCH 3/4] Requested changes --- Client/core/CNickGen.cpp | 8 ++++---- Client/core/CNickGen.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Client/core/CNickGen.cpp b/Client/core/CNickGen.cpp index fe6254c1198..e7ee1bce601 100644 --- a/Client/core/CNickGen.cpp +++ b/Client/core/CNickGen.cpp @@ -11,7 +11,7 @@ #include "time.h" // These words are of a maximum length of 10 characters, capitalized, and stripped of whitespace -const char* const CNickGen::m_szAdjectives[] = { +const std::array m_szAdjectives = { "Aback", "Abaft", "Abandoned", "Abashed", "Aberrant", "Abhorrent", "Abiding", "Abject", "Ablaze", "Able", "Abnormal", "Aboard", "Aboriginal", "Abortive", "Abounding", "Abrasive", "Abrupt", "Absent", "Absorbed", "Absorbing", "Abstracted", "Absurd", "Abundant", "Abusive", "Acceptable", "Accessible", "Accidental", "Accurate", "Acid", "Acidic", "Acoustic", "Acrid", "Actually", @@ -106,10 +106,10 @@ const char* const CNickGen::m_szAdjectives[] = { "Warm", "Wary", "Wasteful", "Watery", "Weak", "Wealthy", "Weary", "Well-made", "Well-off", "Well-to-do", "Wet", "Whimsical", "Whispering", "White", "Whole", "Wholesale", "Wicked", "Wide", "Wide-eyed", "Wiggly", "Wild", "Willing", "Windy", "Wiry", "Wise", "Wistful", "Witty", "Woebegone", "Womanly", "Wonderful", "Wooden", "Woozy", "Workable", - "Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry" + "Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry", }; -const char* const CNickGen::m_szNouns[] = { +const std::array m_szNouns = { "Aardvark", "Buffalo", "Alligator", "Ant", "Anteater", "Antelope", "Ape", "Armadillo", "Donkey", "Baboon", "Badger", "Barracuda", "Bat", "Bear", "Beaver", "Bee", "Bison", "Boar", "Bush", "Butterfly", "Camel", "Calf", "Cat", "Kitten", "Cattle", "Chamois", "Cheetah", "Chicken", "Chick", "Chimpanzee", "Infant", "Empress", "Troop", @@ -193,7 +193,7 @@ const char* const CNickGen::m_szNouns[] = { "Crook", "Hijacker", "Carjacker", "Villain", "Convict", "Fugitive", "Mug", "Outlaw", "Ruffian", "Cutthroat", "Devil", "Murderer", "Psycho", "Punk", "ASBO", "Offender", "Drifter", "Rioter", "Goon", "Roughneck", "Brute", "Hacker", "Cabbie", "Wheeler", "Driver", "Rider", "Cyclist", "Cowboy", "Operative", "Carrier", "Transporter", "Trucker", "Wheelman", - "Vampire", "Parasite", "Tramp", "Bum", "Hobo", "Hitchhiker", "Deadbeat", "Acrobat" + "Vampire", "Parasite", "Tramp", "Bum", "Hobo", "Hitchhiker", "Deadbeat", "Acrobat", }; SString CNickGen::GetRandomNickname() diff --git a/Client/core/CNickGen.h b/Client/core/CNickGen.h index 76adce26c97..38017e6db3f 100644 --- a/Client/core/CNickGen.h +++ b/Client/core/CNickGen.h @@ -15,7 +15,7 @@ class CNickGen { public: - static const char* const m_szAdjectives[NICKGEN_NUM_ADJECTIVES]; - static const char* const m_szNouns[NICKGEN_NUM_NOUNS]; + static const std::array m_szAdjectives; + static const std::array m_szNouns; static SString GetRandomNickname(); }; From 1d705df47e62c89c0efdfaa47b852fcb5edc106b Mon Sep 17 00:00:00 2001 From: Nico <122193236+Nico8340@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:30:01 +0100 Subject: [PATCH 4/4] Resolve errors Resolve linker errors for CNickGen static members and add missing array include --- Client/core/CNickGen.cpp | 4 ++-- Client/core/CNickGen.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Client/core/CNickGen.cpp b/Client/core/CNickGen.cpp index e7ee1bce601..8e1eb45a004 100644 --- a/Client/core/CNickGen.cpp +++ b/Client/core/CNickGen.cpp @@ -11,7 +11,7 @@ #include "time.h" // These words are of a maximum length of 10 characters, capitalized, and stripped of whitespace -const std::array m_szAdjectives = { +const std::array CNickGen::m_szAdjectives = { "Aback", "Abaft", "Abandoned", "Abashed", "Aberrant", "Abhorrent", "Abiding", "Abject", "Ablaze", "Able", "Abnormal", "Aboard", "Aboriginal", "Abortive", "Abounding", "Abrasive", "Abrupt", "Absent", "Absorbed", "Absorbing", "Abstracted", "Absurd", "Abundant", "Abusive", "Acceptable", "Accessible", "Accidental", "Accurate", "Acid", "Acidic", "Acoustic", "Acrid", "Actually", @@ -109,7 +109,7 @@ const std::array m_szAdjectives = { "Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry", }; -const std::array m_szNouns = { +const std::array CNickGen::m_szNouns = { "Aardvark", "Buffalo", "Alligator", "Ant", "Anteater", "Antelope", "Ape", "Armadillo", "Donkey", "Baboon", "Badger", "Barracuda", "Bat", "Bear", "Beaver", "Bee", "Bison", "Boar", "Bush", "Butterfly", "Camel", "Calf", "Cat", "Kitten", "Cattle", "Chamois", "Cheetah", "Chicken", "Chick", "Chimpanzee", "Infant", "Empress", "Troop", diff --git a/Client/core/CNickGen.h b/Client/core/CNickGen.h index 38017e6db3f..b11535efc51 100644 --- a/Client/core/CNickGen.h +++ b/Client/core/CNickGen.h @@ -8,6 +8,7 @@ *****************************************************************************/ #pragma once +#include #define NICKGEN_NUM_ADJECTIVES 1040 #define NICKGEN_NUM_NOUNS 921