pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata groundpiece_data.cxx,NO


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata groundpiece_data.cxx,NONE,1.1 groundpiece_data.hxx,NONE,1.1 Makefile.am,1.9,1.10
Date: 16 Sep 2002 20:31:11 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv10000/worldobjsdata

Modified Files:
        Makefile.am 
Added Files:
        groundpiece_data.cxx groundpiece_data.hxx 
Log Message:
- some groundpiece splitting/moving

--- NEW FILE: groundpiece_data.cxx ---
//  $Id: groundpiece_data.cxx,v 1.1 2002/09/16 20:31:09 grumbel 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 "../editor/editor_groundpiece_obj.hxx"
#include "../worldobjs/groundpiece.hxx"
#include "../world.hxx"
#include "../xml_helper.hxx"

namespace WorldObjsData {

GroundpieceData::GroundpieceData () 
{
  // do nothing
}

GroundpieceData::GroundpieceData (xmlDocPtr doc, xmlNodePtr cur)
{
  gptype = Groundtype::GP_GROUND;

  char* gptype_c_str = XMLhelper::get_prop(cur, "type");
  if (gptype_c_str)
    {
      gptype = Groundtype::string_to_type (gptype_c_str);
      xmlFree(gptype_c_str);
    }
  else
    std::cout << "XMLPLF: groundtype empty" << std::endl;

  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
        {
          printf("Unhandled: %s\n", (char*)cur->name);
        }
      cur = cur->next;  
    }
}

GroundpieceData::GroundpieceData (const GroundpieceData& old) 
                                 : surface(old.surface),
                                   desc(old.desc),
                                   pos(old.pos),
                                   gptype(old.gptype)
{
}

GroundpieceData
GroundpieceData::operator= (const GroundpieceData& old)
{
  if (this == &old)
    return *this;
    
  surface  = old.surface;
  desc     = old.desc;
  pos      = old.pos;
  gptype   = old.gptype;
  
  return *this;
}

GroundpieceData::~GroundpieceData ()
{
}
EditorObjLst
GroundpieceData::create_EditorObj()
{
  EditorObjLst lst;
  lst.push_back(new EditorGroundpieceObj(*this));
  return lst;
}

WorldObj*
GroundpieceData::create_WorldObj()
{
  return new WorldObjs::Groundpiece(*this);
}

void
GroundpieceData::write_xml(std::ostream& xml)
{
  xml << "<groundpiece type=\"" << Groundtype::type_to_string(gptype) << 
"\">\n";
  XMLhelper::write_desc_xml(xml, desc);
  XMLhelper::write_vector_xml(xml, pos);
  xml << "</groundpiece>\n" << std::endl;
}

} // namespace WorldObjsData

/* EOF */

--- NEW FILE: groundpiece_data.hxx ---
//  $Id: groundpiece_data.hxx,v 1.1 2002/09/16 20:31:09 grumbel 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_GROUNDPIECE_DATA_HXX
#define HEADER_PINGUS_GROUNDPIECE_DATA_HXX

#include <ClanLib/Core/Math/cl_vector.h>
#include <ClanLib/Display/Display/surface.h>
#include "../libxmlfwd.hxx"
#include "../res_descriptor.hxx"
#include "../worldobj_data.hxx"
#include "../groundtype.hxx"

class EditorObj;
class WorldObj;

namespace WorldObjsData {

class GroundpieceData : public WorldObjData
{
public:
  CL_Surface surface;
  ResDescriptor desc;
  CL_Vector pos;
  
  Groundtype::GPType gptype; 

  GroundpieceData ();
  GroundpieceData (xmlDocPtr doc, xmlNodePtr cur);
  
  GroundpieceData (const GroundpieceData& old);
  GroundpieceData operator= (const GroundpieceData& old);

  ~GroundpieceData ();

  WorldObj*    create_WorldObj();
  EditorObjLst create_EditorObj();

  void write_xml(std::ostream& xml);
};

} // namespace WorldObjsData

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am 16 Sep 2002 15:47:35 -0000      1.9
+++ Makefile.am 16 Sep 2002 20:31:09 -0000      1.10
@@ -21,6 +21,7 @@
        bumper_data.cxx                 bumper_data.hxx \
        conveyor_belt_data.cxx          conveyor_belt_data.hxx \
        fake_exit_data.cxx              fake_exit_data.hxx \
+        groundpiece_data.hxx            groundpiece_data.cxx \
        guillotine_data.cxx             guillotine_data.hxx \
        hammer_data.cxx                 hammer_data.hxx \
        ice_block_data.cxx              ice_block_data.hxx \





reply via email to

[Prev in Thread] Current Thread [Next in Thread]