27 #include "common/make_unique.h" 29 #include "level/level_category.h" 49 CLevelParser(LevelCategory category,
int chapter,
int rank);
50 CLevelParser(std::string category,
int chapter,
int rank);
60 static std::string
BuildScenePath(LevelCategory category,
int chapter,
int rank,
bool sceneFile =
true);
61 static std::string
BuildScenePath(std::string category,
int chapter,
int rank,
bool sceneFile =
true);
72 void SetLevelPaths(LevelCategory category,
int chapter = 0,
int rank = 0);
74 std::string
InjectLevelPaths(
const std::string& path,
const std::string& defaultDir =
"");
80 inline const std::vector<CLevelParserLineUPtr>&
GetLines()
86 void AddLine(CLevelParserLineUPtr line);
98 std::string m_filename;
99 std::vector<CLevelParserLineUPtr> m_lines;
101 std::string m_pathCat;
102 std::string m_pathChap;
103 std::string m_pathLvl;
106 inline std::string InjectLevelPathsForCurrentLevel(
const std::string& path,
const std::string& defaultDir =
"")
109 auto levelParser = MakeUnique<CLevelParser>();
110 levelParser->SetLevelPaths(main->GetLevelCategory(), main->GetLevelChap(), main->GetLevelRank());
111 return levelParser->InjectLevelPaths(path, defaultDir);
Value of command argument in level file.
Exceptions that could be thrown in level parser.
CLevelParser()
Create an empty level file.
Definition: parser.cpp:45
CRobotMain - main class of Colobot game engine.
const std::string & GetFilename()
Get filename.
Definition: parser.cpp:349
Definition: parserline.h:37
void Save()
Save file.
Definition: parser.cpp:302
Definition: robotmain.h:159
CLevelParserLine * Get(const std::string &command)
Find first line with given command.
Definition: parser.cpp:360
int CountLines(const std::string &command)
Count lines with given command.
Definition: parser.cpp:378
bool Exists()
Check if level file exists.
Definition: parser.cpp:151
void Load()
Load file.
Definition: parser.cpp:156
std::string InjectLevelPaths(const std::string &path, const std::string &defaultDir="")
Inject something% paths.
Definition: parser.cpp:324
static std::string BuildScenePath(LevelCategory category, int chapter, int rank, bool sceneFile=true)
Build level filename.
Definition: parser.cpp:146
const std::vector< CLevelParserLineUPtr > & GetLines()
Get all lines from file.
Definition: parser.h:80
CLevelParserLine * GetIfDefined(const std::string &command)
Find first line with given command, null if doesn't exist.
Definition: parser.cpp:368
static std::string BuildCategoryPath(LevelCategory category)
Build category path.
Definition: parser.cpp:85
void SetLevelPaths(LevelCategory category, int chapter=0, int rank=0)
Configure level paths for the given level.
Definition: parser.cpp:317
Class for one line from level file.
int main(int argc, char *argv[])
Entry point to the program.
Definition: main.cpp:93
void AddLine(CLevelParserLineUPtr line)
Insert new line to file.
Definition: parser.cpp:354