From 740036e430d98afe487313bb5be8c5e72968eb94 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 24 Sep 2014 22:54:26 +0200 Subject: New level parser Known issues: * TerrainLevel for some reason doesn't work * %lvl% is not yet implemented everywhere because of hardcoded directories in functions --- src/object/level/parserline.cpp | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/object/level/parserline.cpp (limited to 'src/object/level/parserline.cpp') diff --git a/src/object/level/parserline.cpp b/src/object/level/parserline.cpp new file mode 100644 index 0000000..37f6397 --- /dev/null +++ b/src/object/level/parserline.cpp @@ -0,0 +1,87 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * This program is free software: you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published by +// * the Free Software Foundation, either version 3 of the License, or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program. If not, see http://www.gnu.org/licenses/. + +#include "object/level/parserline.h" + + +#include "object/level/parser.h" +#include "common/logger.h" + +CLevelParserLine::CLevelParserLine(std::string command) +{ + m_command = command; + m_lineNumber = 0; +} + +CLevelParserLine::CLevelParserLine(int lineNumber, std::string command) +{ + m_command = command; + m_lineNumber = lineNumber; +} + +CLevelParserLine::~CLevelParserLine() +{ + for(auto param : m_params) + { + delete param.second; + } +} + +std::string CLevelParserLine::GetLine() +{ + assert(false); //TODO +} + +int CLevelParserLine::GetLineNumber() +{ + return m_lineNumber; +} + +CLevelParser* CLevelParserLine::GetLevel() +{ + return m_level; +} + +void CLevelParserLine::SetLevel(CLevelParser* level) +{ + m_level = level; +} + +std::string CLevelParserLine::GetCommand() +{ + return m_command; +} + +void CLevelParserLine::SetCommand(std::string command) +{ + m_command = command; +} + +CLevelParserParam* CLevelParserLine::GetParam(std::string name) +{ + if(m_params[name] == nullptr) { + CLevelParserParam* param = new CLevelParserParam(name, true); + param->SetLine(this); + m_params[name] = param; + } + return m_params[name]; +} + +void CLevelParserLine::AddParam(std::string name, CLevelParserParam* value) +{ + value->SetLine(this); + m_params[name] = value; +} \ No newline at end of file -- cgit v1.2.3-1-g7c22 From 47ea8a1175488564c11e09f71447cb19515c6e6c Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 15 Oct 2014 21:14:34 +0200 Subject: Updated some more license headers --- src/object/level/parserline.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/object/level/parserline.cpp') diff --git a/src/object/level/parserline.cpp b/src/object/level/parserline.cpp index 37f6397..e0e8097 100644 --- a/src/object/level/parserline.cpp +++ b/src/object/level/parserline.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/level/parserline.h" -- cgit v1.2.3-1-g7c22