[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata exit_data.cxx,NONE,1.1
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata exit_data.cxx,NONE,1.1 exit_data.hxx,NONE,1.1 Makefile.am,1.15,1.16 |
Date: |
27 Sep 2002 16:01:57 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv2691/worldobjsdata
Modified Files:
Makefile.am
Added Files:
exit_data.cxx exit_data.hxx
Log Message:
splitted Exit
--- NEW FILE: exit_data.cxx ---
// $Id: exit_data.cxx,v 1.1 2002/09/27 16:01:55 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 <iostream>
#include "../string_converter.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/exit_obj.hxx"
#include "../worldobjs/exit.hxx"
#include "exit_data.hxx"
namespace WorldObjsData {
ExitData::ExitData () : owner_id(0),
use_old_pos_handling(true)
{
}
ExitData::ExitData (xmlDocPtr doc, xmlNodePtr cur) : owner_id(0),
use_old_pos_handling(true)
{
char* pos_handling = XMLhelper::get_prop(cur, "use-old-pos-handling");
if (pos_handling)
{
std::cout << "XMLPLF: Use Old Pos Handling: " << pos_handling <<
std::endl;
use_old_pos_handling = StringConverter::to_int(pos_handling);
xmlFree (pos_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, "owner-id"))
{
owner_id = XMLhelper::parse_int(doc, cur);
}
else
{
std::cout << "XMLPLF: Unhandled exit tag: " << (char*)cur->name <<
std::endl;
}
cur = cur->next;
}
}
ExitData::ExitData (const ExitData& old) : WorldObjData(old),
pos(old.pos),
desc(old.desc),
owner_id(old.owner_id),
use_old_pos_handling(old.use_old_pos_handling)
{
}
void
ExitData::write_xml (std::ostream& xml)
{
xml << "<exit use-old-pos-handling=\"" << use_old_pos_handling << "\">\n";
// FIXME: Repair me
//pos.x += surf.get_width ()/2;
//pos.y += surf.get_height ();
XMLhelper::write_vector_xml(xml, pos);
XMLhelper::write_desc_xml(xml, desc);
xml << " <owner-id>" << owner_id << "</owner-id>"
<< "</exit>\n"
<< std::endl;
}
WorldObj*
ExitData::create_WorldObj ()
{
return new WorldObjs::Exit(*this);
}
EditorObjLst
ExitData::create_EditorObj ()
{
return EditorObjLst(1, new EditorObjs::ExitObj(*this));
}
} // namespace WorldObjsData
/* EOF */
--- NEW FILE: exit_data.hxx ---
// $Id: exit_data.hxx,v 1.1 2002/09/27 16:01:55 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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_EXIT_DATA_HXX
#define HEADER_PINGUS_WORLDOBJSDATA_EXIT_DATA_HXX
#include <ClanLib/Core/Math/cl_vector.h>
#include "../libxmlfwd.hxx"
#include "../res_descriptor.hxx"
#include "../worldobj_data.hxx"
namespace WorldObjsData {
class ExitData : public WorldObjData
{
public:
CL_Vector pos;
ResDescriptor desc;
int owner_id;
/** Causes the entrance handling to fall back to the old position
treatment, that means the position is treaten as the upper/left
corner of the exit surface. The new handling treats the position
of the bottom/center position of the surface, which is much more
convenience. */
bool use_old_pos_handling;
public:
ExitData ();
ExitData (xmlDocPtr doc, xmlNodePtr cur);
ExitData (const ExitData& old);
void write_xml (std::ostream&);
WorldObj* create_WorldObj ();
EditorObjLst create_EditorObj ();
private:
ExitData& operator= (const ExitData& old);
};
} // namespace WorldObjsData
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Makefile.am 27 Sep 2002 11:26:49 -0000 1.15
+++ Makefile.am 27 Sep 2002 16:01:55 -0000 1.16
@@ -21,6 +21,7 @@
bumper_data.cxx bumper_data.hxx \
conveyor_belt_data.cxx conveyor_belt_data.hxx \
entrance_data.cxx entrance_data.hxx \
+ exit_data.cxx exit_data.hxx \
fake_exit_data.cxx fake_exit_data.hxx \
groundpiece_data.hxx groundpiece_data.cxx \
guillotine_data.cxx guillotine_data.hxx \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata exit_data.cxx,NONE,1.1 exit_data.hxx,NONE,1.1 Makefile.am,1.15,1.16,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs exit.cxx,NONE,1.1 exit.hxx,NONE,1.1 Makefile.am,1.16,1.17
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,1.6,1.7 conveyor_belt_data.cxx,1.4,1.5 fake_exit_data.cxx,1.6,1.7 groundpiece_data.cxx,1.4,1.5 guillotine_data.cxx,1.6,1.7 hammer_data.cxx,1.6,1.7 hotspot_data.cxx,1.2,1.3 ice_block_data.cxx,1.4,1.5 info_box_data.cxx,1.6,1.7 laser_exit_data.cxx,1.6,1.7 liquid_data.cxx,1.2,1.3 smasher_data.cxx,1.6,1.7 solid_color_background_data.cxx,1.2,1.3 spike_data.cxx,1.6,1.7 starfield_background_data.cxx,1.2,1.3 surface_background_data.cxx,1.2,1.3 switch_door_data.cxx,1.5,1.6 teleporter_data.cxx,1.5,1.6 thunderstorm_background_data.cxx,1.2,1.3 worldobj_group_data.cxx,1.4,1.5
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs exit.cxx,NONE,1.1 exit.hxx,NONE,1.1 Makefile.am,1.16,1.17
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,1.6,1.7 conveyor_belt_data.cxx,1.4,1.5 fake_exit_data.cxx,1.6,1.7 groundpiece_data.cxx,1.4,1.5 guillotine_data.cxx,1.6,1.7 hammer_data.cxx,1.6,1.7 hotspot_data.cxx,1.2,1.3 ice_block_data.cxx,1.4,1.5 info_box_data.cxx,1.6,1.7 laser_exit_data.cxx,1.6,1.7 liquid_data.cxx,1.2,1.3 smasher_data.cxx,1.6,1.7 solid_color_background_data.cxx,1.2,1.3 spike_data.cxx,1.6,1.7 starfield_background_data.cxx,1.2,1.3 surface_background_data.cxx,1.2,1.3 switch_door_data.cxx,1.5,1.6 teleporter_data.cxx,1.5,1.6 thunderstorm_background_data.cxx,1.2,1.3 worldobj_group_data.cxx,1.4,1.5
- Index(es):