From b3bb6e4031db5d7da4ea107f46ee9c2ec481949f Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Sat, 15 Apr 2023 16:30:06 -0700 Subject: [PATCH] Converts from wstring to regular string. Cleans up empty test suites to return no tests instead of a single pass. --- sbf-cpp/Archetypes.h | 68 +++++++++++++-------------- sbf-cpp/Attributes.h | 90 ++++++++++++++++++------------------ sbf-cpp/Attributes_test.cpp | 2 +- sbf-cpp/Backgrounds.h | 28 +++++------ sbf-cpp/Backgrounds_test.cpp | 2 +- sbf-cpp/Character.cpp | 66 +++++++------------------- sbf-cpp/Character.h | 16 +++---- sbf-cpp/Character_test.cpp | 2 +- sbf-cpp/Clans.h | 44 +++++++++--------- sbf-cpp/Clans_test.cpp | 2 +- sbf-cpp/Derangements.h | 54 +++++++++++----------- sbf-cpp/Disciplines.h | 56 +++++++++++----------- sbf-cpp/Genders.h | 18 ++++---- sbf-cpp/Menus.cpp | 16 +++---- sbf-cpp/Menus.h | 28 +++++------ sbf-cpp/Ranks.h | 10 ++-- sbf-cpp/Utils.cpp | 32 ++++++------- sbf-cpp/Utils.h | 14 +++--- sbf-cpp/Virtues.h | 14 +++--- sbf-cpp/main.cpp | 8 ++-- sbf-cpp/sbf.cpp | 78 +++++++++++++++---------------- sbf-cpp/sbf.h | 2 +- 22 files changed, 308 insertions(+), 342 deletions(-) diff --git a/sbf-cpp/Archetypes.h b/sbf-cpp/Archetypes.h index a95bb8f..e4b741c 100644 --- a/sbf-cpp/Archetypes.h +++ b/sbf-cpp/Archetypes.h @@ -5,68 +5,68 @@ namespace SBF { const int kArchetypeArchitectId = 1; - const std::wstring kArchetypeArchitectLabel = L"Architect"; + const std::string kArchetypeArchitectLabel = "Architect"; const int kArchetypeAutocratId = 2; - const std::wstring kArchetypeAutocratLabel = L"Autocrat"; + const std::string kArchetypeAutocratLabel = "Autocrat"; const int kArchetypeBarbarianId = 3; - const std::wstring kArchetypeBarbarianLabel = L"Barbarian"; + const std::string kArchetypeBarbarianLabel = "Barbarian"; const int kArchetypeBonVivantId = 4; - const std::wstring kArchetypeBonVivantLabel = L"Bon Vivant"; + const std::string kArchetypeBonVivantLabel = "Bon Vivant"; const int kArchetypeBravoId = 5; - const std::wstring kArchetypeBravoLabel = L"Bravo"; + const std::string kArchetypeBravoLabel = "Bravo"; const int kArchetypeCaregiverId = 6; - const std::wstring kArchetypeCaregiverLabel = L"Caregiver"; + const std::string kArchetypeCaregiverLabel = "Caregiver"; const int kArchetypeCaretakerId = 7; - const std::wstring kArchetypeCaretakerLabel = L"Caretaker"; + const std::string kArchetypeCaretakerLabel = "Caretaker"; const int kArchetypeCelebrantId = 8; - const std::wstring kArchetypeCelebrantLabel = L"Celebrant"; + const std::string kArchetypeCelebrantLabel = "Celebrant"; const int kArchetypeChildId = 9; - const std::wstring kArchetypeChildLabel = L"Child"; + const std::string kArchetypeChildLabel = "Child"; const int kArchetypeConformist = 10; - const std::wstring kArchetypeConformistLabel = L"Conformist"; + const std::string kArchetypeConformistLabel = "Conformist"; const int kArchetypeConniverId = 11; - const std::wstring kArchetypeConniverLabel = L"Conniver"; + const std::string kArchetypeConniverLabel = "Conniver"; const int kArchetypeCurmudgeonId = 12; - const std::wstring kArchetypeCurmudgeonLabel = L"Curmudgeon"; + const std::string kArchetypeCurmudgeonLabel = "Curmudgeon"; const int kArchetypeDefenderId = 13; - const std::wstring kArchetypeDefenderLabel = L"Defender"; + const std::string kArchetypeDefenderLabel = "Defender"; const int kArchetypeDeviantId = 14; - const std::wstring kArchetypeDeviantLabel = L"Deviant"; + const std::string kArchetypeDeviantLabel = "Deviant"; const int kArchetypeDirectorId = 15; - const std::wstring kArchetypeDirectorLabel = L"Director"; + const std::string kArchetypeDirectorLabel = "Director"; const int kArchetypeFanaticId = 16; - const std::wstring kArchetypeFanaticLabel = L"Fanatic"; + const std::string kArchetypeFanaticLabel = "Fanatic"; const int kArchetypeGallantId = 17; - const std::wstring kArchetypeGallantLabel = L"Gallant"; + const std::string kArchetypeGallantLabel = "Gallant"; const int kArchetypeInnovatorId = 18; - const std::wstring kArchetypeInnovatorLabel = L"Innovator"; + const std::string kArchetypeInnovatorLabel = "Innovator"; const int kArchetypeJesterId = 19; - const std::wstring kArchetypeJesterLabel = L"Jester"; + const std::string kArchetypeJesterLabel = "Jester"; const int kArchetypeJudgeId = 20; - const std::wstring kArchetypeJudgeLabel = L"Judge"; + const std::string kArchetypeJudgeLabel = "Judge"; const int kArchetypeLoanerId = 21; - const std::wstring kArchetypeLoanerLabel = L"Loaner"; + const std::string kArchetypeLoanerLabel = "Loaner"; const int kArchetypeMartyrId = 22; - const std::wstring kArchetypeMartyrLabel = L"Martyr"; + const std::string kArchetypeMartyrLabel = "Martyr"; const int kArchetypeMonsterId = 23; - const std::wstring kArchetypeMonsterLabel = L"Monster"; + const std::string kArchetypeMonsterLabel = "Monster"; const int kArchetypePenitentId = 24; - const std::wstring kArchetypePenitentLabel = L"Penitent"; + const std::string kArchetypePenitentLabel = "Penitent"; const int kArchetypeRebelId = 25; - const std::wstring kArchetypeRebelLabel = L"Rebel"; + const std::string kArchetypeRebelLabel = "Rebel"; const int kArchetypeRogueId = 26; - const std::wstring kArchetypeRogueLabel = L"Rogue"; + const std::string kArchetypeRogueLabel = "Rogue"; const int kArchetypeSurvivorId = 27; - const std::wstring kArchetypeSurvivorLabel = L"Survivor"; + const std::string kArchetypeSurvivorLabel = "Survivor"; const int kArchetypeTraditionalistId = 28; - const std::wstring kArchetypeTraditionalistLabel = L"Traditionalist"; + const std::string kArchetypeTraditionalistLabel = "Traditionalist"; const int kArchetypeTyrantId = 29; - const std::wstring kArchetypeTyrantLabel = L"Tyrant"; + const std::string kArchetypeTyrantLabel = "Tyrant"; const int kArchetypeVisionaryId = 30; - const std::wstring kArchetypeVisionaryLabel = L"Visionary"; + const std::string kArchetypeVisionaryLabel = "Visionary"; const int kArchetypesCount = 30; - const std::wstring kArchetypes[] = { - L"", + const std::string kArchetypes[] = { + "", kArchetypeArchitectLabel, kArchetypeAutocratLabel, kArchetypeBarbarianLabel, @@ -99,7 +99,7 @@ namespace SBF { kArchetypeVisionaryLabel, }; - const std::wstring& GetArchetypeLabel(int archetypeId); - void FillArchetypeLabels(std::vector archetypeLabels); + const std::string& GetArchetypeLabel(int archetypeId); + void FillArchetypeLabels(std::vector archetypeLabels); } // End namespace SBF #endif // End !defined ARCHETYPES_H__ diff --git a/sbf-cpp/Attributes.h b/sbf-cpp/Attributes.h index 8f8c4cf..a47c946 100644 --- a/sbf-cpp/Attributes.h +++ b/sbf-cpp/Attributes.h @@ -5,97 +5,97 @@ namespace SBF { const int kPhysicalAttributeStrengthId = 1; - const std::wstring kPhysicalAttributeStrengthLabel = L"Strength"; - const std::wstring kPhysicalAttributeStrengthAbbreviation = L"Str."; + const std::string kPhysicalAttributeStrengthLabel = "Strength"; + const std::string kPhysicalAttributeStrengthAbbreviation = "Str."; const int kPhysicalAttributeDexterityId = 2; - const std::wstring kPhysicalAttributeDexterityLabel = L"Dexterity"; - const std::wstring kPhysicalAttributeDexterityAbbreviation = L"Dex."; + const std::string kPhysicalAttributeDexterityLabel = "Dexterity"; + const std::string kPhysicalAttributeDexterityAbbreviation = "Dex."; const int kPhysicalAttributeStaminaId = 3; - const std::wstring kPhysicalAttributeStaminaLabel = L"Stamina"; - const std::wstring kPhysicalAttributeStaminaAbbreviation = L"Sta."; + const std::string kPhysicalAttributeStaminaLabel = "Stamina"; + const std::string kPhysicalAttributeStaminaAbbreviation = "Sta."; const int kPhysicalAttributesCount = 3; - const std::wstring kPhysicalAttributeLabels[] = { - L"", + const std::string kPhysicalAttributeLabels[] = { + "", kPhysicalAttributeStrengthLabel, kPhysicalAttributeDexterityLabel, kPhysicalAttributeStaminaLabel, }; - const std::wstring kPhysicalAttributeAbbreviations[] = { - L"", + const std::string kPhysicalAttributeAbbreviations[] = { + "", kPhysicalAttributeStrengthAbbreviation, kPhysicalAttributeDexterityAbbreviation, kPhysicalAttributeStaminaAbbreviation, }; const int kSocialAttributeCharismaId = 1; - const std::wstring kSocialAttributeCharismaLabel = L"Charisma"; - const std::wstring kSocialAttributeCharismaAbbreviation = L"Cha."; + const std::string kSocialAttributeCharismaLabel = "Charisma"; + const std::string kSocialAttributeCharismaAbbreviation = "Cha."; const int kSocialAttributeManipulationId = 2; - const std::wstring kSocialAttributeManipulationLabel = L"Manipulation"; - const std::wstring kSocialAttributeManipulationAbbreviation = L"Man."; + const std::string kSocialAttributeManipulationLabel = "Manipulation"; + const std::string kSocialAttributeManipulationAbbreviation = "Man."; const int kSocialAttributeAppearanceId = 3; - const std::wstring kSocialAttributeAppearanceLabel = L"Appearance"; - const std::wstring kSocialAttributeAppearanceAbbreviation = L"App."; + const std::string kSocialAttributeAppearanceLabel = "Appearance"; + const std::string kSocialAttributeAppearanceAbbreviation = "App."; const int kSocialAttributesCount = 3; - const std::wstring kSocialAttributeLabels[] = { - L"", + const std::string kSocialAttributeLabels[] = { + "", kSocialAttributeCharismaLabel, kSocialAttributeManipulationLabel, kSocialAttributeAppearanceLabel, }; - const std::wstring kSocialAttributeAbbreviations[] = { - L"", + const std::string kSocialAttributeAbbreviations[] = { + "", kSocialAttributeCharismaAbbreviation, kSocialAttributeManipulationAbbreviation, kSocialAttributeAppearanceAbbreviation, }; const int kMentalAttributeIntelligenceId = 1; - const std::wstring kMentalAttributeIntelligenceLabel = L"Intelligence"; - const std::wstring kMentalAttributeIntelligenceAbbreviation = L"Int."; + const std::string kMentalAttributeIntelligenceLabel = "Intelligence"; + const std::string kMentalAttributeIntelligenceAbbreviation = "Int."; const int kMentalAttributePerceptionId = 2; - const std::wstring kMentalAttributePerceptionLabel = L"Perception"; - const std::wstring kMentalAttributePerceptionAbbreviation = L"Per."; + const std::string kMentalAttributePerceptionLabel = "Perception"; + const std::string kMentalAttributePerceptionAbbreviation = "Per."; const int kMentalAttributeWitsId = 3; - const std::wstring kMentalAttributeWitsLabel = L"Wits"; - const std::wstring kMentalAttributeWitsAbbreviation = L"Wits"; + const std::string kMentalAttributeWitsLabel = "Wits"; + const std::string kMentalAttributeWitsAbbreviation = "Wits"; const int kMentalAttributesCount = 3; - const std::wstring kMentalAttributeLabels[] = { - L"", + const std::string kMentalAttributeLabels[] = { + "", kMentalAttributeIntelligenceLabel, kMentalAttributePerceptionLabel, kMentalAttributeWitsLabel, }; - const std::wstring kMentalAttributeAbbreviations[] = { - L"", + const std::string kMentalAttributeAbbreviations[] = { + "", kMentalAttributeIntelligenceLabel, kMentalAttributePerceptionAbbreviation, kMentalAttributeWitsAbbreviation, }; const int kAttributeGroupPhysicalId = 1; - const std::wstring kAttributeGroupPhysicalLabel = L"Physical"; + const std::string kAttributeGroupPhysicalLabel = "Physical"; const int kAttributeGroupSocialId = 2; - const std::wstring kAttributeGroupSocialLabel = L"Social"; + const std::string kAttributeGroupSocialLabel = "Social"; const int kAttributeGroupMentalId = 3; - const std::wstring kAttributeGroupMentalLabel = L"Mental"; + const std::string kAttributeGroupMentalLabel = "Mental"; const int kAttributeGroupsCount = 3; - const std::wstring kAttributeGroups[] = { - L"", + const std::string kAttributeGroups[] = { + "", kAttributeGroupPhysicalLabel, kAttributeGroupSocialLabel, kAttributeGroupMentalLabel, }; - const std::wstring& GetAttributeGroupLabel(int attributeGroupId); - const std::wstring& GetAtttributeLabel(int attributeGroupId, int attributeId); - const std::wstring& GetPhysicalAttributeLabel(int attributeId); - const std::wstring& GetSocialAttributeLabel(int attributeId); - const std::wstring& GetMentalAttributeLabel(int attributeId); - void FillAttributeGroupLabels(std::vector attributeGroupLabels); - void FillAttributeLabelInGroup(std::vector attributeLabels); - void FillPhysicalAttributeLabels(std::vector physicalAttributeLabels); - void FillSocialAttributeLabels(std::vector socialAttributeLabels); - void FillMentalAttributeLabels(std::vector mentalAttributeLabels); + const std::string& GetAttributeGroupLabel(int attributeGroupId); + const std::string& GetAtttributeLabel(int attributeGroupId, int attributeId); + const std::string& GetPhysicalAttributeLabel(int attributeId); + const std::string& GetSocialAttributeLabel(int attributeId); + const std::string& GetMentalAttributeLabel(int attributeId); + void FillAttributeGroupLabels(std::vector attributeGroupLabels); + void FillAttributeLabelInGroup(std::vector attributeLabels); + void FillPhysicalAttributeLabels(std::vector physicalAttributeLabels); + void FillSocialAttributeLabels(std::vector socialAttributeLabels); + void FillMentalAttributeLabels(std::vector mentalAttributeLabels); } // End namespace SBF #endif // End !defined ATTRIBUTES_H__ diff --git a/sbf-cpp/Attributes_test.cpp b/sbf-cpp/Attributes_test.cpp index 2b6aae5..f4e2344 100644 --- a/sbf-cpp/Attributes_test.cpp +++ b/sbf-cpp/Attributes_test.cpp @@ -4,7 +4,7 @@ using namespace SBF; using namespace Test; TestResults main_test_Attributes(int argc, char** argv) { - TestResults results = TestResults().pass(); + TestResults results; return results; } diff --git a/sbf-cpp/Backgrounds.h b/sbf-cpp/Backgrounds.h index db5fd77..11970c2 100644 --- a/sbf-cpp/Backgrounds.h +++ b/sbf-cpp/Backgrounds.h @@ -6,28 +6,28 @@ namespace SBF { const int kBackgroundPoints = 5; const int kBackgroundAlliesId = 1; - const std::wstring kBackgroundAlliesLabel = L"Allies"; + const std::string kBackgroundAlliesLabel = "Allies"; const int kBackgroundContactsId = 2; - const std::wstring kBackgroundContactsLabel = L"Contacts"; + const std::string kBackgroundContactsLabel = "Contacts"; const int kBackgroundFameId = 3; - const std::wstring kBackgroundFameLabel = L"Fame"; + const std::string kBackgroundFameLabel = "Fame"; const int kBackgroundGenerationId = 4; - const std::wstring kBackgroundGenerationLabel = L"Generation"; + const std::string kBackgroundGenerationLabel = "Generation"; const int kBackgroundHerdId = 5; - const std::wstring kBackgroundHerdLabel = L"Herd"; + const std::string kBackgroundHerdLabel = "Herd"; const int kBackgroundInfluenceId = 6; - const std::wstring kBackgroundInfluenceLabel = L"Influence"; + const std::string kBackgroundInfluenceLabel = "Influence"; const int kBackgroundMentorId = 7; - const std::wstring kBackgroundMentorLabel = L"Mentor"; + const std::string kBackgroundMentorLabel = "Mentor"; const int kBackgroundResourcesId = 8; - const std::wstring kBackgroundResourcesLabel = L"Resources"; + const std::string kBackgroundResourcesLabel = "Resources"; const int kBackgroundRetainersId = 9; - const std::wstring kBackgroundRetainersLabel = L"Retainers"; + const std::string kBackgroundRetainersLabel = "Retainers"; const int kBackgroundStatusId = 10; - const std::wstring kBackgroundStatusLabel = L"Status"; + const std::string kBackgroundStatusLabel = "Status"; const int kBackgroundsCount = 10; - const std::wstring kBackgroundLabels[] = { - L"", + const std::string kBackgroundLabels[] = { + "", kBackgroundAlliesLabel, kBackgroundContactsLabel, kBackgroundFameLabel, @@ -39,7 +39,7 @@ namespace SBF { kBackgroundRetainersLabel, kBackgroundStatusLabel, }; - const std::wstring& GetBackgroundLabel(int backgroundId); - void FillBackgroundLabels(std::vector backgroundLabels); + const std::string& GetBackgroundLabel(int backgroundId); + void FillBackgroundLabels(std::vector backgroundLabels); } // End namespace SBF #endif // End !defined BACKGROUNDS_H__ diff --git a/sbf-cpp/Backgrounds_test.cpp b/sbf-cpp/Backgrounds_test.cpp index fc1d931..1e1e6cb 100644 --- a/sbf-cpp/Backgrounds_test.cpp +++ b/sbf-cpp/Backgrounds_test.cpp @@ -4,7 +4,7 @@ using namespace SBF; using namespace Test; TestResults main_test_Backgrounds(int argc, char** argv) { - TestResults results = TestResults().pass(); + TestResults results; return results; } diff --git a/sbf-cpp/Character.cpp b/sbf-cpp/Character.cpp index 13871c0..06375ec 100644 --- a/sbf-cpp/Character.cpp +++ b/sbf-cpp/Character.cpp @@ -2,7 +2,7 @@ namespace SBF { - using std::wstring; + using std::string; using std::vector; int GetNumAttributesInGroup(int groupId) { @@ -20,18 +20,18 @@ namespace SBF { CharacterType::CharacterType() { // Scalars - name = L""; - player = L""; - chronicle = L""; - haven = L""; - concept = L""; - age = L""; + name = ""; + player = ""; + chronicle = ""; + haven = ""; + concept = ""; + age = ""; genderId = 0; clanId = 0; natureId = 0; demeanorId = 0; generation = 3; - roadName = L""; + roadName = ""; roadValue = 0; willpower = 0; bloodPool = 0; @@ -262,7 +262,7 @@ namespace SBF { } } - wstring GetAttributeLabel(int attributeGroupId, int attributeId) { + string GetAttributeLabel(int attributeGroupId, int attributeId) { switch (attributeGroupId) { case kAttributeGroupPhysicalId: return kPhysicalAttributeLabels[attributeId]; @@ -271,11 +271,11 @@ namespace SBF { case kAttributeGroupMentalId: return kMentalAttributeLabels[attributeId]; default: - return L""; + return ""; } } - void FillAttributeLabelsInGroup(std::vector attributeLabels, int attributeGroupId) { + void FillAttributeLabelsInGroup(std::vector attributeLabels, int attributeGroupId) { attributeLabels.clear(); switch (attributeGroupId) { case kAttributeGroupPhysicalId: @@ -296,7 +296,7 @@ namespace SBF { } } - void FillAttributeAbbreviationsInGroup(std::vector attributeAbbreviations, int attributeGroupId) { + void FillAttributeAbbreviationsInGroup(std::vector attributeAbbreviations, int attributeGroupId) { attributeAbbreviations.clear(); switch (attributeGroupId) { case kAttributeGroupPhysicalId: @@ -455,40 +455,6 @@ namespace SBF { } } - int GetNumItemsForAbilityGroup(int abilityGroupId) { - switch (abilityGroupId) { - case kAbilityTalentsId: - return kTalentsCount; - case kAbilitySkillsId: - return kSkillsCount; - case kAbilityKnowledgesId: - return kKnowledgesCount; - } - return 0; - } - - void FillAbilitiesForAbilityGroup(std::vector abilities, int abilityGroupId) { - abilities.clear(); - int numAbilities = GetNumItemsForAbilityGroup(abilityGroupId); - switch (abilityGroupId) { - case kAbilityTalentsId: - for (int talentId = 0; talentId <= numAbilities; talentId++) { - abilities[talentId] = kTalents[talentId]; - } - break; - case kAbilitySkillsId: - for (int skillId = 0; skillId <= numAbilities; skillId++) { - abilities[skillId] = kSkills[skillId]; - } - break; - case kAbilityKnowledgesId: - for (int knowledgeId = 0; knowledgeId <= numAbilities; knowledgeId++) { - abilities[knowledgeId] = kKnowledges[knowledgeId]; - } - break; - } - } - void CharacterType::SetTalentValue(int talentId, int value) { switch (talentId) { case kTalentActingId: @@ -745,20 +711,20 @@ namespace SBF { return kBackgroundPoints; } - void NewDerangement(DerangementType& derangement, int id, wstring label, int textColor, wstring description) { + void NewDerangement(DerangementType& derangement, int id, string label, int textColor, string description) { derangement.id = id; derangement.label = label; derangement.textColor = textColor; derangement.description = description; } - wstring CharacterType::GetAllDerangementsLine() const { + string CharacterType::GetAllDerangementsLine() const { // TODO: Replace this with a stringstream. std::vector allDerangements; FillDerangements(allDerangements); - wstring allDerangementsString = L""; + string allDerangementsString = ""; std::for_each(allDerangements.begin(), allDerangements.end(), [&allDerangementsString](DerangementType derangement) { - allDerangementsString += derangement.label + L", "; + allDerangementsString += derangement.label + ", "; }); return allDerangementsString; } diff --git a/sbf-cpp/Character.h b/sbf-cpp/Character.h index 5255101..2727a2c 100644 --- a/sbf-cpp/Character.h +++ b/sbf-cpp/Character.h @@ -29,7 +29,7 @@ namespace SBF { int GetAbilityValue(int abilityGroupId, int abilityId) const; int GetAttributeValue(int attributeGroupId, int abilityId) const; int GetBackgroundValue(int backgroundId) const; - std::wstring GetAllDerangementsLine() const; + std::string GetAllDerangementsLine() const; int GetDisciplineValue(int disciplineId) const; int GetKnowledgeValue(int knowledgeId) const; int GetSkillValue(int skillId) const; @@ -44,12 +44,12 @@ namespace SBF { void SetTalentValue(int talentId, int value); void SetVirtueValue(int virtueId, int value); - std::wstring name; - std::wstring player; - std::wstring chronicle; - std::wstring haven; - std::wstring concept; - std::wstring age; + std::string name; + std::string player; + std::string chronicle; + std::string haven; + std::string concept; + std::string age; int genderId; int clanId; int natureId; @@ -58,7 +58,7 @@ namespace SBF { int selfControl; int courage; int generation; - std::wstring roadName; + std::string roadName; int roadValue; int willpower; int bloodPool; diff --git a/sbf-cpp/Character_test.cpp b/sbf-cpp/Character_test.cpp index 3bb96ac..99b6fe2 100644 --- a/sbf-cpp/Character_test.cpp +++ b/sbf-cpp/Character_test.cpp @@ -4,7 +4,7 @@ using namespace SBF; using namespace Test; TestResults main_test_Character(int argc, char** argv) { - TestResults results = TestResults().pass(); + TestResults results; return results; } diff --git a/sbf-cpp/Clans.h b/sbf-cpp/Clans.h index bae4dec..48dc5a3 100644 --- a/sbf-cpp/Clans.h +++ b/sbf-cpp/Clans.h @@ -5,44 +5,44 @@ namespace SBF { const int kClanAnarch = 1; - const std::wstring kClanAnarchLabel = L"Anarch"; + const std::string kClanAnarchLabel = "Anarch"; const int kClanAssamite = 2; - const std::wstring kClanAssamiteLabel = L"Assamite"; + const std::string kClanAssamiteLabel = "Assamite"; const int kClanBaali = 3; - const std::wstring kClanBaaliLabel = L"Baali"; + const std::string kClanBaaliLabel = "Baali"; const int kClanBrujah = 4; - const std::wstring kClanBrujahLabel = L"Brujah"; + const std::string kClanBrujahLabel = "Brujah"; const int kClanCaitiff = 5; - const std::wstring kClanCaitiffLabel = L"Caitiff"; + const std::string kClanCaitiffLabel = "Caitiff"; const int kClanCappadocian = 6; - const std::wstring kClanCappadocianLabel = L"Cappadocian"; + const std::string kClanCappadocianLabel = "Cappadocian"; const int kClanGangrel = 7; - const std::wstring kClanGangrelLabel = L"Gangrel"; + const std::string kClanGangrelLabel = "Gangrel"; const int kClanGiovanni = 8; - const std::wstring kClanGiovanniLabel = L"Giovanni"; + const std::string kClanGiovanniLabel = "Giovanni"; const int kClanInconnu = 9; - const std::wstring kClanInconnuLabel = L"Inconnu"; + const std::string kClanInconnuLabel = "Inconnu"; const int kClanLasombra = 10; - const std::wstring kClanLasombraLabel = L"Lasombra"; + const std::string kClanLasombraLabel = "Lasombra"; const int kClanMalkavian = 11; - const std::wstring kClanMalkavianLabel = L"Malkavian"; + const std::string kClanMalkavianLabel = "Malkavian"; const int kClanNosferatu = 12; - const std::wstring kClanNosferatuLabel = L"Nosferatu"; + const std::string kClanNosferatuLabel = "Nosferatu"; const int kClanRavanos = 13; - const std::wstring kClanRavanosLabel = L"Ravanos"; + const std::string kClanRavanosLabel = "Ravanos"; const int kClanSettite = 14; - const std::wstring kClanSettiteLabel = L"Settite"; + const std::string kClanSettiteLabel = "Settite"; const int kClanToreador = 15; - const std::wstring kClanToreadorLabel = L"Toreador"; + const std::string kClanToreadorLabel = "Toreador"; const int kClanTremere = 16; - const std::wstring kClanTremereLabel = L"Tremere"; + const std::string kClanTremereLabel = "Tremere"; const int kClanTzismice = 17; - const std::wstring kClanTzismiceLabel = L"Tzismice"; + const std::string kClanTzismiceLabel = "Tzismice"; const int kClanVentrue = 18; - const std::wstring kClanVentrueLabel = L"Ventrue"; + const std::string kClanVentrueLabel = "Ventrue"; const int kClansCount = 18; - const std::wstring kClans[] = { - L"", + const std::string kClans[] = { + "", kClanAnarchLabel, kClanAssamiteLabel, kClanBaaliLabel, @@ -60,7 +60,7 @@ namespace SBF { kClanTremereLabel, kClanVentrueLabel, }; - const std::wstring& GetClanLabel(int clanId); - void FillClanLabels(std::vector clans); + const std::string& GetClanLabel(int clanId); + void FillClanLabels(std::vector clans); } // End namespace SBF #endif // End !defined CLANS_H__ diff --git a/sbf-cpp/Clans_test.cpp b/sbf-cpp/Clans_test.cpp index 0b68be4..400e8ae 100644 --- a/sbf-cpp/Clans_test.cpp +++ b/sbf-cpp/Clans_test.cpp @@ -4,7 +4,7 @@ using namespace SBF; using namespace Test; TestResults main_test_Clans(int argc, char** argv) { - TestResults results = TestResults(); + TestResults results; return results; } diff --git a/sbf-cpp/Derangements.h b/sbf-cpp/Derangements.h index 546dc8c..668b71a 100644 --- a/sbf-cpp/Derangements.h +++ b/sbf-cpp/Derangements.h @@ -7,51 +7,51 @@ namespace SBF { struct DerangementType { int id; - std::wstring label; - std::wstring description; + std::string label; + std::string description; uint8_t textColor; }; const int kDerangementAmnesiaId = 1; const uint8_t kDerangementAmnesiaTextColor= kColorDarkRed; - const std::wstring kDerangementAmnesiaLabel = L"Amnesia"; - const std::wstring kDerangementAmnesiaDescription = LR"---(You forget a segment of your past. Additionally in some cases a character can forget abilities and be unable to use them for the duration.)---"; + const std::string kDerangementAmnesiaLabel = "Amnesia"; + const std::string kDerangementAmnesiaDescription = R"---(You forget a segment of your past. Additionally in some cases a character can forget abilities and be unable to use them for the duration.)---"; const int kDerangementDelusionsOfGrandeurId = 2; const uint8_t kDerangementDelusionsOfGrandeurTextColor= kColorDarkMagenta; - const std::wstring kDerangementDelusionsOfGrandeurLabel = L"Delusions of Grandeur"; - const std::wstring kDerangementDelusionsOfGrandeurDescription = LR"---(You imagine you are better than you are.)---"; + const std::string kDerangementDelusionsOfGrandeurLabel = "Delusions of Grandeur"; + const std::string kDerangementDelusionsOfGrandeurDescription = R"---(You imagine you are better than you are.)---"; const int kDerangementFantasyId = 3; const uint8_t kDerangementFantasyTextColor= kColorDarkOrange; - const std::wstring kDerangementFantasyLabel = L"Fantasy"; - const std::wstring kDerangementFantasyDescription = LR"---(You enter a self-created world where you are the forgotten hero.)---"; + const std::string kDerangementFantasyLabel = "Fantasy"; + const std::string kDerangementFantasyDescription = R"---(You enter a self-created world where you are the forgotten hero.)---"; const int kDerangementManicDepressionId = 4; const uint8_t kDerangementManicDepressionTextColor= kColorDarkWhite; - const std::wstring kDerangementManicDepressionLabel = L"Manic-Depression"; - const std::wstring kDerangementManicDepressionDescription = LR"---(You sink into deep and fitful depressions, showing no interest in anything which used to captivate your interests. You will go along with others rather than use the energy to resist. Occasional fits of great energy grab hold of you, and you will work for hours or even days on your projects. During this time you will resist even the need for sleep as you burn up blood and Willpower on your schemes.)---"; + const std::string kDerangementManicDepressionLabel = "Manic-Depression"; + const std::string kDerangementManicDepressionDescription = R"---(You sink into deep and fitful depressions, showing no interest in anything which used to captivate your interests. You will go along with others rather than use the energy to resist. Occasional fits of great energy grab hold of you, and you will work for hours or even days on your projects. During this time you will resist even the need for sleep as you burn up blood and Willpower on your schemes.)---"; const int kDerangementMultiplePersonalitiesId = 5; const uint8_t kDerangementMultiplePersonalitiesTextColor= kColorDarkBlue; - const std::wstring kDerangementMultiplePersonalitiesLabel = L"Multiple Personalities"; - const std::wstring kDerangementMultiplePersonalitiesDescription = LR"---(You possess a number of new personalities. You have amore than one Mature, and will switch between them. Thus you regain Willpower points in defferent ways at defferent times)---"; + const std::string kDerangementMultiplePersonalitiesLabel = "Multiple Personalities"; + const std::string kDerangementMultiplePersonalitiesDescription = R"---(You possess a number of new personalities. You have amore than one Mature, and will switch between them. Thus you regain Willpower points in defferent ways at defferent times)---"; const int kDerangementObsessionId = 6; const uint8_t kDerangementObsessionTextColor= kColorBrightGreen; - const std::wstring kDerangementObsessionLabel = L"Obsession"; - const std::wstring kDerangementObsessionDescription = LR"---(You become obsessed with some interest or fetish.)---"; + const std::string kDerangementObsessionLabel = "Obsession"; + const std::string kDerangementObsessionDescription = R"---(You become obsessed with some interest or fetish.)---"; const int kDerangementOvercompensationId = 7; const uint8_t kDerangementOvercompensationTextColor= kColorBrightCyan; - const std::wstring kDerangementOvercompensationLabel = L"Overcompensation"; - const std::wstring kDerangementOvercompensationDescription = LR"---(You make up for your moral weaknesses by playing up your strengths to an extreme. You don't think you can frenzy and won't stop it.)---"; + const std::string kDerangementOvercompensationLabel = "Overcompensation"; + const std::string kDerangementOvercompensationDescription = R"---(You make up for your moral weaknesses by playing up your strengths to an extreme. You don't think you can frenzy and won't stop it.)---"; const int kDerangementParanoiaId = 8; const uint8_t kDerangementParanoiaTextColor= kColorBrightRed; - const std::wstring kDerangementParanoiaLabel = L"Paranoia"; - const std::wstring kDerangementParanoiaDescription = LR"---(You are convinced that you are being hunted. You hold even your closest Friends under suspicion.)---"; + const std::string kDerangementParanoiaLabel = "Paranoia"; + const std::string kDerangementParanoiaDescription = R"---(You are convinced that you are being hunted. You hold even your closest Friends under suspicion.)---"; const int kDerangementPerfectionId = 9; const uint8_t kDerangementPerfectionTextColor= kColorBrightMagenta; - const std::wstring kDerangementPerfectionLabel = L"Perfection"; - const std::wstring kDerangementPerfectionDescription = LR"---(All your energy is directed toward preventing anything from going wong. When it does you must make a self-control roll or frenzy.)---"; + const std::string kDerangementPerfectionLabel = "Perfection"; + const std::string kDerangementPerfectionDescription = R"---(All your energy is directed toward preventing anything from going wong. When it does you must make a self-control roll or frenzy.)---"; const int kDerangementRegressionId = 10; const uint8_t kDerangementRegressionTextColor= kColorBrightYellow; - const std::wstring kDerangementRegressionLabel = L"Regression"; - const std::wstring kDerangementRegressionDescription = LR"---(You become childlike retreating to an earlier time when less was expected of you Willpower is regained inthe way a Child's is.)---"; + const std::string kDerangementRegressionLabel = "Regression"; + const std::string kDerangementRegressionDescription = R"---(You become childlike retreating to an earlier time when less was expected of you Willpower is regained inthe way a Child's is.)---"; const DerangementType kDerangementAmnesia = { kDerangementAmnesiaId, kDerangementAmnesiaLabel, @@ -128,8 +128,8 @@ namespace SBF { kDerangementRegressionTextColor, }; - const std::wstring kDerangementLabels[] = { - L"", + const std::string kDerangementLabels[] = { + "", kDerangementAmnesiaLabel, kDerangementDelusionsOfGrandeurLabel, kDerangementFantasyLabel, @@ -142,8 +142,8 @@ namespace SBF { kDerangementRegressionLabel, }; - const std::wstring kDerangementDescriptions[] = { - L"", + const std::string kDerangementDescriptions[] = { + "", kDerangementAmnesiaDescription, kDerangementDelusionsOfGrandeurDescription, kDerangementFantasyDescription, @@ -157,7 +157,7 @@ namespace SBF { }; const DerangementType kDerangements[] = { - {0, L"", L"", 0}, + {0, "", "", 0}, kDerangementAmnesia, kDerangementDelusionsOfGrandeur, kDerangementFantasy, diff --git a/sbf-cpp/Disciplines.h b/sbf-cpp/Disciplines.h index c4bdd48..5fd76e3 100644 --- a/sbf-cpp/Disciplines.h +++ b/sbf-cpp/Disciplines.h @@ -6,56 +6,56 @@ namespace SBF { const int kDisciplinePoints = 3; const int kDisciplineAnimalismId = 1; - const std::wstring kDisciplineAnimalismLabel = L"Animalism"; + const std::string kDisciplineAnimalismLabel = "Animalism"; const int kDisciplineAuspexId = 2; - const std::wstring kDisciplineAuspexLabel = L"Auspex"; + const std::string kDisciplineAuspexLabel = "Auspex"; const int kDisciplineBardoId = 3; - const std::wstring kDisciplineBardoLabel = L"Bardo"; + const std::string kDisciplineBardoLabel = "Bardo"; const int kDisciplineCelerityId = 4; - const std::wstring kDisciplineCelerityLabel = L"Celerity"; + const std::string kDisciplineCelerityLabel = "Celerity"; const int kDisciplineChimestryId = 5; - const std::wstring kDisciplineChimestryLabel = L"Chimestry"; + const std::string kDisciplineChimestryLabel = "Chimestry"; const int kDisciplineDementationId = 6; - const std::wstring kDisciplineDementationLabel = L"Dementation"; + const std::string kDisciplineDementationLabel = "Dementation"; const int kDisciplineDominateId = 7; - const std::wstring kDisciplineDominateLabel = L"Dominate"; + const std::string kDisciplineDominateLabel = "Dominate"; const int kDisciplineFortitudeId = 8; - const std::wstring kDisciplineFortitudeLabel = L"Fortitude"; + const std::string kDisciplineFortitudeLabel = "Fortitude"; const int kDisciplineMelpomineeId = 9; - const std::wstring kDisciplineMelpomineeLabel = L"Melpominee"; + const std::string kDisciplineMelpomineeLabel = "Melpominee"; const int kDisciplineMortisId = 10; - const std::wstring kDisciplineMortisLabel = L"Mortis"; + const std::string kDisciplineMortisLabel = "Mortis"; const int kDisciplineMytherceriaId = 11; - const std::wstring kDisciplineMytherceriaLabel = L"Mytherceria"; + const std::string kDisciplineMytherceriaLabel = "Mytherceria"; const int kDisciplineNecromancyId = 12; - const std::wstring kDisciplineNecromancyLabel = L"Necromancy"; + const std::string kDisciplineNecromancyLabel = "Necromancy"; const int kDisciplineObeahId = 13; - const std::wstring kDisciplineObeahLabel = L"Obeah"; + const std::string kDisciplineObeahLabel = "Obeah"; const int kDisciplineObfuscateId = 14; - const std::wstring kDisciplineObfuscateLabel = L"Obfuscate"; + const std::string kDisciplineObfuscateLabel = "Obfuscate"; const int kDisciplineObtenebrationId = 15; - const std::wstring kDisciplineObtenebrationLabel = L"Obtenebration"; + const std::string kDisciplineObtenebrationLabel = "Obtenebration"; const int kDisciplinePotenceId = 16; - const std::wstring kDisciplinePotenceLabel = L"Potence"; + const std::string kDisciplinePotenceLabel = "Potence"; const int kDisciplinePresenceId = 17; - const std::wstring kDisciplinePresenceLabel = L"Presence"; + const std::string kDisciplinePresenceLabel = "Presence"; const int kDisciplineProteanId = 18; - const std::wstring kDisciplineProteanLabel = L"Protean"; + const std::string kDisciplineProteanLabel = "Protean"; const int kDisciplineQuietusId = 19; - const std::wstring kDisciplineQuietusLabel = L"Quietus"; + const std::string kDisciplineQuietusLabel = "Quietus"; const int kDisciplineSerpentisId = 20; - const std::wstring kDisciplineSerpentisLabel = L"Serpentis"; + const std::string kDisciplineSerpentisLabel = "Serpentis"; const int kDisciplineSpiritusId = 21; - const std::wstring kDisciplineSpiritusLabel = L"Spiritus"; + const std::string kDisciplineSpiritusLabel = "Spiritus"; const int kDisciplineThanantosisId = 22; - const std::wstring kDisciplineThanantosisLabel = L"Thanantosis"; + const std::string kDisciplineThanantosisLabel = "Thanantosis"; const int kDisciplineThaumaturgyId = 23; - const std::wstring kDisciplineThaumaturgyLabel = L"Thaumaturgy"; + const std::string kDisciplineThaumaturgyLabel = "Thaumaturgy"; const int kDisciplineVicissitudeId = 24; - const std::wstring kDisciplineVicissitudeLabel = L"Vicissitude"; + const std::string kDisciplineVicissitudeLabel = "Vicissitude"; const int kDisciplinesCount = 24; - const std::wstring kDisciplines[] = { - L"", + const std::string kDisciplines[] = { + "", kDisciplineAnimalismLabel, kDisciplineAuspexLabel, kDisciplineBardoLabel, @@ -81,7 +81,7 @@ namespace SBF { kDisciplineThaumaturgyLabel, kDisciplineVicissitudeLabel, }; - const std::wstring GetDisciplineLabel(int disciplineId); - void FillDisciplineLabels(std::vector disciplineLabels); + const std::string GetDisciplineLabel(int disciplineId); + void FillDisciplineLabels(std::vector disciplineLabels); } // End namespace SBF #endif // End !defined DISCIPLINES_H__ diff --git a/sbf-cpp/Genders.h b/sbf-cpp/Genders.h index 3aaa22a..464dedb 100644 --- a/sbf-cpp/Genders.h +++ b/sbf-cpp/Genders.h @@ -5,25 +5,25 @@ namespace SBF { const int kGenderMaleId = 1; - const std::wstring kGenderMaleLabel = L"Male"; + const std::string kGenderMaleLabel = "Male"; const int kGenderFemaleId = 2; - const std::wstring kGenderFemaleLabel = L"Female"; + const std::string kGenderFemaleLabel = "Female"; const int kGenderTransMaleId = 3; - const std::wstring kGenderTransMaleLabel = L"Trans-Male"; + const std::string kGenderTransMaleLabel = "Trans-Male"; const int kGenderTransFemaleId = 4; - const std::wstring kGenderTransFemaleLabel = L"Trans-Female"; + const std::string kGenderTransFemaleLabel = "Trans-Female"; const int kGenderNonBinaryId = 5; - const std::wstring kGenderNonBinaryLabel = L"Non-Binary"; + const std::string kGenderNonBinaryLabel = "Non-Binary"; const int kGendersCount = 5; - const std::wstring kGenderLabels[] = { - L"", + const std::string kGenderLabels[] = { + "", kGenderMaleLabel, kGenderFemaleLabel, kGenderTransMaleLabel, kGenderTransFemaleLabel, kGenderNonBinaryLabel, }; - const std::wstring& GetGenderLabel(int genderId); - void FillGenderLabels(std::vector genderLabels); + const std::string& GetGenderLabel(int genderId); + void FillGenderLabels(std::vector genderLabels); } // End namespace SBF #endif // End !defined GENDERS_H__ diff --git a/sbf-cpp/Menus.cpp b/sbf-cpp/Menus.cpp index d8b8928..416b433 100644 --- a/sbf-cpp/Menus.cpp +++ b/sbf-cpp/Menus.cpp @@ -3,17 +3,17 @@ namespace SBF { int GetRandomMenuItemId (std::vector items); - void BuildMenu(std::vector items, std::vector labels); - void BuildMenuWithValues(std::vector items, std::vector labels, std::vector values); - void BuildMenuWithColors(std::vector items, std::vector labels, std::vector colors); + void BuildMenu(std::vector items, std::vector labels); + void BuildMenuWithValues(std::vector items, std::vector labels, std::vector values); + void BuildMenuWithColors(std::vector items, std::vector labels, std::vector colors); void AdjustMenuStyle(MenuStyle& style, std::vector items, bool ignoreValue); void PrintMenu(std::vector items, MenuStyle style); - wstring GetTitle(MenuItem item, MenuStyle style); - wstring GetTitleWithoutValue(MenuItem item, MenuStyle style); + string GetTitle(MenuItem item, MenuStyle style); + string GetTitleWithoutValue(MenuItem item, MenuStyle style); void NewMenuStyle(MenuStyle& style); - void NewMenuItem(MenuItem& item, wstring label, int id); - void NewMenuItemWithValue(MenuItem& item, wstring label, int id, int value); - void NewMenuItemWithColor(MenuItem& item, wstring label, int id, uint8_t color); + void NewMenuItem(MenuItem& item, string label, int id); + void NewMenuItemWithValue(MenuItem& item, string label, int id, int value); + void NewMenuItemWithColor(MenuItem& item, string label, int id, uint8_t color); } // End namespace SBF diff --git a/sbf-cpp/Menus.h b/sbf-cpp/Menus.h index 8e973d1..5adb54a 100644 --- a/sbf-cpp/Menus.h +++ b/sbf-cpp/Menus.h @@ -9,24 +9,24 @@ namespace SBF { #include namespace SBF { - using std::wstring; + using std::string; struct MenuStyle { int idWidth; int labelWidth; int valueWidth; int screenWidth; - wstring randomItemName; + string randomItemName; int randomItemId; - wstring idLabelSeparator; - wstring labelValueSeparator; - wstring menuItemSpacer; + string idLabelSeparator; + string labelValueSeparator; + string menuItemSpacer; bool showRandom; bool useColors; }; struct MenuItem { - wstring label; + string label; int id; int value; int color; @@ -34,17 +34,17 @@ namespace SBF { }; int GetRandomMenuItemId (std::vector items); - void BuildMenu(std::vector items, std::vector labels); - void BuildMenuWithValues(std::vector items, std::vector labels, std::vector values); - void BuildMenuWithColors(std::vector items, std::vector labels, std::vector colors); + void BuildMenu(std::vector items, std::vector labels); + void BuildMenuWithValues(std::vector items, std::vector labels, std::vector values); + void BuildMenuWithColors(std::vector items, std::vector labels, std::vector colors); void AdjustMenuStyle(MenuStyle& style, std::vector items, bool ignoreValue); void PrintMenu(std::vector items, MenuStyle style); - wstring GetTitle(MenuItem item, MenuStyle style); - wstring GetTitleWithoutValue(MenuItem item, MenuStyle style); + string GetTitle(MenuItem item, MenuStyle style); + string GetTitleWithoutValue(MenuItem item, MenuStyle style); void NewMenuStyle(MenuStyle& style); - void NewMenuItem(MenuItem& item, wstring label, int id); - void NewMenuItemWithValue(MenuItem& item, wstring label, int id, int value); - void NewMenuItemWithColor(MenuItem& item, wstring label, int id, uint8_t color); + void NewMenuItem(MenuItem& item, string label, int id); + void NewMenuItemWithValue(MenuItem& item, string label, int id, int value); + void NewMenuItemWithColor(MenuItem& item, string label, int id, uint8_t color); } // End namespace SBF diff --git a/sbf-cpp/Ranks.h b/sbf-cpp/Ranks.h index 4f2210c..2d02c9c 100644 --- a/sbf-cpp/Ranks.h +++ b/sbf-cpp/Ranks.h @@ -5,18 +5,18 @@ namespace SBF { const int kRankPrimaryId = 1; - const std::wstring kRankPrimaryLabel = L"Primary"; + const std::string kRankPrimaryLabel = "Primary"; const int kRankSecondaryId = 2; - const std::wstring kRankSecondaryLabel = L"Secondary"; + const std::string kRankSecondaryLabel = "Secondary"; const int kRankTertiaryId = 3; - const std::wstring kRankTertiaryLabel = L"Tertiary"; + const std::string kRankTertiaryLabel = "Tertiary"; const int kRanksCount = 3; struct RankType { int id; - std::wstring label; + std::string label; }; const RankType kRanks[] { - {0, L""}, + {0, ""}, {kRankPrimaryId, kRankPrimaryLabel}, {kRankSecondaryId, kRankSecondaryLabel}, {kRankTertiaryId, kRankTertiaryLabel}, diff --git a/sbf-cpp/Utils.cpp b/sbf-cpp/Utils.cpp index ab6aa5b..b803604 100644 --- a/sbf-cpp/Utils.cpp +++ b/sbf-cpp/Utils.cpp @@ -11,20 +11,20 @@ using namespace SBF; using namespace Test; namespace SBF { - using std::wcout; + using std::cout; using std::tuple; using std::wcerr; - using std::wstring; + using std::string; using std::endl; using std::pair; using std::get; using std::make_tuple; using std::vector; - wstring word_wrap(const wstring& text, int maxWidth) { - wstring output = L""; - wstring thisLine = L""; - wstring nextChunk = L""; + string word_wrap(const string& text, int maxWidth) { + string output = ""; + string thisLine = ""; + string nextChunk = ""; int32_t thisLineStartPosition = 0; int32_t thisLineCurrentPosition = 0; int32_t nextSpace = -1; @@ -34,7 +34,7 @@ namespace SBF { bool done = false; while (!done) { - nextSpace = get_index_of(text, L" ", thisLineCurrentPosition); + nextSpace = get_index_of(text, " ", thisLineCurrentPosition); if (nextSpace < 0) { nextSpace = textLength; } @@ -43,7 +43,7 @@ namespace SBF { if (nextChunkLength > 0) { auto needsSpace = thisLine.size() > 0; if (needsSpace) { - thisLine = thisLine + L" "; + thisLine = thisLine + " "; } thisLineLength = thisLine.size(); if (nextChunkLength > maxWidth) { @@ -66,8 +66,8 @@ namespace SBF { done = true; } thisLine = make_fit_l(thisLine, maxWidth, L'_'); - output += thisLine + (done ? L"" : L"\n"); - thisLine = L""; + output += thisLine + (done ? "" : "\n"); + thisLine = ""; thisLineLength = thisLine.size(); thisLineStartPosition = thisLineCurrentPosition; } @@ -76,27 +76,27 @@ namespace SBF { return output; } - wstring string_dollar(size_t length, wchar_t ch) { - wstring str = L""; + string string_dollar(size_t length, char ch) { + string str = ""; for (size_t i = 0; i(var1, text.length()-1), std::max(var2, 0)); } - size_t get_index_of(const wstring& text, const wstring& search, size_t start) { + size_t get_index_of(const string& text, const string& search, size_t start) { return text.find(search, start); } } // End namespace SBF diff --git a/sbf-cpp/Utils.h b/sbf-cpp/Utils.h index c900496..2d91733 100644 --- a/sbf-cpp/Utils.h +++ b/sbf-cpp/Utils.h @@ -3,14 +3,14 @@ #include namespace SBF { - using std::wstring; + using std::string; - size_t get_index_of(const wstring& text, const wstring& search, size_t start); - wstring word_wrap(const wstring& text, int maxWidth); - wstring get_substring(const wstring& text, int32_t var1, int32_t var2); - wstring make_fit_l(const wstring& text, size_t length, wchar_t paddCh); - wstring left(const wstring& text, size_t length); - wstring string_dollar(size_t length, wchar_t ch); + size_t get_index_of(const string& text, const string& search, size_t start); + string word_wrap(const string& text, int maxWidth); + string get_substring(const string& text, int32_t var1, int32_t var2); + string make_fit_l(const string& text, size_t length, char paddCh); + string left(const string& text, size_t length); + string string_dollar(size_t length, char ch); } // End namespace SBF #endif // End !defined UTILS_H__ diff --git a/sbf-cpp/Virtues.h b/sbf-cpp/Virtues.h index 88674ab..5f306d2 100644 --- a/sbf-cpp/Virtues.h +++ b/sbf-cpp/Virtues.h @@ -6,19 +6,19 @@ namespace SBF { const int kVirtuePoints = 7; const int kVirtueSelfControlId = 1; - const std::wstring kVirtueSelfControlLabel = L"Self-Control"; + const std::string kVirtueSelfControlLabel = "Self-Control"; const int kVirtueCourageId = 2; - const std::wstring kVirtueCourageLabel = L"Courage"; + const std::string kVirtueCourageLabel = "Courage"; const int kVirtueConscienceId = 3; - const std::wstring kVirtueConscienceLabel = L"Conscience"; + const std::string kVirtueConscienceLabel = "Conscience"; const int kVirtuesCount = 3; - const std::wstring kVirtues[] = { - L"", + const std::string kVirtues[] = { + "", kVirtueSelfControlLabel, kVirtueCourageLabel, kVirtueConscienceLabel, }; - const std::wstring GetVirtueLabel(int virtueId); - void FillVirtueLabels(std::vector virtueLabels); + const std::string GetVirtueLabel(int virtueId); + void FillVirtueLabels(std::vector virtueLabels); } // End namespace SBF #endif // End !defined VIRTUES_H__ diff --git a/sbf-cpp/main.cpp b/sbf-cpp/main.cpp index 33ecc06..ec2c1c4 100644 --- a/sbf-cpp/main.cpp +++ b/sbf-cpp/main.cpp @@ -36,7 +36,7 @@ int set_double_border(WINDOW* screen) { int main(int argc, char* argv[]) { setlocale(LC_ALL, ""); - wchar_t buffer[255] = {0}; + char buffer[255] = {0}; WINDOW* pWindow = nullptr; // Load ncurses and initialize stdscr. initscr(); @@ -58,17 +58,17 @@ int main(int argc, char* argv[]) { // Draw a box around the window with default chars. set_double_border(pWindow); // Display the event - mvwaddwstr(pWindow, 2, 2, L"Resized"); + mvwaddwstr(pWindow, 2, 2, "Resized"); // Get the window width and height. int width; int height; getmaxyx(pWindow, height, width); // Display the width and height. - swprintf(buffer, sizeof(buffer), L"width: %i, height: %i", width, height); + swprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height); mvwaddwstr(pWindow, 1, 2, buffer); } else { // Display the keycode of the key that was pressed in hex and octal. - swprintf(buffer, sizeof(buffer), L"0x%04X %04o pressed", key, key); + swprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key); mvwaddwstr(pWindow,2, 2, buffer); } wrefresh(pWindow); diff --git a/sbf-cpp/sbf.cpp b/sbf-cpp/sbf.cpp index 386c4a2..3a641e4 100644 --- a/sbf-cpp/sbf.cpp +++ b/sbf-cpp/sbf.cpp @@ -36,46 +36,46 @@ int set_double_border(WINDOW* screen) { } int main(int argc, char* argv[]) { - setlocale(LC_ALL, ""); - wchar_t buffer[255] = {0}; - WINDOW* pWindow = nullptr; - // Load ncurses and initialize stdscr. - initscr(); - pWindow = stdscr; - // Enable raw mode to give us direct access to extra keys. - raw(); - // Disable echoing characters as they are typed. - noecho(); - // Enable keypad characters. (function keys, arrow keys, and numpad keys.) - keypad(pWindow, true); - // Remove the delay when pressing esc. - set_escdelay(0); + // setlocale(LC_ALL, ""); + // char buffer[255] = {0}; + // WINDOW* pWindow = nullptr; + // // Load ncurses and initialize stdscr. + // initscr(); + // pWindow = stdscr; + // // Enable raw mode to give us direct access to extra keys. + // raw(); + // // Disable echoing characters as they are typed. + // noecho(); + // // Enable keypad characters. (function keys, arrow keys, and numpad keys.) + // keypad(pWindow, true); + // // Remove the delay when pressing esc. + // set_escdelay(0); - int key = KEY_RESIZE; - while(key != KEY_ESCAPE) { - if (key == KEY_RESIZE) { - // Clear the screen. - werase(pWindow); - // Draw a box around the window with default chars. - set_double_border(pWindow); - // Display the event - mvwaddwstr(pWindow, 2, 2, L"Resized"); - // Get the window width and height. - int width; - int height; - getmaxyx(pWindow, height, width); - // Display the width and height. - swprintf(buffer, sizeof(buffer), L"width: %i, height: %i", width, height); - mvwaddwstr(pWindow, 1, 2, buffer); - } else { - // Display the keycode of the key that was pressed in hex and octal. - swprintf(buffer, sizeof(buffer), L"0x%04X %04o pressed", key, key); - mvwaddwstr(pWindow,2, 2, buffer); - } - wrefresh(pWindow); - key = wgetch(pWindow); - } - endwin(); + // int key = KEY_RESIZE; + // while(key != KEY_ESCAPE) { + // if (key == KEY_RESIZE) { + // // Clear the screen. + // werase(pWindow); + // // Draw a box around the window with default chars. + // set_double_border(pWindow); + // // Display the event + // mvwaddwstr(pWindow, 2, 2, "Resized"); + // // Get the window width and height. + // int width; + // int height; + // getmaxyx(pWindow, height, width); + // // Display the width and height. + // swprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height); + // mvwaddwstr(pWindow, 1, 2, buffer); + // } else { + // // Display the keycode of the key that was pressed in hex and octal. + // swprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key); + // mvwaddwstr(pWindow,2, 2, buffer); + // } + // wrefresh(pWindow); + // key = wgetch(pWindow); + // } + // endwin(); return 0; } diff --git a/sbf-cpp/sbf.h b/sbf-cpp/sbf.h index bf21854..b7506e7 100644 --- a/sbf-cpp/sbf.h +++ b/sbf-cpp/sbf.h @@ -4,7 +4,7 @@ #include namespace SBF { - using std::wstring; + using std::string; const int kInitialGeneration = 13;