[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata fake_exit_data.cxx,1.7
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata fake_exit_data.cxx,1.7,1.8 groundpiece_data.cxx,1.9,1.10 ice_block_data.cxx,1.6,1.7 info_box_data.cxx,1.8,1.9 prefab_obj_data.cxx,1.5,1.6 switch_door_data.cxx,1.7,1.8 teleporter_data.cxx,1.7,1.8 |
Date: |
18 Feb 2003 10:14:55 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv8677/src/worldobjsdata
Modified Files:
fake_exit_data.cxx groundpiece_data.cxx ice_block_data.cxx
info_box_data.cxx prefab_obj_data.cxx switch_door_data.cxx
teleporter_data.cxx
Log Message:
more XMLFileReader usage, probally more bugs and typos
Index: fake_exit_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/fake_exit_data.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- fake_exit_data.cxx 27 Sep 2002 18:36:41 -0000 1.7
+++ fake_exit_data.cxx 18 Feb 2003 10:14:52 -0000 1.8
@@ -20,6 +20,7 @@
#include <iostream>
#include "fake_exit_data.hxx"
#include "../xml_helper.hxx"
+#include "../xml_file_reader.hxx"
#include "../editorobjs/fake_exit_obj.hxx"
#include "../worldobjs/fake_exit.hxx"
#include "../pingus_resource.hxx"
@@ -32,18 +33,8 @@
FakeExitData::FakeExitData (xmlDocPtr doc, xmlNodePtr cur) :
surface(PingusResource::load_surface("Traps/fake_exit", "traps"))
{
- cur = cur->children;
- while (cur)
- {
- XMLhelper::skip_blank(cur);
-
- if (XMLhelper::equal_str(cur->name, "position"))
- {
- pos = XMLhelper::parse_vector(doc, cur);
- }
-
- cur = cur->next;
- }
+ XMLFileReader reader(doc, cur);
+ reader.read_vector("position", pos);
}
FakeExitData::FakeExitData (const FakeExitData& old) : WorldObjData(old),
Index: groundpiece_data.cxx
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/worldobjsdata/groundpiece_data.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- groundpiece_data.cxx 20 Dec 2002 19:39:13 -0000 1.9
+++ groundpiece_data.cxx 18 Feb 2003 10:14:52 -0000 1.10
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include "../xml_file_reader.hxx"
#include "../editorobjs/groundpiece_obj.hxx"
#include "../worldobjs/groundpiece.hxx"
#include "../xml_helper.hxx"
@@ -44,43 +45,20 @@
else
std::cout << "XMLPLF: groundtype empty, which might be ok." << 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 if (XMLhelper::equal_str(cur->name, "type"))
- {
- std::string type = XMLhelper::parse_string(doc, cur);
- gptype = Groundtype::string_to_type (type);
- }
- else
- {
- printf("Unhandled: %s\n", (char*)cur->name);
- }
- cur = cur->next;
- }
+ XMLFileReader reader(doc, cur);
+ reader.read_vector("position", pos);
+ reader.read_desc("surface", desc);
+ std::string type;
+ reader.read_string("type", type);
+ gptype = Groundtype::string_to_type (type);
}
GroundpieceData::GroundpieceData (const GroundpieceData& old)
- : WorldObjData(old),
- surface(old.surface),
- desc(old.desc),
- pos(old.pos),
- gptype(old.gptype)
+ : WorldObjData(old),
+ surface(old.surface),
+ desc(old.desc),
+ pos(old.pos),
+ gptype(old.gptype)
{
}
Index: ice_block_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/ice_block_data.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ice_block_data.cxx 28 Sep 2002 11:52:26 -0000 1.6
+++ ice_block_data.cxx 18 Feb 2003 10:14:52 -0000 1.7
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include "../xml_file_reader.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/ice_block_obj.hxx"
#include "../worldobjs/ice_block.hxx"
@@ -39,27 +40,9 @@
IceBlockData::IceBlockData (xmlDocPtr doc, xmlNodePtr cur)
{
- cur = cur->children;
-
- while (cur)
- {
- if (xmlIsBlankNode(cur))
- {
- cur = cur->next;
- continue;
- }
- else if (XMLhelper::equal_str(cur->name, "position"))
- {
- pos = XMLhelper::parse_vector (doc, cur);
- }
- else if (XMLhelper::equal_str(cur->name, "width"))
- {
- width = XMLhelper::parse_int (doc, cur);
- }
- else
- std::cout << "IceBlockData::creata (): Unhandled " << cur->name <<
std::endl;
- cur = cur->next;
- }
+ XMLFileReader reader(doc, cur);
+ reader.read_vector("position", pos);
+ reader.read_int("width", width);
}
void
Index: info_box_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/info_box_data.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- info_box_data.cxx 28 Sep 2002 11:52:27 -0000 1.8
+++ info_box_data.cxx 18 Feb 2003 10:14:52 -0000 1.9
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include "../xml_file_reader.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/info_box_obj.hxx"
#include "../worldobjs/info_box.hxx"
@@ -47,27 +48,9 @@
InfoBoxData::InfoBoxData (xmlDocPtr doc, xmlNodePtr cur)
{
- cur = cur->children;
-
- while (cur)
- {
- if (xmlIsBlankNode(cur))
- {
- cur = cur->next;
- continue;
- }
- else if (XMLhelper::equal_str(cur->name, "position"))
- {
- pos = XMLhelper::parse_vector (doc, cur);
- }
- else if (XMLhelper::equal_str(cur->name, "info-text"))
- {
- info_text = XMLhelper::parse_string (doc, cur);
- }
- else
- std::cout << "InfoBox::creata (): Unhandled " << cur->name << std::endl;
- cur = cur->next;
- }
+ XMLFileReader reader(doc, cur);
+ reader.read_vector("position", pos);
+ reader.read_string("info-text", info_text);
}
InfoBoxData::InfoBoxData (const InfoBoxData& old)
Index: prefab_obj_data.cxx
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/worldobjsdata/prefab_obj_data.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- prefab_obj_data.cxx 28 Sep 2002 19:31:06 -0000 1.5
+++ prefab_obj_data.cxx 18 Feb 2003 10:14:52 -0000 1.6
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include "../xml_file_reader.hxx"
#include "../xml_helper.hxx"
#include "../prefab.hxx"
#include "prefab_obj_data.hxx"
@@ -31,24 +32,9 @@
std::cout << "PrefabObjData: missing type! Default to test" << std::endl;
uid = "test";
}
-
- cur = cur->children;
-
- while (cur)
- {
- cur = XMLhelper::skip_blank (cur);
-
- if (XMLhelper::equal_str(cur->name, "position"))
- {
- pos = XMLhelper::parse_vector (doc, cur);
- }
- else
- {
- std::cout << "PrefabObjData(): Unhandled " << cur->name << std::endl;
- }
- cur = cur->next;
- }
+ XMLFileReader reader(doc, cur);
+ reader.read_vector("position", pos);
// try to load the data for this prefab-uid
data = Prefab::create (uid);
Index: switch_door_data.cxx
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/worldobjsdata/switch_door_data.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- switch_door_data.cxx 28 Sep 2002 11:52:27 -0000 1.7
+++ switch_door_data.cxx 18 Feb 2003 10:14:52 -0000 1.8
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include "../xml_file_reader.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/switch_door_obj.hxx"
#include "../worldobjs/switch_door.hxx"
@@ -32,63 +33,15 @@
SwitchDoorData::SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur)
{
- cur = cur->children;
-
- while (cur)
- {
- if (xmlIsBlankNode(cur)) {
- cur = cur->next;
- continue;
- }
-
- if (XMLhelper::equal_str(cur->name, "switch"))
- {
- xmlNodePtr subcur = cur->children;
-
- while (subcur)
- {
- if (xmlIsBlankNode(subcur)) {
- subcur = subcur->next;
- continue;
- }
-
- if (XMLhelper::equal_str(subcur->name, "position"))
- {
- switch_pos = XMLhelper::parse_vector(doc, subcur);
- }
- else
- std::cout << "SwitchDoorData: switch: Unhandled " <<
subcur->name << std::endl;
-
- subcur = subcur->next;
- }
- }
- else if (XMLhelper::equal_str(cur->name, "door"))
- {
- xmlNodePtr subcur = cur->children;
+ XMLFileReader reader(doc, cur);
+ XMLFileReader subreader;
- while (subcur)
- {
- if (xmlIsBlankNode(subcur)) {
- subcur = subcur->next;
- continue;
- }
-
- if (XMLhelper::equal_str(subcur->name, "position"))
- {
- door_pos = XMLhelper::parse_vector(doc, subcur);
- }
- else if (XMLhelper::equal_str(subcur->name, "height"))
- {
- door_height = XMLhelper::parse_int(doc, subcur);
- }
- else
- std::cout << "SwitchDoor::door: Unhandled " << subcur->name <<
std::endl;
+ reader.read_section("switch", subreader);
+ subreader.read_vector("position", switch_pos);
- subcur = subcur->next;
- }
- }
- cur = cur->next;
- }
+ reader.read_section("door", subreader);
+ subreader.read_vector("position", door_pos);
+ subreader.read_int("height", door_height);
}
SwitchDoorData::SwitchDoorData (const SwitchDoorData& old)
Index: teleporter_data.cxx
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/worldobjsdata/teleporter_data.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- teleporter_data.cxx 7 Oct 2002 23:04:14 -0000 1.7
+++ teleporter_data.cxx 18 Feb 2003 10:14:52 -0000 1.8
@@ -20,6 +20,7 @@
#include <iostream>
#include "teleporter_data.hxx"
#include "../xml_helper.hxx"
+#include "../xml_file_reader.hxx"
#include "../editorobjs/teleporter_obj.hxx"
#include "../editorobjs/teleporter_target_obj.hxx"
#include "../worldobjs/teleporter.hxx"
@@ -50,38 +51,12 @@
TeleporterData::TeleporterData (xmlDocPtr doc, xmlNodePtr cur)
{
- 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, "target"))
- {
- xmlNodePtr ncur = cur->children;
-
- if (xmlIsBlankNode(ncur)) ncur = ncur->next;
-
- if (ncur)
- 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;
- }
+ XMLFileReader reader(doc, cur);
+ XMLFileReader subreader;
- cur = cur->next;
- }
+ reader.read_vector("position", pos);
+ reader.read_section("target", subreader);
+ subreader.read_vector("position", target_pos);
}
WorldObj*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata fake_exit_data.cxx,1.7,1.8 groundpiece_data.cxx,1.9,1.10 ice_block_data.cxx,1.6,1.7 info_box_data.cxx,1.8,1.9 prefab_obj_data.cxx,1.5,1.6 switch_door_data.cxx,1.7,1.8 teleporter_data.cxx,1.7,1.8,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src xml_file_reader.cxx,1.2,1.3 xml_file_reader.hxx,1.2,1.3
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.43,1.44 editor_help_screen.cxx,1.3,1.4 panel.cxx,1.5,1.6 panel_icons.cxx,1.6,1.7 panel_icons.hxx,1.7,1.8
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src xml_file_reader.cxx,1.2,1.3 xml_file_reader.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.43,1.44 editor_help_screen.cxx,1.3,1.4 panel.cxx,1.5,1.6 panel_icons.cxx,1.6,1.7 panel_icons.hxx,1.7,1.8
- Index(es):