[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap path_graph.cxx,1.19,1.20 pat
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap path_graph.cxx,1.19,1.20 path_graph.hxx,1.8,1.9 worldmap.cxx,1.38,1.39 |
Date: |
1 Apr 2003 18:24:28 -0000 |
Update of /var/lib/cvs/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv25443/worldmap
Modified Files:
path_graph.cxx path_graph.hxx worldmap.cxx
Log Message:
added saving of the current node of the pingu on the worldmap
Index: path_graph.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/worldmap/path_graph.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- path_graph.cxx 25 Mar 2003 00:37:44 -0000 1.19
+++ path_graph.cxx 1 Apr 2003 18:24:25 -0000 1.20
@@ -236,6 +236,36 @@
}
}
+std::string
+PathGraph::lookup_node(EdgeId id)
+{
+ for (std::map<std::string, NodeId>::iterator i = node_lookup.begin();
+ i != node_lookup.end(); ++i)
+ {
+ if (i->second == id)
+ {
+ return i->first;
+ }
+ }
+ std::cout << "PathGraph: Couldn't find id: " << id << std::endl;
+ return "error_node";
+}
+
+std::string
+PathGraph::lookup_edge(NodeId id)
+{
+ for (std::map<std::string, EdgeId>::iterator i = node_lookup.begin();
+ i != node_lookup.end(); ++i)
+ {
+ if (i->second == id)
+ {
+ return i->first;
+ }
+ }
+ std::cout << "PathGraph: Couldn't find id: " << id << std::endl;
+ return "error_node";
+}
+
Dot*
PathGraph::get_dot(NodeId id)
{
Index: path_graph.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/worldmap/path_graph.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- path_graph.hxx 3 Nov 2002 23:31:35 -0000 1.8
+++ path_graph.hxx 1 Apr 2003 18:24:25 -0000 1.9
@@ -77,6 +77,9 @@
EdgeId lookup_edge(const std::string& name);
NodeId lookup_node(const std::string& name);
+ std::string lookup_node(EdgeId id);
+ std::string lookup_edge(NodeId id);
+
private:
void parse_nodes(xmlDocPtr doc, xmlNodePtr cur);
void parse_edges(xmlDocPtr doc, xmlNodePtr cur);
Index: worldmap.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/worldmap/worldmap.cxx,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- worldmap.cxx 1 Apr 2003 13:21:20 -0000 1.38
+++ worldmap.cxx 1 Apr 2003 18:24:25 -0000 1.39
@@ -24,6 +24,7 @@
#include <ClanLib/Display/Input/mouse.h>
#include "../fonts.hxx"
#include "../path_manager.hxx"
+#include "../stat_manager.hxx"
#include "../system.hxx"
#include "../pingus_resource.hxx"
#include "../globals.hxx"
@@ -74,9 +75,25 @@
pingus = new Pingus(path_graph);
//std::cout << "PingusPtr: " << pingus << std::endl;
- // FIXME: This should not be hardcoded, but instead be noted in the
- // savegame or worldmap
- pingus->set_position(0);
+
+ std::string node;
+ if (StatManager::instance()->get_string("current-tutorial-node", node))
+ {
+ NodeId id = path_graph->lookup_node(node);
+ if (id == NoNode)
+ {
+ pingus->set_position(0);
+ }
+ else
+ {
+ pingus->set_position(id);
+ }
+ }
+ else
+ { // FIXME: This should not be hardcoded, but instead be noted in the
+ // savegame or worldmap
+ pingus->set_position(0);
+ }
add_drawable(pingus);
@@ -309,6 +326,10 @@
{
if (maintainer_mode)
std::cout << "WorldMap: NO PATH TO NODE FOUND!" <<
std::endl;
+ }
+ else
+ {
+ StatManager::instance()->set_string("current-tutorial-node",
dot->get_name());
}
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap path_graph.cxx,1.19,1.20 path_graph.hxx,1.8,1.9 worldmap.cxx,1.38,1.39,
grumbel <=