pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.7,1.8 edito


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.7,1.8 editor_groundpiece_obj.hxx,1.2,1.3 editorobj.hxx,1.2,1.3 editorobj_group.cxx,1.2,1.3 editorobj_group.hxx,1.5,1.6 editorobj_group_data.cxx,1.1,1.2 editorobj_group_data.hxx,1.2,1.3 object_manager.cxx,1.7,1.8 object_selector.cxx,1.4,1.5 plfobj.hxx,1.2,1.3 start_pos.cxx,1.2,1.3 start_pos.hxx,1.2,1.3 weather_obj.cxx,1.2,1.3 weather_obj.hxx,1.2,1.3
Date: 25 Jun 2002 12:20:36 -0000

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

Modified Files:
        editor_event.cxx editor_groundpiece_obj.hxx editorobj.hxx 
        editorobj_group.cxx editorobj_group.hxx 
        editorobj_group_data.cxx editorobj_group_data.hxx 
        object_manager.cxx object_selector.cxx plfobj.hxx 
        start_pos.cxx start_pos.hxx weather_obj.cxx weather_obj.hxx 
Log Message:
- replaced all ofstream* by ostream&
- some more prefab stuff

Index: editor_event.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- editor_event.cxx    24 Jun 2002 23:31:24 -0000      1.7
+++ editor_event.cxx    25 Jun 2002 12:20:33 -0000      1.8
@@ -747,7 +747,7 @@
   std::cout << "EditorEvent:editor_export_object_group_from_selection ()" << 
std::endl;
   EditorObjGroup group (editor->object_manager->current_objs);
   std::ofstream xml ("/tmp/metaobj.xml");
-  group.write_xml (&xml);
+  group.write_xml (xml);
 }
 
 void

Index: editor_groundpiece_obj.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/editor/editor_groundpiece_obj.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- editor_groundpiece_obj.hxx  24 Jun 2002 22:52:58 -0000      1.2
+++ editor_groundpiece_obj.hxx  25 Jun 2002 12:20:33 -0000      1.3
@@ -30,7 +30,7 @@
 public:
   EditorGroundpieceObj(const GroundpieceData& data);
 
-  void write_xml(std::ofstream* xml) { GroundpieceData::write_xml (xml); }
+  void write_xml(std::ostream& xml) { GroundpieceData::write_xml (xml); }
   boost::shared_ptr<EditorObj> duplicate();
   std::string status_line();
 };

Index: editorobj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editorobj.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- editorobj.hxx       24 Jun 2002 22:52:58 -0000      1.2
+++ editorobj.hxx       25 Jun 2002 12:20:33 -0000      1.3
@@ -87,7 +87,7 @@
   virtual void drop () {}
 
   /** Write the given object down into a XML file */
-  virtual void write_xml(std::ofstream* xml) =0;
+  virtual void write_xml(std::ostream& xml) =0;
 
   /** Return a string that is shown in the status line */
   virtual std::string status_line();

Index: editorobj_group.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editorobj_group.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- editorobj_group.cxx 24 Jun 2002 18:53:14 -0000      1.2
+++ editorobj_group.cxx 25 Jun 2002 12:20:33 -0000      1.3
@@ -121,9 +121,9 @@
 
 ///
 void
