pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/worldmap dot.cxx,1.1,1.2 dot.hxx,1.1,


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldmap dot.cxx,1.1,1.2 dot.hxx,1.1,1.2 drawable.hxx,1.2,1.3 level_dot.cxx,1.1,1.2 level_dot.hxx,1.1,1.2 path_graph.cxx,1.2,1.3
Date: 13 Oct 2002 13:34:42 -0000

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

Modified Files:
        dot.cxx dot.hxx drawable.hxx level_dot.cxx level_dot.hxx 
        path_graph.cxx 
Log Message:
some more worldmap rewrite stuff

Index: dot.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/dot.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dot.cxx     13 Oct 2002 01:09:18 -0000      1.1
+++ dot.cxx     13 Oct 2002 13:34:40 -0000      1.2
@@ -17,20 +17,38 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <iostream>
 #include "dot.hxx"
 
 namespace WorldMapNS {
 
 Dot::Dot(xmlDocPtr doc, xmlNodePtr cur)
-  : Drawable("bla")
+  : Drawable()
 {
-  
-}
+  assert(cur);
 
-std::string
-Dot::get_name()
-{
-  return name;
+  // cur = <dot>...</dot>
+  cur = cur->children;
+  cur = XMLhelper::skip_blank(cur);
+         
+  while (cur)
+    {
+      if (XMLhelper::equal_str(cur->name, "position"))
+        {
+          pos = XMLhelper::parse_vector(doc, cur);
+        }
+      else if (XMLhelper::equal_str(cur->name, "name"))
+        {
+          XMLhelper::node_list_get_string(doc, cur, 1, name);
+        }
+      else
+        {
+          std::cout << "1234" << std::endl;
+        }
+
+      cur = cur->next;
+      cur = XMLhelper::skip_blank(cur);
+    }
 }
 
 } // namespace WorldMapNS

Index: dot.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/dot.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dot.hxx     13 Oct 2002 01:09:18 -0000      1.1
+++ dot.hxx     13 Oct 2002 13:34:40 -0000      1.2
@@ -22,6 +22,7 @@
 
 #include <string>
 #include "../libxmlfwd.hxx"
+#include "../vector.hxx"
 #include "drawable.hxx"
 
 namespace WorldMapNS {
@@ -30,12 +31,12 @@
     LevelDots TubeDots and other availabe. */
 class Dot : public Drawable
 {
-private:
-  std::string name;
+protected:
+  Vector pos;
+
 public:
   Dot(xmlDocPtr doc, xmlNodePtr cur);
 
-  std::string get_name();
 private:
   Dot (const Dot&);
   Dot& operator= (const Dot&);

Index: drawable.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/drawable.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- drawable.hxx        13 Oct 2002 01:09:18 -0000      1.2
+++ drawable.hxx        13 Oct 2002 13:34:40 -0000      1.3
@@ -31,7 +31,7 @@
     sprite, interface only */
 class Drawable
 {
-private:
+protected:
   /** The symbolic id of the drawable */
   std::string name;
   
@@ -39,12 +39,16 @@
   bool visible;
 
 public:
+  Drawable()
+    :visible(true)
+  {
+  }
+
   Drawable(std::string arg_name)
     : name(arg_name),
       visible(true)
   {
-  }
-    
+  }    
 
   Drawable(xmlDocPtr doc, xmlNodePtr cur) 
     : visible(true)

Index: level_dot.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/level_dot.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- level_dot.cxx       13 Oct 2002 01:09:18 -0000      1.1
+++ level_dot.cxx       13 Oct 2002 13:34:40 -0000      1.2
@@ -19,19 +19,24 @@
 
 #include <iostream>
 #include "../xml_helper.hxx"
+#include "../pingus_resource.hxx"
+#include "../graphic_context.hxx"
 #include "level_dot.hxx"
 
 namespace WorldMapNS {
 
 LevelDot::LevelDot(xmlDocPtr doc, xmlNodePtr cur)
-  : Dot(doc, XMLhelper::skip_blank(cur->children))
+  : Dot(doc, XMLhelper::skip_blank(cur->children)),
+    green_dot_sur(PingusResource::load_surface("misc/dot_green", "core")),
+    red_dot_sur(PingusResource::load_surface("misc/dot_red", "core"))
 {
 }
 
 void
 LevelDot::draw(GraphicContext& gc)
 {
-  std::cout << "Drawing level dat" << std::endl;
+  std::cout << "Drawing level dat: " << pos << std::endl;
+  gc.draw (green_dot_sur, pos);
 }
 
 void

Index: level_dot.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/level_dot.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- level_dot.hxx       13 Oct 2002 01:09:18 -0000      1.1
+++ level_dot.hxx       13 Oct 2002 13:34:40 -0000      1.2
@@ -20,6 +20,7 @@
 #ifndef HEADER_PINGUS_WORLDMAP_LEVEL_DOT_HXX
 #define HEADER_PINGUS_WORLDMAP_LEVEL_DOT_HXX
 
+#include <ClanLib/Display/Display/surface.h>
 #include "dot.hxx"
 
 namespace WorldMapNS {
@@ -28,6 +29,9 @@
 class LevelDot : public Dot
 {
 private:
+  CL_Surface green_dot_sur;
+  CL_Surface red_dot_sur;
+
 public:
   LevelDot(xmlDocPtr doc, xmlNodePtr cur);
 

Index: path_graph.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/path_graph.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- path_graph.cxx      13 Oct 2002 01:09:18 -0000      1.2
+++ path_graph.cxx      13 Oct 2002 13:34:40 -0000      1.3
@@ -120,9 +120,26 @@
             }
 
           // FIXME: add path-data parsing here
-
+          Path* path = new Path();
+          xmlNodePtr child_cur = cur;
+          while (child_cur)
+            {
+              if (XMLhelper::equal_str(child_cur->name, "position"))
+                {
+                  Vector pos = XMLhelper::parse_vector(doc, child_cur);
+                  path->push_back(pos);
+                }
+              else
+                {
+                  std::cout << "12929929" << std::endl;
+                }
+              
+              child_cur = child_cur->next;
+              child_cur = XMLhelper::skip_blank(child_cur);
+            }    
+          
           // FIXME: No error checking, 
-          graph.add_bi_edge(new Path(), // FIXME: Memory leak!
+          graph.add_bi_edge(path, // FIXME: Memory leak!
                             node_lookup[source], node_lookup[destination], 
                             0 /* costs */);
         }
@@ -133,7 +150,7 @@
 
       cur = cur->next;
       cur = XMLhelper::skip_blank(cur);
-    }   
+    }    
 }
 
 std::vector<Vector>





reply via email to

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