clang-format .hpp files (#5307)

* Add hpp files to clang-format script

* clang-format hpp files
This commit is contained in:
Archez 2025-04-03 23:33:35 -04:00 committed by GitHub
parent 2deea6e105
commit f37c3aa228
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 1048 additions and 1058 deletions

View file

@ -37,7 +37,7 @@ if (-not (Test-Path $clangFormatFilePath) -or ($currentVersion -ne $requiredVers
$basePath = (Resolve-Path .).Path $basePath = (Resolve-Path .).Path
$files = Get-ChildItem -Path $basePath\soh -Recurse -File ` $files = Get-ChildItem -Path $basePath\soh -Recurse -File `
| Where-Object { ($_.Extension -eq '.c' -or $_.Extension -eq '.cpp' -or ` | Where-Object { ($_.Extension -eq '.c' -or $_.Extension -eq '.cpp' -or `
($_.Extension -eq '.h' -and ` (($_.Extension -eq '.h' -or $_.Extension -eq '.hpp') -and `
(-not ($_.FullName -like "*\soh\src\*" -or $_.FullName -like "*\soh\include\*")))) -and ` (-not ($_.FullName -like "*\soh\src\*" -or $_.FullName -like "*\soh\include\*")))) -and `
(-not ($_.FullName -like "*\soh\assets\*")) } (-not ($_.FullName -like "*\soh\assets\*")) }

View file

@ -10,8 +10,8 @@
# -name "*.c" -o -name "*.cpp" # -name "*.c" -o -name "*.cpp"
# find all .c and .cpp files # find all .c and .cpp files
# #
# -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" # ( -name "*.h" -o -name "*.hpp" ) ! -path "soh/src/**.h" ! -path "soh/include/**.h"
# find all .h files that aren't in soh/src or soh/include # find all .h and .hpp files that aren't in soh/src or soh/include
# this is because zret decomp only runs clang-format on c files # this is because zret decomp only runs clang-format on c files
# https://github.com/zeldaret/mm/blob/b7e5468ca16315a7e322055eff3d97fe980bbc25/format.py#L182 # https://github.com/zeldaret/mm/blob/b7e5468ca16315a7e322055eff3d97fe980bbc25/format.py#L182
# #
@ -26,4 +26,4 @@
# and pass it as an argument to clang-format # and pass it as an argument to clang-format
# verbose to print files being formatted and X out of Y status # verbose to print files being formatted and X out of Y status
find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" -print0 | xargs -0 clang-format-14 -i --verbose find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( \( -name "*.h" -o -name "*.hpp" \) ! -path "soh/src/*" ! -path "soh/include/*" \) \) ! -path "soh/assets/*" -print0 | xargs -0 clang-format-14 -i --verbose

View file

@ -6,28 +6,28 @@
#include "text.hpp" #include "text.hpp"
namespace CustomMessages { namespace CustomMessages {
std::string MESSAGE_END(); std::string MESSAGE_END();
std::string WAIT_FOR_INPUT(); std::string WAIT_FOR_INPUT();
std::string HORIZONTAL_SPACE(uint8_t x); std::string HORIZONTAL_SPACE(uint8_t x);
std::string GO_TO(uint16_t x); std::string GO_TO(uint16_t x);
std::string INSTANT_TEXT_ON(); std::string INSTANT_TEXT_ON();
std::string INSTANT_TEXT_OFF(); std::string INSTANT_TEXT_OFF();
std::string SHOP_MESSAGE_BOX(); std::string SHOP_MESSAGE_BOX();
std::string EVENT_TRIGGER(); std::string EVENT_TRIGGER();
std::string DELAY_FRAMES(uint8_t x); std::string DELAY_FRAMES(uint8_t x);
std::string CLOSE_AFTER(uint8_t x); std::string CLOSE_AFTER(uint8_t x);
std::string PLAYER_NAME(); std::string PLAYER_NAME();
std::string PLAY_OCARINA(); std::string PLAY_OCARINA();
std::string ITEM_OBTAINED(uint8_t x); std::string ITEM_OBTAINED(uint8_t x);
std::string SET_SPEED(uint8_t x); std::string SET_SPEED(uint8_t x);
std::string SKULLTULAS_DESTROYED(); std::string SKULLTULAS_DESTROYED();
std::string CURRENT_TIME(); std::string CURRENT_TIME();
std::string UNSKIPPABLE(); std::string UNSKIPPABLE();
std::string TWO_WAY_CHOICE(); std::string TWO_WAY_CHOICE();
std::string NEWLINE(); std::string NEWLINE();
std::string COLOR(std::string x); std::string COLOR(std::string x);
std::string CENTER_TEXT(); std::string CENTER_TEXT();
std::string IF_NOT_MQ(); std::string IF_NOT_MQ();
std::string MQ_ELSE(); std::string MQ_ELSE();
std::string MQ_END(); std::string MQ_END();
} } // namespace CustomMessages

View file

@ -7,52 +7,52 @@
#include <vector> #include <vector>
#include <string> #include <string>
//RANDOTODO merge into Logic once Logic is a class passed to logic funtions // RANDOTODO merge into Logic once Logic is a class passed to logic funtions
struct GetAccessibleLocationsStruct { struct GetAccessibleLocationsStruct {
std::vector<RandomizerCheck> accessibleLocations; std::vector<RandomizerCheck> accessibleLocations;
std::vector<RandomizerRegion> regionPool; std::vector<RandomizerRegion> regionPool;
//Variables for playthrough // Variables for playthrough
int gsCount; int gsCount;
int maxGsCount; int maxGsCount;
std::vector<LogicVal> buyIgnores; std::vector<LogicVal> buyIgnores;
//Variables for search // Variables for search
std::vector<Rando::ItemLocation*> newItemLocations; std::vector<Rando::ItemLocation*> newItemLocations;
bool logicUpdated; bool logicUpdated;
bool resetSphere; bool resetSphere;
//Variables For Validating Entrences // Variables For Validating Entrences
bool haveTimeAccess; bool haveTimeAccess;
bool foundTempleOfTime; bool foundTempleOfTime;
bool validatedStartingRegion; bool validatedStartingRegion;
bool sphereZeroComplete; bool sphereZeroComplete;
bool timePassChildDay; bool timePassChildDay;
bool timePassChildNight; bool timePassChildNight;
bool timePassAdultDay; bool timePassAdultDay;
bool timePassAdultNight; bool timePassAdultNight;
std::vector<RandomizerCheck> itemSphere; std::vector<RandomizerCheck> itemSphere;
std::list<Rando::Entrance*> entranceSphere; std::list<Rando::Entrance*> entranceSphere;
bool calculatingAvailableChecks = false; bool calculatingAvailableChecks = false;
GetAccessibleLocationsStruct(int _maxGsCount){ GetAccessibleLocationsStruct(int _maxGsCount) {
regionPool = {RR_ROOT}; regionPool = { RR_ROOT };
gsCount = 0; gsCount = 0;
maxGsCount = _maxGsCount; maxGsCount = _maxGsCount;
logicUpdated = false; logicUpdated = false;
resetSphere = false; resetSphere = false;
} }
void InitLoop(){ void InitLoop() {
logicUpdated = false; logicUpdated = false;
for (Rando::ItemLocation* location : newItemLocations) { for (Rando::ItemLocation* location : newItemLocations) {
location->ApplyPlacedItemEffect(); location->ApplyPlacedItemEffect();
}
newItemLocations.clear();
itemSphere.clear();
entranceSphere.clear();
} }
newItemLocations.clear();
itemSphere.clear();
entranceSphere.clear();
}
}; };
void ClearProgress(); void ClearProgress();
@ -64,10 +64,12 @@ std::vector<RandomizerCheck> GetEmptyLocations(std::vector<RandomizerCheck> allo
void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, RandomizerGet ignore = RG_NONE, void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, RandomizerGet ignore = RG_NONE,
bool stopOnBeatable = false, bool addToPlaythrough = false); bool stopOnBeatable = false, bool addToPlaythrough = false);
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& allowedLocations, RandomizerGet ignore=RG_NONE, bool calculatingAvailableChecks=false); std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& allowedLocations,
RandomizerGet ignore = RG_NONE,
bool calculatingAvailableChecks = false);
void GeneratePlaythrough(); void GeneratePlaythrough();
bool CheckBeatable(RandomizerGet ignore=RG_NONE); bool CheckBeatable(RandomizerGet ignore = RG_NONE);
void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess);

View file

@ -11,29 +11,30 @@
#include "../../custom-message/CustomMessageManager.h" #include "../../custom-message/CustomMessageManager.h"
struct HintDistributionSetting { struct HintDistributionSetting {
std::string name; std::string name;
HintType type; HintType type;
uint32_t weight; uint32_t weight;
uint8_t fixed; uint8_t fixed;
uint8_t copies; uint8_t copies;
std::function<bool(RandomizerCheck)> filter; std::function<bool(RandomizerCheck)> filter;
uint8_t dungeonLimit; uint8_t dungeonLimit;
HintDistributionSetting(std::string _name, HintType _type, uint32_t _weight, uint8_t _fixed, uint8_t _copies, HintDistributionSetting(std::string _name, HintType _type, uint32_t _weight, uint8_t _fixed, uint8_t _copies,
std::function<bool(RandomizerCheck)> _filter, uint8_t _dungeonLimit = 40); std::function<bool(RandomizerCheck)> _filter, uint8_t _dungeonLimit = 40);
}; };
struct HintSetting { struct HintSetting {
uint8_t alwaysCopies; uint8_t alwaysCopies;
uint8_t trialCopies; uint8_t trialCopies;
uint8_t junkWeight; uint8_t junkWeight;
std::vector<HintDistributionSetting> distTable; std::vector<HintDistributionSetting> distTable;
}; };
class HintText { class HintText {
public: public:
HintText() = default; HintText() = default;
HintText(CustomMessage clearText_, std::vector<CustomMessage> ambiguousText_ = {}, std::vector<CustomMessage> obscureText_ = {}); HintText(CustomMessage clearText_, std::vector<CustomMessage> ambiguousText_ = {},
std::vector<CustomMessage> obscureText_ = {});
const CustomMessage& GetClear() const; const CustomMessage& GetClear() const;
const CustomMessage& GetObscure() const; const CustomMessage& GetObscure() const;
const CustomMessage& GetObscure(uint8_t selection) const; const CustomMessage& GetObscure(uint8_t selection) const;
@ -46,27 +47,28 @@ public:
bool operator==(const HintText& right) const; bool operator==(const HintText& right) const;
bool operator!=(const HintText& right) const; bool operator!=(const HintText& right) const;
private: private:
CustomMessage clearText; CustomMessage clearText;
std::vector<CustomMessage> ambiguousText = {}; std::vector<CustomMessage> ambiguousText = {};
std::vector<CustomMessage> obscureText = {}; std::vector<CustomMessage> obscureText = {};
}; };
struct StaticHintInfo{ struct StaticHintInfo {
HintType type; HintType type;
std::vector<RandomizerHintTextKey> hintKeys; std::vector<RandomizerHintTextKey> hintKeys;
RandomizerSettingKey setting; RandomizerSettingKey setting;
std::variant<bool, uint8_t> condition; std::variant<bool, uint8_t> condition;
std::vector<RandomizerCheck> targetChecks; std::vector<RandomizerCheck> targetChecks;
std::vector<RandomizerGet> targetItems; std::vector<RandomizerGet> targetItems;
std::vector<RandomizerCheck> hintChecks; std::vector<RandomizerCheck> hintChecks;
bool yourPocket; bool yourPocket;
int num; int num;
StaticHintInfo() = default; StaticHintInfo() = default;
StaticHintInfo(HintType _type, std::vector<RandomizerHintTextKey> _hintKeys, RandomizerSettingKey _setting, std::variant<bool, uint8_t> _condition, StaticHintInfo(HintType _type, std::vector<RandomizerHintTextKey> _hintKeys, RandomizerSettingKey _setting,
std::vector<RandomizerCheck> _targetChecks, std::vector<RandomizerGet> _targetItems = {}, std::variant<bool, uint8_t> _condition, std::vector<RandomizerCheck> _targetChecks,
std::vector<RandomizerCheck> _hintChecks = {}, bool _yourPocket = false, int _num = 0); std::vector<RandomizerGet> _targetItems = {}, std::vector<RandomizerCheck> _hintChecks = {},
bool _yourPocket = false, int _num = 0);
}; };
RandomizerHintTextKey GetRandomJunkHint(); RandomizerHintTextKey GetRandomJunkHint();

View file

@ -13,4 +13,5 @@
#define DELETE_PRESET 6 #define DELETE_PRESET 6
#define RESET_TO_DEFAULTS 8 #define RESET_TO_DEFAULTS 8
bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks, std::string seedInput); bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
std::string seedInput);

View file

@ -4,6 +4,8 @@
#include "../context.h" #include "../context.h"
namespace Playthrough { namespace Playthrough {
int Playthrough_Init(uint32_t seed, std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks); int Playthrough_Init(uint32_t seed, std::set<RandomizerCheck> excludedLocations,
int Playthrough_Repeat(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks, int count = 1); std::set<RandomizerTrick> enabledTricks);
} int Playthrough_Repeat(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
int count = 1);
} // namespace Playthrough

View file

@ -5,38 +5,35 @@
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
template <typename T, typename Predicate> template <typename T, typename Predicate> static void erase_if(std::vector<T>& vector, Predicate pred) {
static void erase_if(std::vector<T>& vector, Predicate pred) { vector.erase(std::remove_if(begin(vector), end(vector), pred), end(vector));
vector.erase(std::remove_if(begin(vector), end(vector), pred), end(vector));
} }
template <typename T, typename Predicate> template <typename T, typename Predicate>
std::vector<T> FilterFromPool(std::vector<T>& vector, Predicate pred, bool eraseAfterFilter = false) { std::vector<T> FilterFromPool(std::vector<T>& vector, Predicate pred, bool eraseAfterFilter = false) {
std::vector<T> filteredPool = {}; std::vector<T> filteredPool = {};
std::copy_if(vector.begin(), vector.end(), std::back_inserter(filteredPool), pred); std::copy_if(vector.begin(), vector.end(), std::back_inserter(filteredPool), pred);
if (eraseAfterFilter) { if (eraseAfterFilter) {
erase_if(vector, pred); erase_if(vector, pred);
} }
return filteredPool; return filteredPool;
} }
template <typename T, typename Predicate> template <typename T, typename Predicate>
std::vector<T> FilterAndEraseFromPool(std::vector<T>& vector, Predicate pred) { std::vector<T> FilterAndEraseFromPool(std::vector<T>& vector, Predicate pred) {
return FilterFromPool(vector, pred, true); return FilterFromPool(vector, pred, true);
} }
template <typename T, typename FromPool> template <typename T, typename FromPool> void AddElementsToPool(std::vector<T>& toPool, const FromPool& fromPool) {
void AddElementsToPool(std::vector<T>& toPool, const FromPool& fromPool) { toPool.insert(toPool.end(), std::cbegin(fromPool), std::cend(fromPool));
toPool.insert(toPool.end(), std::cbegin(fromPool), std::cend(fromPool));
} }
template <typename T, typename Container> template <typename T, typename Container> bool ElementInContainer(T& element, const Container& container) {
bool ElementInContainer(T& element, const Container& container) { return std::find(container.begin(), container.end(), element) != container.end();
return std::find(container.begin(), container.end(), element) != container.end();
} }
template <typename First, typename... T> bool IsAnyOf(First&& first, T&&... t) { template <typename First, typename... T> bool IsAnyOf(First&& first, T&&... t) {
return ((first == t) || ...); return ((first == t) || ...);
} }

View file

@ -3,5 +3,6 @@
#include <set> #include <set>
namespace RandoMain { namespace RandoMain {
void GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks, std::string seedInput); void GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
std::string seedInput);
} }

View file

@ -11,9 +11,8 @@ void Random_Init(uint32_t seed);
uint32_t Random(int min, int max); uint32_t Random(int min, int max);
double RandomDouble(); double RandomDouble();
//Get a random element from a vector or array // Get a random element from a vector or array
template <typename T> template <typename T> T RandomElement(std::vector<T>& vector, bool erase) {
T RandomElement(std::vector<T>& vector, bool erase) {
const auto idx = Random(0, vector.size()); const auto idx = Random(0, vector.size());
const T selected = vector[idx]; const T selected = vector[idx];
if (erase) { if (erase) {
@ -21,17 +20,14 @@ T RandomElement(std::vector<T>& vector, bool erase) {
} }
return selected; return selected;
} }
template <typename Container> template <typename Container> auto& RandomElement(Container& container) {
auto& RandomElement(Container& container) {
return container[Random(0, std::size(container))]; return container[Random(0, std::size(container))];
} }
template <typename Container> template <typename Container> const auto& RandomElement(const Container& container) {
const auto& RandomElement(const Container& container) {
return container[Random(0, std::size(container))]; return container[Random(0, std::size(container))];
} }
template <typename T> template <typename T> const T RandomElementFromSet(const std::set<T>& set) {
const T RandomElementFromSet(const std::set<T>& set) {
if (set.size() == 1) { if (set.size() == 1) {
return *set.begin(); return *set.begin();
} }
@ -44,19 +40,15 @@ const T RandomElementFromSet(const std::set<T>& set) {
return *it; return *it;
} }
//Shuffle items within a vector or array // Shuffle items within a vector or array
//RANDOTODO There's probably a more efficient way to do what this does. // RANDOTODO There's probably a more efficient way to do what this does.
template <typename T> template <typename T> void Shuffle(std::vector<T>& vector) {
void Shuffle(std::vector<T>& vector) { for (std::size_t i = 0; i + 1 < vector.size(); i++) {
for (std::size_t i = 0; i + 1 < vector.size(); i++)
{
std::swap(vector[i], vector[Random(i, vector.size())]); std::swap(vector[i], vector[Random(i, vector.size())]);
} }
} }
template <typename T, std::size_t size> template <typename T, std::size_t size> void Shuffle(std::array<T, size>& arr) {
void Shuffle(std::array<T, size>& arr) { for (std::size_t i = 0; i + 1 < arr.size(); i++) {
for (std::size_t i = 0; i + 1 < arr.size(); i++)
{
std::swap(arr[i], arr[Random(i, arr.size())]); std::swap(arr[i], arr[Random(i, arr.size())]);
} }
} }

View file

@ -16,16 +16,10 @@ struct PriceSettingsStruct {
RandomizerSettingKey tycoonWallet; RandomizerSettingKey tycoonWallet;
RandomizerSettingKey affordable; RandomizerSettingKey affordable;
PriceSettingsStruct(RandomizerSettingKey _main, PriceSettingsStruct(RandomizerSettingKey _main, RandomizerSettingKey _fixedPrice, RandomizerSettingKey _range1,
RandomizerSettingKey _fixedPrice, RandomizerSettingKey _range2, RandomizerSettingKey _noWallet, RandomizerSettingKey _childWallet,
RandomizerSettingKey _range1, RandomizerSettingKey _adultWallet, RandomizerSettingKey _giantWallet,
RandomizerSettingKey _range2, RandomizerSettingKey _tycoonWallet, RandomizerSettingKey _affordable);
RandomizerSettingKey _noWallet,
RandomizerSettingKey _childWallet,
RandomizerSettingKey _adultWallet,
RandomizerSettingKey _giantWallet,
RandomizerSettingKey _tycoonWallet,
RandomizerSettingKey _affordable);
}; };
extern void PlaceVanillaShopItems(); extern void PlaceVanillaShopItems();
@ -34,5 +28,3 @@ extern uint16_t GetRandomPrice(Rando::Location* loc, PriceSettingsStruct priceSe
extern uint16_t GetCheapBalancedPrice(); extern uint16_t GetCheapBalancedPrice();
extern int GetShopsanityReplaceAmount(); extern int GetShopsanityReplaceAmount();
extern Text GetIceTrapName(uint8_t id); extern Text GetIceTrapName(uint8_t id);

View file

@ -7,22 +7,20 @@
#define SINGULAR 1 #define SINGULAR 1
class Text { class Text {
public: public:
Text() = default; Text() = default;
Text(std::string english_, std::string french_, std::string spanish_) Text(std::string english_, std::string french_, std::string spanish_)
: english(std::move(english_)), : english(std::move(english_)), french(std::move(french_)), spanish(std::move(spanish_)),
french(std::move(french_)), german(std::move("")) {
spanish(std::move(spanish_)), // german defaults to english text until a translation is provided.
german(std::move("")) { german = english;
// german defaults to english text until a translation is provided. }
german = english;
}
Text(std::string english_, std::string french_, std::string spanish_, std::string german_) Text(std::string english_, std::string french_, std::string spanish_, std::string german_)
: english(std::move(english_)), : english(std::move(english_)), french(std::move(french_)), spanish(std::move(spanish_)),
french(std::move(french_)), german(std::move(german_)) {
spanish(std::move(spanish_)), }
german(std::move(german_)) {} Text(std::string english_)
Text(std::string english_) : english(std::move(english_)), french(std::move("")), spanish(std::move("")), german(std::move("")) { : english(std::move(english_)), french(std::move("")), spanish(std::move("")), german(std::move("")) {
// default unprovided languages to english text // default unprovided languages to english text
french = spanish = german = english; french = spanish = german = english;
} }
@ -54,24 +52,24 @@ public:
const std::string& GetForLanguage(uint8_t language) const { const std::string& GetForLanguage(uint8_t language) const {
switch (language) { switch (language) {
case 0: //LANGUAGE_ENG: changed to resolve #include loops case 0: // LANGUAGE_ENG: changed to resolve #include loops
return GetEnglish(); return GetEnglish();
case 2: //LANGUAGE_FRA: case 2: // LANGUAGE_FRA:
return GetFrench(); return GetFrench();
case 1: //LANGUAGE_GER: case 1: // LANGUAGE_GER:
return GetGerman(); return GetGerman();
default: default:
return GetEnglish(); return GetEnglish();
} }
} }
Text operator+ (const Text& right) const { Text operator+(const Text& right) const {
return Text{english + right.GetEnglish(), french + right.GetFrench(), spanish + right.GetSpanish(), return Text{ english + right.GetEnglish(), french + right.GetFrench(), spanish + right.GetSpanish(),
german + right.GetGerman()}; german + right.GetGerman() };
} }
Text operator+ (const std::string& right) const { Text operator+(const std::string& right) const {
return Text{english + right, french + right, spanish + right, german + right}; return Text{ english + right, french + right, spanish + right, german + right };
} }
bool operator==(const Text& right) const { bool operator==(const Text& right) const {
@ -88,11 +86,11 @@ public:
void Replace(std::string oldStr, std::string newStr) { void Replace(std::string oldStr, std::string newStr) {
for (std::string* str : {&english, &french, &spanish, &german}) { for (std::string* str : { &english, &french, &spanish, &german }) {
size_t position = str->find(oldStr); size_t position = str->find(oldStr);
while (position != std::string::npos) { while (position != std::string::npos) {
str->replace(position, oldStr.length(), newStr); str->replace(position, oldStr.length(), newStr);
position = str->find(oldStr); position = str->find(oldStr);
} }
} }
} }
@ -123,15 +121,15 @@ public:
// Convert first char to upper case // Convert first char to upper case
Text Capitalize(void) const { Text Capitalize(void) const {
Text cap = *this + ""; Text cap = *this + "";
for (std::string* str : {&cap.english, &cap.french, &cap.spanish, &cap.german}) { for (std::string* str : { &cap.english, &cap.french, &cap.spanish, &cap.german }) {
(*str)[0] = std::toupper((*str)[0]); (*str)[0] = std::toupper((*str)[0]);
} }
return cap; return cap;
} }
//find the appropriate bars that separate singular from plural // find the appropriate bars that separate singular from plural
void SetForm(int form) { void SetForm(int form) {
for (std::string* str : {&english, &french, &spanish, &german}) { for (std::string* str : { &english, &french, &spanish, &german }) {
size_t firstBar = str->find('|'); size_t firstBar = str->find('|');
if (firstBar != std::string::npos) { if (firstBar != std::string::npos) {
@ -151,7 +149,7 @@ public:
} }
} }
} }
//remove the remaining bar // remove the remaining bar
this->Replace("|", ""); this->Replace("|", "");
} }

View file

@ -32,14 +32,15 @@
#include "SohModals.h" #include "SohModals.h"
namespace SohGui { namespace SohGui {
void SetupHooks(); void SetupHooks();
void SetupGuiElements(); void SetupGuiElements();
void Draw(); void Draw();
void Destroy(); void Destroy();
void RegisterPopup(std::string title, std::string message, std::string button1 = "OK", std::string button2 = "", std::function<void()> button1callback = nullptr, std::function<void()> button2callback = nullptr); void RegisterPopup(std::string title, std::string message, std::string button1 = "OK", std::string button2 = "",
void ShowRandomizerSettingsMenu(); std::function<void()> button1callback = nullptr, std::function<void()> button2callback = nullptr);
UIWidgets::Colors GetMenuThemeColor(); void ShowRandomizerSettingsMenu();
} UIWidgets::Colors GetMenuThemeColor();
} // namespace SohGui
#define THEME_COLOR SohGui::GetMenuThemeColor() #define THEME_COLOR SohGui::GetMenuThemeColor()

File diff suppressed because it is too large Load diff