27 #include "level/level_category.h"
29 #include "common/make_unique.h"
50 CLevelParser(LevelCategory category,
int chapter,
int rank);
51 CLevelParser(std::string category,
int chapter,
int rank);
61 static std::string
BuildScenePath(LevelCategory category,
int chapter,
int rank,
bool sceneFile =
true);
62 static std::string
BuildScenePath(std::string category,
int chapter,
int rank,
bool sceneFile =
true);
73 void SetLevelPaths(LevelCategory category,
int chapter = 0,
int rank = 0);
75 std::string
InjectLevelPaths(
const std::string& path,
const std::string& defaultDir =
"");
81 inline const std::vector<CLevelParserLineUPtr>&
GetLines()
87 void AddLine(CLevelParserLineUPtr line);
96 std::string m_filename;
97 std::vector<CLevelParserLineUPtr> m_lines;
99 std::string m_pathCat;
100 std::string m_pathChap;
101 std::string m_pathLvl;
104 inline std::string InjectLevelPathsForCurrentLevel(
const std::string& path,
const std::string& defaultDir =
"")
106 CRobotMain* main = CRobotMain::GetInstancePointer();
107 auto levelParser = MakeUnique<CLevelParser>();
108 levelParser->SetLevelPaths(main->GetLevelCategory(), main->GetLevelChap(), main->GetLevelRank());
109 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:151
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:370
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:81
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.
void AddLine(CLevelParserLineUPtr line)
Insert new line to file.
Definition: parser.cpp:354