-EditorObjGroup::write_xml(std::ofstream* xml)
+EditorObjGroup::write_xml(std::ostream& xml)
 {
-  (*xml) << "<group>\n";
+  xml << "<group>\n";
 
   for(std::list<boost::shared_ptr<EditorObj> >::iterator i = objs.begin();
       i != objs.end();
@@ -131,7 +131,7 @@
     {
       (*i)->write_xml(xml);
     }
-  (*xml) << "</group>\n" << std::endl;
+  xml << "</group>\n" << std::endl;
 }
 
 boost::shared_ptr<EditorObj> 

Index: editorobj_group.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editorobj_group.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- editorobj_group.hxx 24 Jun 2002 22:52:58 -0000      1.5
+++ editorobj_group.hxx 25 Jun 2002 12:20:33 -0000      1.6
@@ -52,7 +52,7 @@
   bool is_over(const CL_Vector &);
   bool is_in_rect(const CL_Rect &);
     
-  void   write_xml(std::ofstream* xml);
+  void   write_xml(std::ostream& xml);
   boost::shared_ptr<EditorObj> duplicate();
 
   unsigned int size () { return objs.size (); }

Index: editorobj_group_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editorobj_group_data.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- editorobj_group_data.cxx    12 Jun 2002 19:11:31 -0000      1.1
+++ editorobj_group_data.cxx    25 Jun 2002 12:20:33 -0000      1.2
@@ -20,7 +20,7 @@
 #include "editorobj_group_data.hxx"
 
 void 
-EditorObjGroupData::write_xml(std::ofstream* xml)
+EditorObjGroupData::write_xml(std::ostream& xml)
 {
   (*xml) << "<worldobj type=\"group\">\n" 
         << "</worldobj type=\"group\">\n"

Index: editorobj_group_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editorobj_group_data.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- editorobj_group_data.hxx    24 Jun 2002 22:52:58 -0000      1.2
+++ editorobj_group_data.hxx    25 Jun 2002 12:20:33 -0000      1.3
@@ -34,7 +34,7 @@
   /// Empty placeholder
   virtual ~EditorObjGroupData() {}
 
-  virtual void write_xml(std::ofstream* xml);
+  virtual void write_xml(std::ostream& xml);
   static WorldObjData* create(xmlDocPtr doc, xmlNodePtr cur);  
 };
 

Index: object_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_manager.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- object_manager.cxx  24 Jun 2002 23:31:24 -0000      1.7
+++ object_manager.cxx  25 Jun 2002 12:20:33 -0000      1.8
@@ -323,7 +323,7 @@
   xml << "  </action-list>\n" << std::endl;
 
   for (EditorObjIter i = editor_objs.begin(); i != editor_objs.end(); ++i) {
-    (*i)->write_xml(&xml);
+    (*i)->write_xml(xml);
   }
   
   xml << "</pingus-level>\n" << std::endl;

Index: object_selector.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_selector.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- object_selector.cxx 24 Jun 2002 23:31:24 -0000      1.4
+++ object_selector.cxx 25 Jun 2002 12:20:33 -0000      1.5
@@ -475,19 +475,23 @@
 std::list<boost::shared_ptr<EditorObj> >
 ObjectSelector::get_prefab()
 {
+  CL_DirectoryScanner dir;
+  std::vector<std::string> dir_lst;
+  if (dir.scan(path_manager.complete ("prefabs/"), "*.xml"))
+    {
+      while (dir.next ()) {
+       dir_lst.push_back (dir.get_name ());
+      }
+    }
+
   CL_Display::clear_display();
   font->print_left(20, 20, _("Which prefab do you want?"));
-
-  CL_DirectoryScanner dir;
-  
-  int y = 60;
-  dir.scan(path_manager.complete ("prefabs/"), "*.xml");
-  while (dir.next ())
+ 
+  for (std::vector<std::string>::size_type i = 0; i < dir_lst.size (); ++i)
     {
-      font->print_left(20, y, dir.get_name ().c_str ());
-      y += 30;
+      font->print_left(20, 60 + i * 30, to_string(i) + " - " + dir_lst[i]); 
     }
-  
+
   Display::flip_display();
 
   bool exit_loop = false;
@@ -496,9 +500,10 @@
     {
       switch (read_key()) 
        {
-       default: 
+       case CL_KEY_ESCAPE: 
          exit_loop = true;
-       }      
+         break;
+       }
     }
   return std::list<boost::shared_ptr<EditorObj> >();
 }

Index: plfobj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/plfobj.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- plfobj.hxx  24 Jun 2002 22:52:58 -0000      1.2
+++ plfobj.hxx  25 Jun 2002 12:20:33 -0000      1.3
@@ -38,7 +38,7 @@
   EntranceObj(const EntranceData&);
 
   boost::shared_ptr<EditorObj> duplicate();
