windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 360 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 360 - trunk/src
Date: Sat, 29 May 2004 02:13:20 +0200

Author: grumbel
Date: 2004-05-29 02:13:19 +0200 (Sat, 29 May 2004)
New Revision: 360

Modified:
   trunk/src/flexlay.i
   trunk/src/layer.cxx
   trunk/src/layer.hxx
   trunk/src/paint_command.cxx
   trunk/src/supertux.py
   trunk/src/tool_manager.cxx
   trunk/src/tool_manager.hxx
Log:
- fixed supertux loading a bit
- made layer a bit more crash robust

Modified: trunk/src/flexlay.i
===================================================================
--- trunk/src/flexlay.i 2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/flexlay.i 2004-05-29 00:13:19 UTC (rev 360)
@@ -20,6 +20,7 @@
 
 #include "layer.hxx"
 #include "tilemap_layer.hxx"
+#include "object_layer.hxx"
 
 #include "minimap.hxx"
 #include "editor_map.hxx"
@@ -61,6 +62,7 @@
  
 %include "layer.hxx"
 %include "tilemap_layer.hxx"
+%include "object_layer.hxx"
 
 %include "editor_map.hxx"
 %include "workspace.hxx"

Modified: trunk/src/layer.cxx
===================================================================
--- trunk/src/layer.cxx 2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/layer.cxx 2004-05-29 00:13:19 UTC (rev 360)
@@ -32,17 +32,6 @@
   std::cout << "Layer(copy: " << impl.get() << ")" << std::endl;
 }
 
-Layer&
-Layer::operator=(const Layer& copy)
-{
-  if (this != &copy)
-    {
-      std::cout << "Layer:operator=: old: " << impl.get() << " new: " << 
copy.impl.get() << std::endl;
-      impl = copy.impl;
-    }
-  return *this;
-}
-
 Layer::Layer(SharedPtr<LayerImpl> i)
   : impl(i)
 {
@@ -57,19 +46,26 @@
 void
 Layer::draw(EditorMapComponent* parent) 
 { 
-  impl->draw(parent); 
+  if (impl.get())
+    impl->draw(parent);    
 }
   
 bool
 Layer::has_bounding_rect() const 
 {
-  return impl->has_bounding_rect(); 
+  if (impl.get())
+    return impl->has_bounding_rect(); 
+  else
+    return false;
 } 
 
 CL_Rect
 Layer::get_bounding_rect() 
 { 
-  return impl->get_bounding_rect();
+  if (impl.get())
+    return impl->get_bounding_rect();
+  else
+    return CL_Rect();
 }
 
 /* EOF */

Modified: trunk/src/layer.hxx
===================================================================
--- trunk/src/layer.hxx 2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/layer.hxx 2004-05-29 00:13:19 UTC (rev 360)
@@ -40,8 +40,6 @@
   Layer(SharedPtr<LayerImpl> i);
   ~Layer();
 
-  Layer& operator=(const Layer& copy);
-
   void draw(EditorMapComponent* parent);
   bool has_bounding_rect() const;
   CL_Rect get_bounding_rect();

Modified: trunk/src/paint_command.cxx
===================================================================
--- trunk/src/paint_command.cxx 2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/paint_command.cxx 2004-05-29 00:13:19 UTC (rev 360)
@@ -43,6 +43,9 @@
   TileBrush*   redo_brush;
   TileBrush*   undo_brush;
 
+  PaintCommandImpl() {}
+  virtual ~PaintCommandImpl() {}
+
   void execute();
   
   void redo();

Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py       2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/supertux.py       2004-05-29 00:13:19 UTC (rev 360)
@@ -21,8 +21,6 @@
 from sexpr   import *
 import time
 
-supertux_datadir = "/home/ingo/cvs/supertux/supertux/data/"
-
 def load_game_tiles(tileset, filename):
     "Load game tiles from filename into tileset"
     tree = sexpr_read_from_file(filename)
@@ -69,13 +67,13 @@
         self.width  = get_value_from_tree(["width", "_"], data, 20)
         self.height = get_value_from_tree(["height""_"], data, 15)
 
-        self.foreground  = TilemapLayer(tileset, self.width, self.height)
+        self.foreground  = TilemapLayer(supertux_tileset, self.width, 
self.height)
         self.foreground.set_data(get_value_from_tree(["foreground-tm"], data, 
[]))
 
-        self.interactive = TilemapLayer(tileset, self.width, self.height)
+        self.interactive = TilemapLayer(supertux_tileset, self.width, 
self.height)
         self.interactive.set_data(get_value_from_tree(["interactive-tm"], 
data, []))
 
-        self.background  = TilemapLayer(tileset, self.width, self.height)
+        self.background  = TilemapLayer(supertux_tileset, self.width, 
self.height)
         self.background.set_data(get_value_from_tree(["background-tm"], data, 
[]))
 
         self.objects = ObjectLayer()
@@ -91,7 +89,7 @@
 
     def activate(self, workspace):
         #editor_tilemap_set_current(self.interactive.to_layer())
-        workspace.set_current_map(self.editormap)
+        workspace.set_map(self.editormap)
 
 class SuperTuxGUI:
     quit_button = None
@@ -138,6 +136,9 @@
     gui.run()
     
     flexlay.deinit()
+
+supertux_datadir = "/home/ingo/cvs/supertux/supertux/data/"
+supertux_tileset = load_supertux_tiles()
     
 ### End: 'Main Loop'
 

Modified: trunk/src/tool_manager.cxx
===================================================================
--- trunk/src/tool_manager.cxx  2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/tool_manager.cxx  2004-05-29 00:13:19 UTC (rev 360)
@@ -48,7 +48,13 @@
 ToolManager::set_tool(int i)
 {
   if (i >= 0 && i < int(tools.size()))
-    tool = tools[i];
+    {
+      if (tool != tools[i])
+        {
+          on_tool_change();
+          tool = tools[i];
+        }
+    }
   else
     {
       std::cout << "Only have " << tools.size() << " tools, tool " << i << " 
can't be selected." << std::endl;
@@ -64,4 +70,10 @@
     return 0;  
 }
 
+CL_Signal_v0&
+ToolManager::sig_tool_change()
+{
+  return on_tool_change;
+}
+
 /* EOF */

Modified: trunk/src/tool_manager.hxx
===================================================================
--- trunk/src/tool_manager.hxx  2004-05-28 23:21:45 UTC (rev 359)
+++ trunk/src/tool_manager.hxx  2004-05-29 00:13:19 UTC (rev 360)
@@ -33,7 +33,7 @@
   Tools tools;
 
   TileMapTool* tool;
-
+  CL_Signal_v0 on_tool_change;
 public:
   ToolManager();
   ~ToolManager();
@@ -43,6 +43,7 @@
   TileMapTool* get_tool_by_name(int i);
   TileMapTool* current_tool() { return tool; }
 
+  CL_Signal_v0& sig_tool_change();
 };
 
 #endif





reply via email to

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