[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2802 - in branches/pingus_sdl: . src
From: |
jsalmon3 |
Subject: |
[Pingus-CVS] r2802 - in branches/pingus_sdl: . src |
Date: |
Sat, 4 Aug 2007 23:01:30 +0200 |
Author: jsalmon3
Date: 2007-08-04 23:01:18 +0200 (Sat, 04 Aug 2007)
New Revision: 2802
Removed:
branches/pingus_sdl/src/xml_eval.cpp
branches/pingus_sdl/src/xml_eval.hpp
branches/pingus_sdl/src/xml_file_reader.cpp
branches/pingus_sdl/src/xml_file_reader.hpp
branches/pingus_sdl/src/xml_file_writer.cpp
branches/pingus_sdl/src/xml_file_writer.hpp
branches/pingus_sdl/src/xml_pdf.cpp
branches/pingus_sdl/src/xml_pdf.hpp
branches/pingus_sdl/src/xml_pingus_level.cpp
branches/pingus_sdl/src/xml_pingus_level.hpp
Modified:
branches/pingus_sdl/pingus.vcproj
branches/pingus_sdl/src/SConscript
branches/pingus_sdl/src/plf_res_mgr.cpp
Log:
Removed unused xml files
Modified: branches/pingus_sdl/pingus.vcproj
===================================================================
--- branches/pingus_sdl/pingus.vcproj 2007-08-04 20:19:23 UTC (rev 2801)
+++ branches/pingus_sdl/pingus.vcproj 2007-08-04 21:01:18 UTC (rev 2802)
@@ -890,26 +890,6 @@
RelativePath=".\src\worldobj_factory.hpp"
>
</File>
- <File
- RelativePath=".\src\xml_eval.hpp"
- >
- </File>
- <File
- RelativePath=".\src\xml_file_reader.hpp"
- >
- </File>
- <File
- RelativePath=".\src\xml_file_writer.hpp"
- >
- </File>
- <File
- RelativePath=".\src\xml_pdf.hpp"
- >
- </File>
- <File
- RelativePath=".\src\xml_pingus_level.hpp"
- >
- </File>
<Filter
Name="actions"
>
Modified: branches/pingus_sdl/src/SConscript
===================================================================
--- branches/pingus_sdl/src/SConscript 2007-08-04 20:19:23 UTC (rev 2801)
+++ branches/pingus_sdl/src/SConscript 2007-08-04 21:01:18 UTC (rev 2802)
@@ -304,10 +304,6 @@
'worldobjs/thunderstorm_background.cpp',
'worldobjs/woodthing.cpp',
-# 'xml_file_reader.cpp',
-# 'xml_file_writer.cpp',
-# 'xml_pdf.cpp',
-# 'xml_pingus_level.cpp'
],
CPPPATH = env['CPPPATH'] + ['..'] + ['.'])
Modified: branches/pingus_sdl/src/plf_res_mgr.cpp
===================================================================
--- branches/pingus_sdl/src/plf_res_mgr.cpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/plf_res_mgr.cpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -21,7 +21,6 @@
#include "debug.hpp"
#include "system.hpp"
#include "path_manager.hpp"
-#include "xml_pingus_level.hpp"
#include "plf_res_mgr.hpp"
Deleted: branches/pingus_sdl/src/xml_eval.cpp
===================================================================
--- branches/pingus_sdl/src/xml_eval.cpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/xml_eval.cpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -1,173 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/core.h>
-#include "xml_eval.hpp"
-
-namespace XMLEval {
-
-std::map<std::string, int> variables;
-std::map<std::string, CL_DomNode> functions;
-
-int lookup(const std::string& name)
-{
- int value = 0;
-
- if (CL_String::from(name, value))
- {
- return value;
- }
- else
- {
- std::map<std::string, int>::iterator i = variables.find(name);
-
- if (i != variables.end())
- {
- return i->second;
- }
- std::cout << "Error: No variable named: '" << name << "'" << std::endl;
- return 0;
- }
-}
-
-void eval_block(CL_DomNode child)
-{
- while(!child.is_null())
- {
- if (child.is_element())
- eval(child);
-
- child = child.get_next_sibling();
- }
-}
-
-void eval(const CL_DomNode& cur)
-{
- CL_DomElement el = cur.to_element();
-
- if (cur.is_element())
- {
- if (cur.get_node_name() == "for")
- {
- std::string var = el.get_attribute("name");
-
- for(int i = lookup(el.get_attribute("start"));
- i <= lookup(el.get_attribute("end")); ++i)
- {
- variables[var] = i;
- eval_block(cur.get_first_child());
- }
- }
- else if (cur.get_node_name() == "newline")
- {
- std::cout << std::endl;
- }
- else if (cur.get_node_name() == "printvar")
- {
- std::cout << lookup(el.get_attribute("var")) << std::flush;
- }
- else if (cur.get_node_name() == "print")
- {
- std::cout << el.get_attribute("string") << std::flush;
- }
- else if (cur.get_node_name() == "foobar")
- {
- std::cout << "Foobar" << std::endl;
- }
- else if (cur.get_node_name() == "block")
- {
- eval_block(cur.get_first_child());
- }
- else if (cur.get_node_name() == "set")
- {
- variables[el.get_attribute("name")] =
lookup(el.get_attribute("var"));
- }
- else if (cur.get_node_name() == "function")
- {
- functions[el.get_attribute("name")] = el.get_first_child();
- }
- else if (cur.get_node_name() == "modulo")
- {
- variables[el.get_attribute("name")]
- = lookup(el.get_attribute("name")) %
lookup(el.get_attribute("var"));
- }
- else if (cur.get_node_name() == "add")
- {
- variables[el.get_attribute("name")]
- = lookup(el.get_attribute("name")) +
lookup(el.get_attribute("var"));
- }
- else if (cur.get_node_name() == "if-non-zero")
- {
- int var = lookup(el.get_attribute("var"));
- if (var != 0)
- eval_block(cur.get_first_child());
- }
- else if (cur.get_node_name() == "if-zero")
- {
- int var = lookup(el.get_attribute("var"));
- if (var == 0)
- eval_block(cur.get_first_child());
- }
- else if (cur.get_node_name() == "mult")
- {
- variables[el.get_attribute("name")]
- = lookup(el.get_attribute("name")) *
lookup(el.get_attribute("val"));
- }
- else if (cur.get_node_name() == "funcall")
- {
- eval_block(functions[el.get_attribute("name")]);
- }
- else
- {
- std::cout << "Unknown command: " << cur.get_node_name() << std::endl;
- }
- }
- else
- {
- std::cout << "Unknown thingy" << std::endl;
- }
-}
-
-} // namespace XMLEval
-
-int main(int argc, char** argv)
-{
- try {
- CL_SetupCore::init();
-
- std::string filename = "test.xml";
-
- if (argc > 1)
- filename = argv[1];
-
- CL_DomDocument dom(new CL_InputSource_File(filename), true);
-
- CL_DomNode cur = dom.get_document_element();
-
- XMLEval::eval(cur);
-
- CL_SetupCore::deinit();
- } catch (CL_Error& err) {
- std::cout << "CL_Error: " << err.message << std::endl;
- }
- return 0;
-}
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_eval.hpp
===================================================================
--- branches/pingus_sdl/src/xml_eval.hpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/xml_eval.hpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -1,33 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_EVAL_HXX
-#define HEADER_XML_EVAL_HXX
-
-namespace XMLEval {
-
-void eval(const CL_DomNode& cur);
-void eval_block(CL_DomNode cur);
-int lookup(const std::string& name);
-
-} // namespace XMLEval
-
-#endif
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_file_reader.cpp
===================================================================
--- branches/pingus_sdl/src/xml_file_reader.cpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/xml_file_reader.cpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -1,213 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/Display/color.h>
-#include <ClanLib/Core/Math/size.h>
-#include <ClanLib/Core/XML/dom_element.h>
-#include <ClanLib/Core/XML/dom_node_list.h>
-#include <ClanLib/Core/XML/dom_named_node_map.h>
-#include <ClanLib/Core/System/clanstring.h>
-#include "file_reader_impl.hpp"
-#include "vector.hpp"
-#include "res_descriptor.hpp"
-#include "resource_modifier.hpp"
-////#include "xml_file_reader.hpp"
-
-
-class XMLFileReaderImpl : public FileReaderImpl
-{
-private:
- CL_DomElement root;
- CL_DomNodeList childs;
-
- CL_DomElement get_node_by_name(const char* name) const
- {
- for(int i = 0; i < childs.get_length(); ++i)
- {
- if (childs.item(i).is_element())
- {
- if (childs.item(i).to_element().get_tag_name() == name)
- {
- return childs.item(i).to_element();
- }
- }
- }
- return CL_DomElement();
- }
-public:
-
- XMLFileReaderImpl(CL_DomElement element)
- : root(element),
- childs(root.get_child_nodes())
- {
- }
-
- std::string get_name() const
- {
- return root.get_tag_name();
- }
-
- bool read_int(const char* name, int& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- return !node.is_null() &&
CL_String::from(node.get_first_child().get_node_value(), value);
- }
-
- bool read_float (const char* name, float& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- return !node.is_null() &&
CL_String::from(node.get_first_child().get_node_value(), value);
- }
-
- bool read_bool (const char* name, bool& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- return !node.is_null() &&
CL_String::from(node.get_first_child().get_node_value(), value);
- }
-
- bool read_string(const char* name, std::string& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (!node.is_null())
- {
- value = node.get_first_child().get_node_value();
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_vector(const char* name, Vector& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (node.is_element())
- {
- XMLFileReader reader(node.to_element());
- reader.read_float("x", value.x);
- reader.read_float("y", value.y);
- reader.read_float("z", value.z);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_color(const char* name, Colorf& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (node.is_element())
- {
- XMLFileReader reader(node.to_element());
- reader.read_float("red", value.red);
- reader.read_float("green", value.green);
- reader.read_float("blue", value.blue);
- reader.read_float("alpha", value.alpha);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_size(const char* name, CL_Size& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (node.is_element())
- {
- XMLFileReader reader(node.to_element());
- reader.read_int("width", value.width);
- reader.read_int("height", value.height);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_desc(const char* name, ResDescriptor& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (!node.is_null())
- {
- using ResourceModifierNS::rs_from_string;
-
- XMLFileReader reader(node);
- reader.read_string("image", value.res_name);
- reader.read_enum ("modifier", value.modifier, rs_from_string);
-
- return true;
- }
- else
- {
- return false;
- }
-
- }
-
- bool read_section(const char* name, FileReader& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (!node.is_null())
- {
- value = XMLFileReader(node);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- std::vector<FileReader> get_sections() const
- {
- std::vector<FileReader> lst;
- for(int i = 0; i < childs.get_length(); ++i)
- {
- if (childs.item(i).is_element())
- lst.push_back(XMLFileReader(childs.item(i).to_element()));
- }
- return lst;
- }
-
- std::vector<std::string> get_section_names() const
- {
- std::vector<std::string> lst;
- for(int i = 0; i < childs.get_length(); ++i)
- {
- if (childs.item(i).is_element())
- lst.push_back(childs.item(i).to_element().get_tag_name());
- }
- return lst;
- }
-};
-
-XMLFileReader::XMLFileReader(CL_DomElement element)
- : FileReader(SharedPtr<FileReaderImpl>(new XMLFileReaderImpl(element)))
-{
-}
-
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_file_reader.hpp
===================================================================
--- branches/pingus_sdl/src/xml_file_reader.hpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/xml_file_reader.hpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -1,38 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_FILE_READER_HXX
-#define HEADER_XML_FILE_READER_HXX
-
-#if 0
-#include <ClanLib/Core/XML/dom_element.h>
-#include "file_reader.hpp"
-
-/** */
-class XMLFileReader : public FileReader
-{
-public:
- XMLFileReader(CL_DomElement element);
-};
-#endif
-
-#endif
-
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_file_writer.cpp
===================================================================
--- branches/pingus_sdl/src/xml_file_writer.cpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/xml_file_writer.cpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -1,129 +0,0 @@
-// $Id: xml_file_writer.cxx,v 1.6 2004/03/31 18:17:38 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <map>
-#include "vector.hpp"
-///#include "xml_file_writer.hpp"
-
-
-XMLFileWriter::XMLFileWriter(std::ostream& out_)
- : out(&out_)
-{
- (*out) << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
-}
-
-XMLFileWriter::~XMLFileWriter()
-{
-
-}
-
-void
-XMLFileWriter::begin_section (const char* name)
-{
- (*out) << "<" << name << ">\n";
- section_stack.push(name);
-}
-
-void
-XMLFileWriter::begin_section (const char* name, const char* attributes)
-{
- (*out) << "<" << name << " " << attributes << ">\n";
- section_stack.push(name);
-}
-
-void
-XMLFileWriter::end_section ()
-{
- const std::string& section_name = section_stack.top();
-
- (*out) << "</" << section_name << ">\n";
-
- section_stack.pop();
-}
-
-void
-XMLFileWriter::write_int (const char* name, int value)
-{
- (*out) << "<" << name << ">" << value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_float (const char* name, float value)
-{
- (*out) << "<" << name << ">" << value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_color (const char* name, const Color& color)
-{
- (*out) << "<" << name << ">\n"
- << " <red>" << int(color.r * 255) << "</red>\n"
- << " <green>" << int(color.g * 255) << "</green>\n"
- << " <blue>" << int(color.b * 255) << "</blue>\n"
- << " <alpha>" << int(color.a * 255) << "</alpha>\n"
- << "</" << name << ">"
- << std::endl;
-}
-
-void
-XMLFileWriter::write_bool (const char* name, bool value)
-{
- (*out) << "<" << name << ">" << value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_string (const char* name, const std::string& value)
-{
- // Perform basic XML encoding (turns apostrophes into ', etc.
- std::string new_value = value;
- std::string::size_type pos;
-
- std::map<std::string, std::string> replacements;
-
- replacements["&"] = "&";
- replacements["\""] = """;
- replacements["\'"] = "'";
- replacements["<"] = "<";
- replacements[">"] = ">";
-
- for (std::map<std::string, std::string>::iterator i =
replacements.begin();
- i != replacements.end(); i++)
- {
- for (pos = new_value.find(i->first); pos != std::string::npos;
pos = new_value.find(i->first))
- {
- // Replace character with encoding characters
- new_value.replace(pos, 1, i->second);
- }
- }
-
- (*out) << "<" << name << ">" << new_value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_vector (const char* name, const Vector3f& value)
-{
- (*out) << "<" << name << ">\n"
- << " <x>" << value.x << "</x>\n"
- << " <y>" << value.y << "</y>\n"
- << " <z>" << value.z << "</z>\n"
- << "</" << name << ">\n";
-}
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_file_writer.hpp
===================================================================
--- branches/pingus_sdl/src/xml_file_writer.hpp 2007-08-04 20:19:23 UTC (rev
2801)
+++ branches/pingus_sdl/src/xml_file_writer.hpp 2007-08-04 21:01:18 UTC (rev
2802)
@@ -1,67 +0,0 @@
-// $Id: xml_file_writer.hxx,v 1.6 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_FILE_WRITER_HXX
-#define HEADER_XML_FILE_WRITER_HXX
-
-#include <stack>
-#include <iosfwd>
-#include "math/color.hpp"
-#include "file_writer.hpp"
-
-
-/** */
-class XMLFileWriter : public FileWriter
-{
-private:
- /** A reference to the output stream */
- std::ostream* out;
-
- std::stack<std::string> section_stack;
-
-public:
- XMLFileWriter(std::ostream& out_);
- virtual ~XMLFileWriter();
-
- void begin_section (const char* name);
- void begin_section (const char* name, const char* attributes);
- void end_section ();
-
- void write_int (const char* name, int);
- void write_float (const char* name, float);
- void write_bool (const char* name, bool);
- void write_color (const char* name, const Color&);
- void write_string (const char* name, const std::string&);
- void write_vector (const char* name, const Vector3f&);
-
- template<class E, class F>
- void write_enum (const char* name, E value, F enum2string)
- {
- (*out) << "<" << name << ">" << enum2string(value) << "</" << name <<
">\n";
- }
-
-private:
- XMLFileWriter (const XMLFileWriter&);
- XMLFileWriter& operator= (const XMLFileWriter&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_pdf.cpp
===================================================================
--- branches/pingus_sdl/src/xml_pdf.cpp 2007-08-04 20:19:23 UTC (rev 2801)
+++ branches/pingus_sdl/src/xml_pdf.cpp 2007-08-04 21:01:18 UTC (rev 2802)
@@ -1,111 +0,0 @@
-// $Id: xml_pdf.cxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <iostream>
-#include <vector>
-#include <ClanLib/core.h>
-#include "pingus_error.hpp"
-#include "path_manager.hpp"
-#include "xml_pingus_level.hpp"
-////#include "xml_file_reader.hpp"
-#include "xml_pdf.hpp"
-
-
-XMLPDF::XMLPDF(const std::string& filename)
-{
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() != "pingus-demo")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-demo> file");
- }
- else
- {
- XMLFileReader reader(root);
-
- reader.read_string ("level", levelname);
-
- FileReader events_reader;
- reader.read_section("events", events_reader);
- const std::vector<FileReader>& objects = events_reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = objects.begin();
- i != objects.end(); ++i)
- {
- events.push_back(ServerEvent(*i));
- }
- }
-
- std::reverse(events.begin(), events.end());
-
- if (levelname.empty())
- PingusError::raise("XMLPDF: No level given");
-
- plf = XMLPingusLevel(path_manager.complete("levels/" + levelname +
".pingus"),
- path_manager.complete("levels/" + levelname +
".pingus"));
-
- std::cout << "XXXXXXXXX Read Demo file: " << std::endl;
- write_xml(std::cout);
-}
-
-XMLPDF::~XMLPDF()
-{
-}
-
-void
-XMLPDF::write_xml(std::ostream& xml)
-{
- xml << "<pingus-demo>\n"
- << " <level>" << levelname << "</level>\n"
- << " <events>\n";
-
- for(std::vector<ServerEvent>::iterator i = events.begin();
- i != events.end();
- ++i)
- i->write_xml(xml);
-
- xml << " </events>\n";
-}
-
-/** @return a pointer to the level structure */
-PingusLevel
-XMLPDF::get_plf()
-{
- return plf;
-}
-
-/** @return the levelname */
-std::string
-XMLPDF::get_levelname()
-{
- return levelname;
-}
-
-/** Returns a reference to the events of this demo */
-std::vector<ServerEvent>
-XMLPDF::get_events()
-{
- return events;
-}
-
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_pdf.hpp
===================================================================
--- branches/pingus_sdl/src/xml_pdf.hpp 2007-08-04 20:19:23 UTC (rev 2801)
+++ branches/pingus_sdl/src/xml_pdf.hpp 2007-08-04 21:01:18 UTC (rev 2802)
@@ -1,63 +0,0 @@
-// $Id: xml_pdf.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_XML_PDF_HXX
-#define HEADER_PINGUS_XML_PDF_HXX
-
-#include <string>
-#include <vector>
-#include <iosfwd>
-
-#include "pingus_level.hpp"
-#include "server_event.hpp"
-
-
-/** XMLPDF stands for Pingus Demo File, it contains all the infos
- necesarry to play a pingus demo recording */
-class XMLPDF
-{
-private:
- PingusLevel plf;
- std::string levelname;
- std::vector<ServerEvent> events;
-
-public:
- XMLPDF(const std::string& filename);
- ~XMLPDF();
-
- /** @return a pointer to the level structure */
- PingusLevel get_plf();
-
- /** @return the levelname */
- std::string get_levelname();
-
- /** Returns a reference to the events of this demo */
- std::vector<ServerEvent> get_events();
-
- void write_xml(std::ostream& xml);
-
-private:
- XMLPDF (const XMLPDF&);
- XMLPDF& operator= (const XMLPDF&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_pingus_level.cpp
===================================================================
--- branches/pingus_sdl/src/xml_pingus_level.cpp 2007-08-04 20:19:23 UTC
(rev 2801)
+++ branches/pingus_sdl/src/xml_pingus_level.cpp 2007-08-04 21:01:18 UTC
(rev 2802)
@@ -1,113 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <vector>
-#include <iostream>
-#include <ClanLib/Core/IOData/inputsource_provider_file.h>
-#include <ClanLib/Core/System/clanstring.h>
-#include <ClanLib/Core/XML/dom_node.h>
-#include <ClanLib/Core/XML/dom_attr.h>
-#include <ClanLib/Core/XML/dom_node_list.h>
-#include <ClanLib/Core/XML/dom_document.h>
-#include <ClanLib/Core/XML/dom_named_node_map.h>
-#include <ClanLib/Core/XML/dom_element.h>
-#include "pingus_error.hpp"
-////#include "xml_file_reader.hpp"
-#include "pingus_level_impl.hpp"
-#include "xml_pingus_level.hpp"
-
-
-XMLPingusLevel::XMLPingusLevel(const std::string& res_name,
- const std::string& filename)
-{
- impl->resname = res_name;
-
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() != "pingus-level")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-level> file");
- }
- else
- {
- CL_DomNodeList lst = root.get_child_nodes();
-
- for(int i = 0; i < lst.get_length(); ++i)
- {
- CL_DomElement node = lst.item(i).to_element();
-
- if (node.get_tag_name() == "version")
- {
- int version =
CL_String::to_int(node.get_first_child().get_node_value());
-
- if (version < 2)
- {
- PingusError::raise("Error: Level version is " +
node.get_node_value()
- + ", can only handle level files of
version 2 or larger, use pingusv0tov1.xsl to convert them");
- }
- }
- else if (node.get_tag_name() == "head")
- {
- XMLFileReader reader(node);
- reader.read_string("levelname", impl->levelname);
- reader.read_string("description", impl->description);
- reader.read_size ("levelsize", impl->size);
- reader.read_string("music", impl->music);
- reader.read_int ("time", impl->time);
- reader.read_int ("difficulty", impl->difficulty);
- reader.read_int ("number-of-pingus", impl->number_of_pingus);
- reader.read_int ("number-to-save", impl->number_to_save);
- reader.read_color ("ambient-light", impl->ambient_light);
- reader.read_string("author", impl->author);
-
- if (impl->levelname ==
std::string())
- impl->levelname
= impl->resname;
-
- FileReader actions_reader;
- reader.read_section("actions", actions_reader);
- const std::vector<std::string>& actions =
actions_reader.get_section_names();
- for(std::vector<std::string>::const_iterator i =
actions.begin();
- i != actions.end(); ++i)
- {
- int count = 0;
- actions_reader.read_int(i->c_str(), count);
- impl->actions[*i] = count;
- }
- }
- else if (node.get_tag_name() == "objects")
- {
- CL_DomNodeList objects = node.get_child_nodes();
- for(int i = 0; i < objects.get_length(); ++i)
- {
-
impl->objects.push_back(XMLFileReader(objects.item(i).to_element()));
- }
- }
- else
- {
- std::cout << "Warning: Unknown element: " << node.get_tag_name()
<< std::endl;
- }
- }
- }
- }
-
-
-/* EOF */
Deleted: branches/pingus_sdl/src/xml_pingus_level.hpp
===================================================================
--- branches/pingus_sdl/src/xml_pingus_level.hpp 2007-08-04 20:19:23 UTC
(rev 2801)
+++ branches/pingus_sdl/src/xml_pingus_level.hpp 2007-08-04 21:01:18 UTC
(rev 2802)
@@ -1,38 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_PINGUS_LEVEL_HXX
-#define HEADER_XML_PINGUS_LEVEL_HXX
-
-#include "pingus_level.hpp"
-
-
-/** */
-class XMLPingusLevel : public PingusLevel
-{
-private:
-public:
- XMLPingusLevel(const std::string& res_name,
- const std::string& filename);
-};
-
-
-#endif
-
-/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2802 - in branches/pingus_sdl: . src,
jsalmon3 <=