-  void write_xml(std::ofstream* xml) { EntranceData::write_xml (xml); }
+  void write_xml(std::ostream& xml) { EntranceData::write_xml (xml); }
   std::string status_line();
 };
 
@@ -51,7 +51,7 @@
   ExitObj(const ExitData&);
 
   boost::shared_ptr<EditorObj> duplicate();
-  void write_xml(std::ofstream* xml) { ExitData::write_xml (xml); }
+  void write_xml(std::ostream& xml) { ExitData::write_xml (xml); }
   std::string  status_line();
 };
 
@@ -66,7 +66,7 @@
   TrapObj(const TrapData&);
 
   boost::shared_ptr<EditorObj> duplicate();
-  void write_xml(std::ofstream* xml) { TrapData::write_xml (xml); }
+  void write_xml(std::ostream& xml) { TrapData::write_xml (xml); }
   void draw (EditorView * view);
   std::string  status_line();
 };
@@ -82,8 +82,8 @@
   boost::shared_ptr<EditorObj> duplicate();
   void draw (EditorView * view);
   void draw_mark (EditorView * view);
-  void save(std::ofstream* plf, std::ofstream* psm);
-  void write_xml(std::ofstream* xml) { LiquidData::write_xml (xml); }
+  void save(std::ostream& plf, std::ofstream* psm);
+  void write_xml(std::ostream& xml) { LiquidData::write_xml (xml); }
   std::string  status_line();
 
   int get_width () { return  sprite.get_width () * width; }

Index: start_pos.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/start_pos.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- start_pos.cxx       13 Jun 2002 14:25:13 -0000      1.2
+++ start_pos.cxx       25 Jun 2002 12:20:33 -0000      1.3
@@ -31,11 +31,11 @@
 }
 
 void
-StartPos::write_xml(std::ofstream* xml)
+StartPos::write_xml(std::ostream& xml)
 {
-  (*xml) << "  <start-position>\n";
+  xml << "  <start-position>\n";
   XMLhelper::write_vector_xml(xml, pos);
-  (*xml) << "  </start-position>\n" << std::endl;  
+  xml << "  </start-position>\n" << std::endl;  
 }
 
 boost::shared_ptr<EditorObj>

Index: start_pos.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/start_pos.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- start_pos.hxx       24 Jun 2002 22:52:58 -0000      1.2
+++ start_pos.hxx       25 Jun 2002 12:20:33 -0000      1.3
@@ -30,7 +30,7 @@
 public:
   StartPos(int arg_x_pos, int arg_y_pos);
 
-  virtual void write_xml(std::ofstream* xml);
+  virtual void write_xml(std::ostream& xml);
   virtual boost::shared_ptr<EditorObj> duplicate();
 };
 

Index: weather_obj.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/weather_obj.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- weather_obj.cxx     13 Jun 2002 14:25:13 -0000      1.2
+++ weather_obj.cxx     25 Jun 2002 12:20:33 -0000      1.3
@@ -74,13 +74,13 @@
 }
   
 void   
-WeatherObj::write_xml(std::ofstream* xml)
+WeatherObj::write_xml(std::ostream& xml)
 {
-  (*xml) << "  <weather>\n"
-        << "    <type>" << type << "</type>\n";
+  xml << "  <weather>\n"
+      << "    <type>" << type << "</type>\n";
   XMLhelper::write_vector_xml(xml, pos);
-  (*xml) << "  </weather>\n"
-        << std::endl;
+  xml << "  </weather>\n"
+      << std::endl;
 }
  
 boost::shared_ptr<EditorObj>

Index: weather_obj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/weather_obj.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- weather_obj.hxx     24 Jun 2002 22:52:58 -0000      1.2
+++ weather_obj.hxx     25 Jun 2002 12:20:33 -0000      1.3
@@ -38,7 +38,7 @@
   virtual void drop ();
 
   virtual void draw (EditorView * view);
-  virtual void write_xml(std::ofstream* xml);
+  virtual void write_xml(std::ostream& xml);
   virtual boost::shared_ptr<EditorObj> duplicate();
 };
 




reply via email to

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