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 hotspot_data.cxx,NONE,1


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata hotspot_data.cxx,NONE,1.1 hotspot_data.hxx,NONE,1.1
Date: 24 Sep 2002 09:29:06 -0000

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

Added Files:
        hotspot_data.cxx hotspot_data.hxx 
Log Message:
added more missing files


--- NEW FILE: hotspot_data.cxx ---
//  $Id: hotspot_data.cxx,v 1.1 2002/09/24 09:29:04 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/hotspot_obj.hxx"
#include "../worldobjs/hotspot.hxx"
#include "../xml_helper.hxx"
#include "hotspot_data.hxx"

namespace WorldObjsData {

HotspotData::HotspotData () : speed(-1), para(1.0)
{
}

void 
HotspotData::write_xml(std::ostream& xml)
{
  xml << "<hotspot>\n";
  XMLhelper::write_desc_xml(xml, desc);
  XMLhelper::write_vector_xml(xml, pos);
  xml << "  <speed>"    << speed << "</speed>\n"
      << "  <parallax>" << para  << "</parallax>\n"
      << "</hotspot>\n" << std::endl;  
}

HotspotData::HotspotData (xmlDocPtr doc, xmlNodePtr cur)
{
  cur = cur->children;
  while (cur)
    {
      if (xmlIsBlankNode(cur)) 
        {
          cur = cur->next;
          continue;
        }
      
      if (XMLhelper::equal_str(cur->name, "surface"))
        {
          desc = XMLhelper::parse_surface(doc, cur);
        } 
      else if (XMLhelper::equal_str(cur->name, "position")) 
        {
          pos = XMLhelper::parse_vector(doc, cur);
        }
      else if (XMLhelper::equal_str(cur->name, "speed")) 
        {
          speed = XMLhelper::parse_int(doc, cur);
        }
      else if (XMLhelper::equal_str(cur->name, "parallax"))
        {
          para = XMLhelper::parse_int(doc, cur);
        }
      else
        {
          std::cout << "XMLPLF: parse_hotspot: Unhandled: " << cur->name << 
std::endl;
        }
      cur = cur->next;
    }
}

HotspotData::HotspotData (const HotspotData& old) : WorldObjData(old),
                                                    speed(old.speed),
                                                    para(old.para),
                                                    desc(old.desc),
                                                    pos(old.pos)
{
}

WorldObj* 
HotspotData::create_WorldObj ()
{
  return new WorldObjs::Hotspot(this);
}

EditorObjLst 
HotspotData::create_EditorObj ()
{
  return EditorObjLst(1, new EditorObjs::HotspotObj(this));
}

} //namespace WorldObjsData

/* EOF */

--- NEW FILE: hotspot_data.hxx ---
//  $Id: hotspot_data.hxx,v 1.1 2002/09/24 09:29:04 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_HOTSPOT_DATA_HXX
#define HEADER_PINGUS_WORLDOBJSDATA_HOTSPOT_DATA_HXX

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

namespace WorldObjsData {

class HotspotData : public WorldObjData
{
public:
  int           speed;
  float         para;
  ResDescriptor desc;
  CL_Vector     pos;

  HotspotData ();
  
  HotspotData (xmlDocPtr doc, xmlNodePtr cur);
  
  HotspotData (const HotspotData& old);

  void write_xml (std::ostream&);

  WorldObj* create_WorldObj ();
  EditorObjLst create_EditorObj ();

private:
  HotspotData operator= (const HotspotData&);
};

} // namespace WorldObjsData

#endif

/* EOF */





reply via email to

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