[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata liquid_data.cxx,NONE,1.
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata liquid_data.cxx,NONE,1.1 liquid_data.hxx,NONE,1.1 Makefile.am,1.13,1.14 |
Date: |
25 Sep 2002 17:21:41 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv28111/worldobjsdata
Modified Files:
Makefile.am
Added Files:
liquid_data.cxx liquid_data.hxx
Log Message:
splitted Liquid
--- NEW FILE: liquid_data.cxx ---
// $Id: liquid_data.cxx,v 1.1 2002/09/25 17:21:39 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 <ostream>
#include "../editorobjs/liquid_obj.hxx"
#include "../worldobjs/liquid.hxx"
#include "../string_converter.hxx"
#include "../xml_helper.hxx"
#include "liquid_data.hxx"
namespace WorldObjsData {
LiquidData::LiquidData () : old_width_handling(true),
width(0),
speed(0)
{
}
LiquidData::LiquidData (xmlDocPtr doc, xmlNodePtr cur)
{
std::cout << "LiquidData::create(xmlDocPtr doc, xmlNodePtr cur)" << std::endl;
char* width_handling = XMLhelper::get_prop(cur, "use-old-width-handling");
if (width_handling)
{
std::cout << "XMLPLF: Use Old Width Handling: " << width_handling <<
std::endl;
old_width_handling = StringConverter::to_int(width_handling);
xmlFree(width_handling);
}
cur = cur->children;
while (cur)
{
if (xmlIsBlankNode(cur))
{
cur = cur->next;
continue;
}
if (XMLhelper::equal_str(cur->name, "position"))
pos = XMLhelper::parse_vector(doc, cur);
else if (XMLhelper::equal_str(cur->name, "surface"))
desc = XMLhelper::parse_surface(doc, cur);
else if (XMLhelper::equal_str(cur->name, "speed"))
speed = XMLhelper::parse_int(doc, cur);
else if (XMLhelper::equal_str(cur->name, "width"))
width = XMLhelper::parse_int(doc, cur);
else
{
std::cout << "XMLPLF::parse_liquid: Unhandled: " << cur->name <<
std::endl;
}
cur = cur->next;
}
}
LiquidData::LiquidData (const LiquidData& old) : WorldObjData(old),
desc(old.desc),
pos(old.pos),
old_width_handling(old.old_width_handling),
width(old.width),
speed(old.speed)
{
}
void
LiquidData::write_xml (std::ostream& xml)
{
std::cout << "LiquidData::write_xml(std::ostream& xml)" << std::endl;
xml << "<liquid use-old-width-handling=\"" << old_width_handling << "\">\n";
XMLhelper::write_desc_xml(xml, desc);
XMLhelper::write_vector_xml(xml, pos);
xml << " <width>" << width << "</width>\n"
<< " <speed>" << speed << "</speed>\n"
<< "</liquid>\n" << std::endl;
}
WorldObj*
LiquidData::create_WorldObj ()
{
std::cout << "LiquidData::create_WorldObj ()" << std::endl;
return new WorldObjs::Liquid(this);
}
EditorObjLst
LiquidData::create_EditorObj ()
{
std::cout << "LiquidData::create_EditorObj ()" << std::endl;
return EditorObjLst(1, new EditorObjs::LiquidObj(this));
}
} // namespace WorldObjsData
/* EOF */
--- NEW FILE: liquid_data.hxx ---
// $Id: liquid_data.hxx,v 1.1 2002/09/25 17:21:39 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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_WORLDOBJSDATA_LIQUID_DATA_HXX
#define HEADER_PINGUS_WORLDOBJSDATA_LIQUID_DATA_HXX
#include <ClanLib/Core/Math/cl_vector.h>
#include "../libxmlfwd.hxx"
#include "../res_descriptor.hxx"
#include "../worldobj_data.hxx"
namespace WorldObjsData {
class LiquidData : public WorldObjData
{
public:
ResDescriptor desc;
CL_Vector pos;
/** Cause to interpret the width in pixels instead of tiles */
bool old_width_handling;
int width;
int speed;
public:
LiquidData ();
LiquidData (xmlDocPtr doc, xmlNodePtr cur);
LiquidData (const LiquidData& old);
void write_xml(std::ostream&);
/** Create an WorldObj from the given data object */
WorldObj* create_WorldObj ();
/** Create an EditorObj from the given data object */
EditorObjLst create_EditorObj ();
private:
LiquidData operator= (const LiquidData&);
};
} // namespace WorldObjsData
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile.am 21 Sep 2002 16:52:40 -0000 1.13
+++ Makefile.am 25 Sep 2002 17:21:39 -0000 1.14
@@ -28,6 +28,7 @@
ice_block_data.cxx ice_block_data.hxx \
info_box_data.cxx info_box_data.hxx \
laser_exit_data.cxx laser_exit_data.hxx \
+ liquid_data.cxx liquid_data.hxx \
prefab_obj_data.cxx prefab_obj_data.hxx \
rain_generator_data.hxx rain_generator_data.cxx \
smasher_data.cxx smasher_data.hxx \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata liquid_data.cxx,NONE,1.1 liquid_data.hxx,NONE,1.1 Makefile.am,1.13,1.14,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.107,1.108 worldobj_data_factory.cxx,1.22,1.23 xml_plf.cxx,1.22,1.23
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs liquid_obj.cxx,NONE,1.1 liquid_obj.hxx,NONE,1.1 Makefile.am,1.10,1.11
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.107,1.108 worldobj_data_factory.cxx,1.22,1.23 xml_plf.cxx,1.22,1.23
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs liquid_obj.cxx,NONE,1.1 liquid_obj.hxx,NONE,1.1 Makefile.am,1.10,1.11
- Index(es):