pingus-cvs
[Top][All Lists]
Advanced

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

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


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3171 - in trunk/pingus: . src src/editor
Date: Mon, 17 Sep 2007 22:10:10 +0200

Author: grumbel
Date: 2007-09-17 22:10:10 +0200 (Mon, 17 Sep 2007)
New Revision: 3171

Modified:
   trunk/pingus/TODO
   trunk/pingus/src/editor/editor_level.cpp
   trunk/pingus/src/editor/level_objs.cpp
   trunk/pingus/src/sexpr_file_writer.cpp
Log:
- changed file layout to match closer that of the convert script

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-17 19:49:08 UTC (rev 3170)
+++ trunk/pingus/TODO   2007-09-17 20:10:10 UTC (rev 3171)
@@ -157,6 +157,8 @@
 
 - convert all levels and check all classic levels for issues (run
   branches/pingus_sdl/contribl/levelconvert.sh from SVN toplevel dir)
+ 
+- level converter writes 0/1 instead of #t/#f
 
 - add drag&drop scrolling
 

Modified: trunk/pingus/src/editor/editor_level.cpp
===================================================================
--- trunk/pingus/src/editor/editor_level.cpp    2007-09-17 19:49:08 UTC (rev 
3170)
+++ trunk/pingus/src/editor/editor_level.cpp    2007-09-17 20:10:10 UTC (rev 
3171)
@@ -115,6 +115,9 @@
   std::ofstream out_file(filename.c_str());
   SExprFileWriter fw(out_file);
        
+  out_file << ";; -*- scheme -*-" << std::endl;
+  out_file << ";; Generated by Pingus Editor " << VERSION;
+
   // Write header
   fw.begin_section("pingus-level");
   fw.write_int("version", 2);
@@ -152,6 +155,8 @@
   fw.end_section();    // objects
 
   fw.end_section();    // pingus-level
+
+  out_file << "\n\n;; EOF ;;" << std::endl;
        
   // Clean up
   out_file.close();

Modified: trunk/pingus/src/editor/level_objs.cpp
===================================================================
--- trunk/pingus/src/editor/level_objs.cpp      2007-09-17 19:49:08 UTC (rev 
3170)
+++ trunk/pingus/src/editor/level_objs.cpp      2007-09-17 20:10:10 UTC (rev 
3171)
@@ -204,7 +204,9 @@
 
       const unsigned attribs = get_attributes(section_name);
 
-      // Write information about the main sprite
+      if (attribs & HAS_TYPE)
+        fw.write_string("type", object_type);
+
       if (attribs & HAS_SURFACE)
         {
           fw.begin_section("surface");
@@ -212,9 +214,9 @@
           fw.write_string("modifier", 
ResourceModifierNS::rs_to_string(desc.modifier));
           fw.end_section();    // surface
         }
-      // Write the optional information
-      if (attribs & HAS_TYPE)
-        fw.write_string("type", object_type);
+
+      fw.write_vector("position", pos);
+      
       if (attribs & HAS_SPEED)
         fw.write_int("speed", speed);
       if (attribs & HAS_PARALLAX)
@@ -249,8 +251,6 @@
       // Writes any extra properties that may be necessary (virtual function)
       write_extra_properties(fw);
       
-      fw.write_vector("position", pos);
-
       fw.end_section();        // object's section_name
     }
 }

Modified: trunk/pingus/src/sexpr_file_writer.cpp
===================================================================
--- trunk/pingus/src/sexpr_file_writer.cpp      2007-09-17 19:49:08 UTC (rev 
3170)
+++ trunk/pingus/src/sexpr_file_writer.cpp      2007-09-17 20:10:10 UTC (rev 
3171)
@@ -40,7 +40,7 @@
 void
 SExprFileWriter::begin_section(const char* name)
 {
-  (*out) << indent() << "(" << name << "\n";
+  (*out) << "\n" << indent() << "(" << name << " ";
   ++level;
 }
 
@@ -48,32 +48,32 @@
 SExprFileWriter::end_section()
 {
   --level;
-  (*out) << indent() << ")\n";
+  (*out) << ")";
 }
 
 void
 SExprFileWriter::write_int(const char* name, int value)
 {
-  (*out) << indent() << "(" << name << " " << value << ")\n";
+  (*out) << "\n" << indent() << "(" << name << " " << value << ")";
 }
 
 void
 SExprFileWriter::write_float(const char* name, float value)
 {
-  (*out) << indent() << "(" << name << " " << value << ")\n";
+  (*out) << "\n" << indent() << "(" << name << " " << value << ")";
 }
 
 void
 SExprFileWriter::write_color(const char* name, const Color& color)
 {
-  (*out) << indent() << "(" << name << " "
-         << (int)color.r << " " << (int)color.g << " " << (int)color.b << " " 
<< (int)color.a << ")\n";
+  (*out) << "\n" << indent() << "(" << name << " "
+         << (int)color.r << " " << (int)color.g << " " << (int)color.b << " " 
<< (int)color.a << ")";
 }
 
 void
 SExprFileWriter::write_bool(const char* name, bool value)
 {
-  (*out) << indent() << "(" << name << " " << (value ? "#t" : "#f") << ")\n";
+  (*out) << "\n" << indent() << "(" << name << " " << (value ? "#t" : "#f") << 
")";
 }
 
 void
@@ -98,20 +98,20 @@
                }
        }
        
-       (*out) << indent() << "(" << name << " \"" << new_value << "\")\n";
+       (*out) << "\n" << indent() << "(" << name << " \"" << new_value << 
"\")";
 }
 
 void
 SExprFileWriter::write_vector(const char* name, const Vector3f& value)
 {
-  (*out) << indent() << "(" << name << " "
-         << value.x << " " << value.y << " " << value.z << ")\n";
+  (*out) << "\n" << indent() << "(" << name << " "
+         << value.x << " " << value.y << " " << value.z << ")";
 }
 
 void
 SExprFileWriter::write_size(const char* name, const Size& size)
 {
-  (*out) << indent() << "(" << name << " " << size.width << " " << size.height 
<< ")\n";
+  (*out) << "\n" << indent() << "(" << name << " " << size.width << " " << 
size.height << ")";
 }
 
 /* EOF */





reply via email to

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