[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata teleporter_data.cxx,NON
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata teleporter_data.cxx,NONE,1.1 teleporter_data.hxx,NONE,1.1 |
Date: |
10 Sep 2002 12:11:31 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv19837/worldobjsdata
Added Files:
teleporter_data.cxx teleporter_data.hxx
Log Message:
added missing files
--- NEW FILE: teleporter_data.cxx ---
// $Id: teleporter_data.cxx,v 1.1 2002/09/10 12:11:29 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 <fstream>
#include "teleporter_data.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/teleporter_obj.hxx"
#include "../editorobjs/teleporter_target_obj.hxx"
#include "../worldobjs/teleporter.hxx"
namespace WorldObjsData {
TeleporterData::TeleporterData () : sprite("teleporter", "worldobjs", 20.0f,
Sprite::NONE, Sprite::ONCE),
target_sprite("teleportertarget",
"worldobjs", 20.0f, Sprite::NONE, Sprite::ONCE)
{
}
TeleporterData::TeleporterData (const TeleporterData& data) :
WorldObjData(data),
pos(data.pos),
target_pos(data.target_pos),
sprite(data.sprite),
target_sprite(data.target_sprite)
{
}
void
TeleporterData::write_xml (std::ostream& xml)
{
xml << " <worldobj type=\"teleporter\">";
XMLhelper::write_vector_xml (xml, pos);
xml << " <target>" << std::endl;
XMLhelper::write_vector_xml (xml, target_pos);
xml << " </target>" << std::endl;
xml << " </worldobj>" << std::endl;
}
TeleporterData::TeleporterData (xmlDocPtr doc, xmlNodePtr cur)
{
cur = cur->children;
while (cur != NULL)
{
if (xmlIsBlankNode(cur))
{
cur = cur->next;
continue;
}
if (strcmp((char*)cur->name, "position") == 0)
{
pos = XMLhelper::parse_vector (doc, cur);
}
else if (strcmp((char*)cur->name, "target") == 0)
{
xmlNodePtr ncur = cur->children;
if (xmlIsBlankNode(ncur)) ncur = ncur->next;
if (ncur != NULL)
target_pos = XMLhelper::parse_vector (doc, ncur);
else
std::cout << "TeleporterData::create (): <target> is empty" <<
std::endl;
}
else
{
std::cout << "TeleportData::create (): Unhandled " << cur->name <<
std::endl;
}
cur = cur->next;
}
}
WorldObj*
TeleporterData::create_WorldObj ()
{
return new WorldObjs::Teleporter(this);
}
EditorObjLst
TeleporterData::create_EditorObj ()
{
std::cout << "TeleportData::create_EditorObj () " << std::endl;
EditorObjLst objs(2);
EditorObjs::TeleporterObj* teleporter = new
EditorObjs::TeleporterObj(this);
EditorObjs::TeleporterTargetObj* teleporter_target = new
EditorObjs::TeleporterTargetObj(teleporter);
objs[0] = teleporter;
objs[1] = teleporter_target;
std::cout << "TeleportData::create_EditorObj (): done" << std::endl;
return objs;
}
}
/* EOF */
--- NEW FILE: teleporter_data.hxx ---
// $Id: teleporter_data.hxx,v 1.1 2002/09/10 12:11:29 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_TELEPORTER_DATA_HXX
#define HEADER_PINGUS_WORLDOBJSDATA_TELEPORTER_DATA_HXX
#include <ClanLib/Core/Math/cl_vector.h>
#include "../sprite.hxx"
#include "../worldobj_data.hxx"
#include "../libxmlfwd.hxx"
namespace WorldObjsData {
class TeleporterData : public WorldObjData
{
public:
CL_Vector pos;
CL_Vector target_pos;
Sprite sprite;
Sprite target_sprite;
TeleporterData ();
TeleporterData (xmlDocPtr doc, xmlNodePtr cur);
TeleporterData (const TeleporterData& data);
/** Write the content of this object formatted as xml to the given
stream */
void write_xml (std::ostream& xml);
/** Create an WorldObj from the given data object */
WorldObj* create_WorldObj ();
/** Create an EditorObj from the given data object */
EditorObjLst create_EditorObj ();
private:
TeleporterData operator= (const TeleporterData& data);
};
}
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata teleporter_data.cxx,NONE,1.1 teleporter_data.hxx,NONE,1.1,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.hxx,1.2,1.3 hammer.hxx,1.2,1.3
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs teleporter_obj.cxx,NONE,1.1 teleporter_obj.hxx,NONE,1.1 teleporter_target_obj.cxx,NONE,1.1 teleporter_target_obj.hxx,NONE,1.1
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.hxx,1.2,1.3 hammer.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs teleporter_obj.cxx,NONE,1.1 teleporter_obj.hxx,NONE,1.1 teleporter_target_obj.cxx,NONE,1.1 teleporter_target_obj.hxx,NONE,1.1
- Index(es):