Change trim function on Visual Novel.

mac-build
sigonasr2 10 months ago
parent 2f4ec4677a
commit 074a53e34f
  1. 2
      Adventures in Lestoria/Version.h
  2. 12
      Adventures in Lestoria/VisualNovel.cpp
  3. BIN
      x64/Release/Adventures in Lestoria.exe

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 9020 #define VERSION_BUILD 9021
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -66,12 +66,12 @@ void VisualNovel::Initialize(){
std::string currentStory; std::string currentStory;
while(file.good()){ while(file.good()){
auto trim=[](std::string line){ auto trim = [](std::string& s)
for(int counter=0;counter<line.length();counter++){ {
if(line[counter]!=' '&&line[counter]!='\t')return line.substr(counter); s.erase(0, s.find_first_not_of(" \t\n\r\f\v"));
} s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1);
return line;
}; };
auto ReadCSVArgs=[](std::string text){ auto ReadCSVArgs=[](std::string text){
std::vector<std::string>args; std::vector<std::string>args;
size_t counter=0; size_t counter=0;
@ -86,7 +86,7 @@ void VisualNovel::Initialize(){
return args; return args;
}; };
std::getline(file,line); std::getline(file,line);
line=trim(line); trim(line);
if(line.length()==0)continue; //It's a blank line, so we skip it. if(line.length()==0)continue; //It's a blank line, so we skip it.
switch(line[0]){ switch(line[0]){

Loading…
Cancel
Save