From 67bc955f83875094f337583ba7f56d056aa83e92 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 28 Nov 2023 15:51:17 -0600 Subject: [PATCH] Corrected missing header dependencies in safemap. Story file parser implementation and command data storage works proper. --- Crawler/Crawler.vcxproj | 2 ++ Crawler/Crawler.vcxproj.filters | 6 +++++ Crawler/Version.h | 2 +- Crawler/VisualNovel.cpp | 48 ++++++++++++++++++++++----------- Crawler/VisualNovel.h | 16 +++++------ Crawler/safemap.h | 3 +++ 6 files changed, 52 insertions(+), 25 deletions(-) diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj index 4304fd35..7be5a93e 100644 --- a/Crawler/Crawler.vcxproj +++ b/Crawler/Crawler.vcxproj @@ -329,6 +329,7 @@ + @@ -391,6 +392,7 @@ + diff --git a/Crawler/Crawler.vcxproj.filters b/Crawler/Crawler.vcxproj.filters index 60415669..c5ff7c70 100644 --- a/Crawler/Crawler.vcxproj.filters +++ b/Crawler/Crawler.vcxproj.filters @@ -270,6 +270,9 @@ Header Files + + Header Files\State + @@ -452,6 +455,9 @@ Source Files + + Source Files\Game States + diff --git a/Crawler/Version.h b/Crawler/Version.h index ff2001c0..5f114956 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -35,7 +35,7 @@ SUCH DAMAGE. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 3160 +#define VERSION_BUILD 3172 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/VisualNovel.cpp b/Crawler/VisualNovel.cpp index 92595905..432dd05a 100644 --- a/Crawler/VisualNovel.cpp +++ b/Crawler/VisualNovel.cpp @@ -41,7 +41,7 @@ safemap>>VisualNovel::storyLeve void VisualNovel::Initialize(){ for(int chapter=1;chapter<=6;chapter++){ - std::string chapterFilename="story_directory"_S+"Chapter "+std::to_string(chapter)+".txt"; + std::string chapterFilename="assets/"+"story_directory"_S+"Chapter "+std::to_string(chapter)+".txt"; std::ifstream file(chapterFilename); if(!file)ERR("Failed to open file "<arguments=ReadCSVArgs(args); + std::vectorarguments; + + if(spacePos!=std::string::npos){//There are arguments to parse... + size_t endingBracePos=line.find('}',spacePos+1); + if(endingBracePos==std::string::npos)ERR("Cannot parse arguments from "<(line)); }break; } @@ -143,50 +150,59 @@ void VisualNovel::Draw(){ } +VisualNovel::VisualNovel(){} + Command::Command(){} void LocationCommand::Execute(VisualNovel&vn){ } -LocationCommand::LocationCommand(std::string location){ +LocationCommand::LocationCommand(std::string location) +:location(location){ } void BackgroundCommand::Execute(VisualNovel&vn){ } -BackgroundCommand::BackgroundCommand(std::string backgroundFilename){ +BackgroundCommand::BackgroundCommand(std::string backgroundFilename) +:backgroundFilename(backgroundFilename){ } void LeftCommand::Execute(VisualNovel&vn){ } -LeftCommand::LeftCommand(std::vectorcharacters){ +LeftCommand::LeftCommand(std::vectorcharacters) +:characters(characters){ } void RightCommand::Execute(VisualNovel&vn){ } -RightCommand::RightCommand(std::vectorcharacters){ +RightCommand::RightCommand(std::vectorcharacters) +:characters(characters){ } void SpeakerCommand::Execute(VisualNovel&vn){ } -SpeakerCommand::SpeakerCommand(std::string speaker){ +SpeakerCommand::SpeakerCommand(std::string speaker) +:displayedName(speaker),actualSpeakerName(speaker){ } -SpeakerCommand::SpeakerCommand(std::string displayedName,std::string speaker){ +SpeakerCommand::SpeakerCommand(std::string displayedName,std::string speaker) +:displayedName(displayedName),actualSpeakerName(speaker){ } void DialogCommand::Execute(VisualNovel&vn){ } -DialogCommand::DialogCommand(std::string dialog){ +DialogCommand::DialogCommand(std::string dialog) +:dialog(dialog){ } diff --git a/Crawler/VisualNovel.h b/Crawler/VisualNovel.h index d91c8864..e1a27458 100644 --- a/Crawler/VisualNovel.h +++ b/Crawler/VisualNovel.h @@ -38,6 +38,12 @@ SUCH DAMAGE. class VisualNovel; +class Command{ + virtual void Execute(VisualNovel&vn)=0; +protected: + Command(); +}; + class PauseCommand final:public Command{ public: void Execute(VisualNovel&vn)override; @@ -88,12 +94,6 @@ public: LocationCommand(std::string location); }; -class Command{ - virtual void Execute(VisualNovel&vn)=0; -protected: - Command(); -}; - class VisualNovel{ std::string storyLevel; std::string activeText; @@ -101,13 +101,13 @@ class VisualNovel{ std::vectorrightCharacters; std::string backgroundFilename; std::vectorcommands; - int commandIndex; + int commandIndex=0; static safemap>>storyLevelData; static VisualNovel novel; + VisualNovel(); public: - VisualNovel()=delete; VisualNovel(VisualNovel&)=delete; VisualNovel(VisualNovel&&)=delete; static void Initialize(); diff --git a/Crawler/safemap.h b/Crawler/safemap.h index b56c3c34..95c124cf 100644 --- a/Crawler/safemap.h +++ b/Crawler/safemap.h @@ -33,6 +33,9 @@ SUCH DAMAGE. #pragma endregion #pragma once #include "Error.h" +#include +#include +#include //A class that has an initialization lock so that when the lock is activated, any further gets that are missing items in it will report themselves for easier debugging detection. template