[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.cxx,1.5,1.6 node_data.
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.cxx,1.5,1.6 node_data.cxx,1.3,1.4 stat.cxx,1.7,1.8 |
Date: |
10 Sep 2002 21:03:35 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv9330/worldmap
Modified Files:
graph.cxx node_data.cxx stat.cxx
Log Message:
added and applied to XMLhelper methods
Index: graph.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/graph.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- graph.cxx 7 Sep 2002 23:33:47 -0000 1.5
+++ graph.cxx 10 Sep 2002 21:03:33 -0000 1.6
@@ -48,11 +48,11 @@
xmlNodePtr cur = doc->ROOT;
- if (cur != NULL && strcmp((const char*)cur->name, "pingus-worldmap") == 0)
+ if (cur && XMLhelper::equal_str(cur->name, "pingus-worldmap"))
{
cur = cur->children;
- while (cur != NULL)
+ while (cur)
{
if (xmlIsBlankNode(cur))
{
@@ -60,21 +60,21 @@
continue;
}
- if (strcmp ((char*)cur->name, "node-list") == 0)
+ if (XMLhelper::equal_str(cur->name, "node-list"))
{
parse_node_list (cur);
}
- else if (strcmp ((char*)cur->name, "surface") == 0)
+ else if (XMLhelper::equal_str(cur->name, "surface"))
{
parse_background (cur);
}
- else if (strcmp ((char*)cur->name, "music") == 0)
+ else if (XMLhelper::equal_str(cur->name, "music"))
{
parse_music (cur);
}
else
{
- printf("Graph: Unhandled: %s\n", (char*)cur->name);
+ printf("Graph: Unhandled: %s\n", (const char*)cur->name);
}
cur = cur->next;
}
@@ -87,7 +87,7 @@
Graph::parse_node_list (xmlNodePtr cur)
{
cur = cur->children;
- while (cur != NULL)
+ while (cur)
{
if (xmlIsBlankNode(cur))
{
@@ -95,21 +95,21 @@
continue;
}
- if (strcmp((char*)cur->name, "empty") == 0)
+ if (XMLhelper::equal_str(cur->name, "empty"))
{
NodeData* data = EmptyNodeData::create (doc, cur);
nodes.push_back (boost::shared_ptr<class Node>
(data->create ()));
delete data;
}
- else if (strcmp((char*)cur->name, "level") == 0)
+ else if (XMLhelper::equal_str(cur->name, "level"))
{
NodeData* data = LevelNodeData::create (doc, cur);
nodes.push_back (boost::shared_ptr<class Node>
(data->create ()));
delete data;
}
- else if (strcmp((char*)cur->name, "tube") == 0)
+ else if (XMLhelper::equal_str(cur->name, "tube"))
{
NodeData* data = TubeNodeData::create (doc, cur);
nodes.push_back (boost::shared_ptr<class Node>
@@ -133,7 +133,7 @@
void
Graph::parse_music (xmlNodePtr cur)
{
- char* file = (char*)xmlGetProp(cur, (xmlChar*)"file");
+ char* file = XMLhelper::get_prop(cur, "file");
if (file)
music = file;
Index: node_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node_data.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- node_data.cxx 7 Sep 2002 23:33:47 -0000 1.3
+++ node_data.cxx 10 Sep 2002 21:03:33 -0000 1.4
@@ -83,7 +83,7 @@
cur = cur->children;
- while (cur != NULL)
+ while (cur)
{
if (xmlIsBlankNode(cur))
{
@@ -91,15 +91,15 @@
continue;
}
- if (strcmp((char*)cur->name, "node") == 0)
+ if (XMLhelper::equal_str(cur->name, "node"))
{
NodeData* node_data = NodeData::create (doc, cur);
node->assign(*node_data);
delete node_data;
}
- else if (strcmp((char*)cur->name, "level") == 0)
+ else if (XMLhelper::equal_str(cur->name, "level"))
{
- char* level = (char*)xmlGetProp(cur, (xmlChar*)"name");
+ char* level = XMLhelper::get_prop(cur, "name");
if (level)
node->levelname = std::string("levels/") + level;
else
@@ -153,21 +153,21 @@
{
NodeData* node = new NodeData ();
- char* id = (char*)xmlGetProp(cur, (xmlChar*)"id");
+ char* id = XMLhelper::get_prop(cur, "id");
if (id)
node->id = StringConverter::to_int (id);
else
std::cout << "PingusWorldMapGraph::parse_node: no node id given" <<
std::endl;
/* Accesibility should probally be placed on the links?!
- char* accessible = (char*)xmlGetProp(cur, (xmlChar*)"accessible");
+ char* accessible = XMLhelper::get_prop(cur, "accessible");
if (accessible)
node->accessible = StringConverter::to_int (accessible);
*/
cur = cur->children;
- while (cur != NULL)
+ while (cur)
{
if (xmlIsBlankNode(cur))
{
@@ -175,13 +175,13 @@
continue;
}
- if (strcmp((char*)cur->name, "position") == 0)
+ if (XMLhelper::equal_str(cur->name, "position"))
{
node->pos = XMLhelper::parse_vector (doc, cur);
}
- else if (strcmp((char*)cur->name, "link") == 0)
+ else if (XMLhelper::equal_str(cur->name, "link"))
{
- char* id = (char*)xmlGetProp(cur, (xmlChar*)"id");
+ char* id = XMLhelper::get_prop(cur, "id");
if (id)
node->links.push_back(StringConverter::to_int (id));
else
@@ -205,7 +205,7 @@
cur = cur->children;
- while (cur != NULL)
+ while (cur)
{
if (xmlIsBlankNode(cur))
{
@@ -213,15 +213,15 @@
continue;
}
- if (strcmp((char*)cur->name, "node") == 0)
+ if (XMLhelper::equal_str(cur->name, "node"))
{
NodeData* node_data = NodeData::create (doc, cur);
node->assign(*node_data);
delete node_data;
}
- else if (strcmp((char*)cur->name, "worldmap") == 0)
+ else if (XMLhelper::equal_str(cur->name, "worldmap"))
{
- char* link_node = (char*)xmlGetProp(cur, (xmlChar*)"linknode");
+ char* link_node = XMLhelper::get_prop(cur, "linknode");
if (link_node)
from_string (link_node, node->link_node);
else
@@ -229,9 +229,9 @@
node->worldmap = XMLhelper::parse_string (doc, cur);
}
- else if (strcmp((char*)cur->name, "link") == 0)
+ else if (XMLhelper::equal_str(cur->name, "link"))
{
- char* id = (char*)xmlGetProp(cur, (xmlChar*)"id");
+ char* id = XMLhelper::get_prop(cur, "id");
if (id)
node->links.push_back(StringConverter::to_int (id));
else
Index: stat.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- stat.cxx 7 Sep 2002 23:33:47 -0000 1.7
+++ stat.cxx 10 Sep 2002 21:03:33 -0000 1.8
@@ -79,15 +79,15 @@
{
doc = xmlParseFile(filename.c_str());
- if (doc == NULL)
+ if (! doc)
PingusError::raise("Couldn't open \"" + filename + "\" or syntax error.");
xmlNodePtr cur = doc->ROOT;
- if (cur && strcmp((const char*)cur->name, "pingus-worldmap-stat") == 0)
+ if (cur && XMLhelper::equal_str(cur->name, "pingus-worldmap-stat"))
{
cur = cur->children;
- while (cur != NULL)
+ while (cur)
{
if (xmlIsBlankNode(cur))
{
@@ -95,7 +95,7 @@
continue;
}
- if (strcmp((char*)cur->name, "node") == 0)
+ if (XMLhelper::equal_str(cur->name, "node"))
{
parse_node (cur);
}
@@ -119,10 +119,10 @@
PingusWorldMapStat::parse_node (xmlNodePtr cur)
{
PingusWorldMapNodeStat node;
- char* id = (char*)xmlGetProp(cur, (xmlChar*)"id");
- char* accessible = (char*)xmlGetProp(cur, (xmlChar*)"accessible");
- char* finished = (char*)xmlGetProp(cur, (xmlChar*)"finished");
- char* checksum = (char*)xmlGetProp(cur, (xmlChar*)"checksum");
+ char* id = XMLhelper::get_prop(cur, "id");
+ char* accessible = XMLhelper::get_prop(cur, "accessible");
+ char* finished = XMLhelper::get_prop(cur, "finished");
+ char* checksum = XMLhelper::get_prop(cur, "checksum");
//std::cout << "Parsing node: " << cur->name << std::endl;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.cxx,1.5,1.6 node_data.cxx,1.3,1.4 stat.cxx,1.7,1.8,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.10,1.11 ice_block.cxx,1.11,1.12 info_box.cxx,1.10,1.11 switch_door.cxx,1.11,1.12
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,1.3,1.4 fake_exit_data.cxx,1.3,1.4 guillotine_data.cxx,1.3,1.4 hammer_data.cxx,1.3,1.4 laser_exit_data.cxx,1.3,1.4 smasher_data.cxx,1.3,1.4 spike_data.cxx,1.3,1.4 teleporter_data.cxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.10,1.11 ice_block.cxx,1.11,1.12 info_box.cxx,1.10,1.11 switch_door.cxx,1.11,1.12
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,1.3,1.4 fake_exit_data.cxx,1.3,1.4 guillotine_data.cxx,1.3,1.4 hammer_data.cxx,1.3,1.4 laser_exit_data.cxx,1.3,1.4 smasher_data.cxx,1.3,1.4 spike_data.cxx,1.3,1.4 teleporter_data.cxx,1.2,1.3
- Index(es):