pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3177 - in trunk/pingus: . src/editor


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3177 - in trunk/pingus: . src/editor
Date: Tue, 18 Sep 2007 17:55:02 +0200

Author: grumbel
Date: 2007-09-18 17:55:01 +0200 (Tue, 18 Sep 2007)
New Revision: 3177

Modified:
   trunk/pingus/TODO
   trunk/pingus/src/editor/editor_viewport.cpp
   trunk/pingus/src/editor/level_objs.cpp
Log:
- fixed object removal

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-18 15:23:33 UTC (rev 3176)
+++ trunk/pingus/TODO   2007-09-18 15:55:01 UTC (rev 3177)
@@ -180,8 +180,13 @@
 
 - add object duplication
 
-- ObjectSelector need to support more object types: Starbackground, 
SolidColorBackground
+- ObjectSelector need to support more object types, missing types:
 
+   Starbackground, SolidColorBackground, *Liquid*, all kinds of traps,
+   weather, special objects
+
+- add real object remove
+
 - keyboard shortcuts need to be implemented (use input framework, but
   how without support for keymaps?)
 
@@ -199,13 +204,15 @@
 - implement proper tmpfile Support (save tmp levels to ~/.pingus/tmp/
   for backup purpose in case of editor crash or so)
 
-- add options to show/hide hidden files and filter stuff
+- add new level dialog
 
-- add new level
-
 Less Important:
 ===============
 
+- add type conversion (important to convert groundpieces in hotspots and visa 
verse)
+
+- add options to show/hide hidden files and filter stuff
+
 - added overwrite warning to file dialog
 
 - add pixel perfect object selection

Modified: trunk/pingus/src/editor/editor_viewport.cpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.cpp 2007-09-18 15:23:33 UTC (rev 
3176)
+++ trunk/pingus/src/editor/editor_viewport.cpp 2007-09-18 15:55:01 UTC (rev 
3177)
@@ -312,6 +312,10 @@
     (*i)->remove();
   
   selected_objs.clear();
+
+  objs.erase(std::remove_if(objs.begin(), objs.end(), 
boost::mem_fn(&LevelObj::is_removed)),
+             objs.end());
+
   selection_changed(selected_objs);
 }
 
@@ -461,6 +465,7 @@
   for(std::vector<LevelObj*>::iterator i = objs.begin(); i != objs.end(); ++i)
     delete *i;
   objs.clear();
+  selection_changed(selected_objs);
 }
 
 } // namespace Editor

Modified: trunk/pingus/src/editor/level_objs.cpp
===================================================================
--- trunk/pingus/src/editor/level_objs.cpp      2007-09-18 15:23:33 UTC (rev 
3176)
+++ trunk/pingus/src/editor/level_objs.cpp      2007-09-18 15:55:01 UTC (rev 
3177)
@@ -90,7 +90,7 @@
 void
 LevelObj::draw(DrawingContext &gc)
 {
-  if (!removed && attribs & (HAS_SURFACE | HAS_SURFACE_FAKE))
+  if (attribs & (HAS_SURFACE | HAS_SURFACE_FAKE))
     {
       if (attribs & HAS_WIDTH)
         {
@@ -126,7 +126,7 @@
 bool
 LevelObj::is_at(int x, int y)
 {
-  if (attribs & (HAS_SURFACE | HAS_SURFACE_FAKE))
+  if (attribs & HAS_SURFACE || attribs & HAS_SURFACE_FAKE)
     {
       Vector2i offset = sprite.get_offset();
       return (x > pos.x - offset.x &&
@@ -198,64 +198,61 @@
 void
 LevelObj::write_properties(FileWriter &fw)
 {
-  if (!removed)
-    {
-      fw.begin_section(section_name.c_str());
+  fw.begin_section(section_name.c_str());
 
-      const unsigned attribs = get_attributes(section_name);
+  const unsigned attribs = get_attributes(section_name);
 
-      if (attribs & HAS_TYPE)
-        fw.write_string("type", object_type);
+  if (attribs & HAS_TYPE)
+    fw.write_string("type", object_type);
 
-      if (attribs & HAS_GPTYPE)
-        fw.write_string("type", ground_type);
+  if (attribs & HAS_GPTYPE)
+    fw.write_string("type", ground_type);
 
-      if (attribs & HAS_SURFACE)
-        {
-          fw.begin_section("surface");
-          fw.write_string("image", desc.res_name);
-          fw.write_string("modifier", 
ResourceModifierNS::rs_to_string(desc.modifier));
-          fw.end_section();    // surface
-        }
+  if (attribs & HAS_SURFACE)
+    {
+      fw.begin_section("surface");
+      fw.write_string("image", desc.res_name);
+      fw.write_string("modifier", 
ResourceModifierNS::rs_to_string(desc.modifier));
+      fw.end_section();        // surface
+    }
 
-      fw.write_vector("position", pos);
+  fw.write_vector("position", pos);
       
-      if (attribs & HAS_SPEED)
-        fw.write_int("speed", speed);
-      if (attribs & HAS_PARALLAX)
-        fw.write_float("parallax", parallax);
-      if (attribs & HAS_WIDTH)
-        fw.write_int("width", width);
-      if (attribs & HAS_OWNER)
-        fw.write_int("owner-id", owner_id);
-      if (attribs & HAS_DIRECTION)
-        fw.write_string("direction", direction);
-      if (attribs & HAS_RELEASE_RATE)
-        fw.write_int("release-rate", release_rate);
-      if (attribs & HAS_COLOR)
-        fw.write_color("color", color);
-      if (attribs & HAS_STRETCH)
-        {
-          fw.write_bool("stretch-x", stretch_x);
-          fw.write_bool("stretch-y", stretch_y);
-          fw.write_bool("keep-aspect", keep_aspect);
-        }
-      if (attribs & HAS_SCROLL)
-        {
-          fw.write_float("scroll-x", scroll_x);
-          fw.write_float("scroll-y", scroll_y);
-        }
-      if (attribs & HAS_PARA)
-        {
-          fw.write_float("para-x", para_x);
-          fw.write_float("para-y", para_y);
-        }
+  if (attribs & HAS_SPEED)
+    fw.write_int("speed", speed);
+  if (attribs & HAS_PARALLAX)
+    fw.write_float("parallax", parallax);
+  if (attribs & HAS_WIDTH)
+    fw.write_int("width", width);
+  if (attribs & HAS_OWNER)
+    fw.write_int("owner-id", owner_id);
+  if (attribs & HAS_DIRECTION)
+    fw.write_string("direction", direction);
+  if (attribs & HAS_RELEASE_RATE)
+    fw.write_int("release-rate", release_rate);
+  if (attribs & HAS_COLOR)
+    fw.write_color("color", color);
+  if (attribs & HAS_STRETCH)
+    {
+      fw.write_bool("stretch-x", stretch_x);
+      fw.write_bool("stretch-y", stretch_y);
+      fw.write_bool("keep-aspect", keep_aspect);
+    }
+  if (attribs & HAS_SCROLL)
+    {
+      fw.write_float("scroll-x", scroll_x);
+      fw.write_float("scroll-y", scroll_y);
+    }
+  if (attribs & HAS_PARA)
+    {
+      fw.write_float("para-x", para_x);
+      fw.write_float("para-y", para_y);
+    }
 
-      // Writes any extra properties that may be necessary (virtual function)
-      write_extra_properties(fw);
+  // Writes any extra properties that may be necessary (virtual function)
+  write_extra_properties(fw);
       
-      fw.end_section();        // object's section_name
-    }
+  fw.end_section();    // object's section_name
 }
 
 void





reply via email to

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