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 object_manager.cxx,1.39,1.40 o


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor object_manager.cxx,1.39,1.40 object_selector.cxx,1.29,1.30 selection.cxx,1.16,1.17 surface_selector.cxx,1.5,1.6
Date: 29 Dec 2002 23:29:03 -0000

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

Modified Files:
        object_manager.cxx object_selector.cxx selection.cxx 
        surface_selector.cxx 
Log Message:
cleanup


Index: object_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_manager.cxx,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- object_manager.cxx  3 Dec 2002 00:51:19 -0000       1.39
+++ object_manager.cxx  29 Dec 2002 23:29:01 -0000      1.40
@@ -34,7 +34,6 @@
 #include "object_manager.hxx"
 #include "editor_view.hxx"
 
-using namespace std;
 using namespace Actions;
 using namespace WorldObjsData;
 
@@ -111,30 +110,30 @@
   difficulty = 40;
   playable = 0;
 
-  std::cout << "Editor: Clearing current level..." << endl;
-  std::cout << "Loading new level: " << filename << endl;
+  std::cout << "Editor: Clearing current level..." << std::endl;
+  std::cout << "Loading new level: " << filename << std::endl;
   
   PLF* plf = PLF::create(filename);
 
   editor_objs.push_back(new StartPos(plf->get_startx(), 
                                     plf->get_starty()));
 
-  vector<GroundpieceData>  temp_surfaces = plf->get_groundpieces();
-  for (vector<GroundpieceData>::iterator i = temp_surfaces.begin();
+  std::vector<GroundpieceData>  temp_surfaces = plf->get_groundpieces();
+  for (std::vector<GroundpieceData>::iterator i = temp_surfaces.begin();
        i != temp_surfaces.end();
        i++)
     {
       i->surface = PingusResource::load_surface(i->desc);
     }
 
-  vector<WorldObjData*> temp_worldobj = plf->get_worldobjs_data();
+  std::vector<WorldObjData*> temp_worldobj = plf->get_worldobjs_data();
 
-  for (vector<GroundpieceData>::iterator i = temp_surfaces.begin(); i != 
temp_surfaces.end(); ++i) {
+  for (std::vector<GroundpieceData>::iterator i = temp_surfaces.begin(); i != 
temp_surfaces.end(); ++i) {
     const EditorObjLst& temp = i->create_EditorObj();
     editor_objs.insert(editor_objs.end(), temp.begin(), temp.end() );
   }
 
-  for (vector<WorldObjData*>::iterator i = temp_worldobj.begin();
+  for (std::vector<WorldObjData*>::iterator i = temp_worldobj.begin();
        i != temp_worldobj.end();
        ++i) {
     const EditorObjLst& temp = (*i)->create_EditorObj();
@@ -205,7 +204,7 @@
       << "<pingus-level>\n"
       << "  <global>\n";
     
-  for(map<std::string, std::string>::const_iterator i = levelname.begin();
+  for(std::map<std::string, std::string>::const_iterator i = levelname.begin();
       i != levelname.end();
       i++)
     {
@@ -213,7 +212,7 @@
          << i->second << "</levelname>" << std::endl;
     }
 
-  for(map<std::string, std::string>::const_iterator i = description.begin();
+  for(std::map<std::string, std::string>::const_iterator i = 
description.begin();
       i != description.end();
       i++)
     {
@@ -236,8 +235,8 @@
   
   // Printing actions to file
   xml << "  <action-list>\n";
-  for (vector<ActionData>::iterator i = actions.begin(); i != actions.end(); 
++i) {
-    xml << "    <" << action_to_string((*i).name) << " count=\"" << 
(*i).number_of << "\"/>" << endl;
+  for (std::vector<ActionData>::iterator i = actions.begin(); i != 
actions.end(); ++i) {
+    xml << "    <" << action_to_string((*i).name) << " count=\"" << 
(*i).number_of << "\"/>" << std::endl;
   }
   xml << "  </action-list>\n" << std::endl;
 
@@ -258,14 +257,14 @@
 
   if (current == editor_objs.begin()) 
     {
-      std::cout << "Editor: Cannot lower object" << endl;
+      std::cout << "Editor: Cannot lower object" << std::endl;
       return false;
     }
   
   prev = current;
   prev--;
 
-  swap(*prev, *current);
+  std::swap(*prev, *current);
   return true;
 }
 
@@ -281,18 +280,18 @@
   
   if (next == editor_objs.end())
     {
-      std::cout << "Cannot raise object" << endl;
+      std::cout << "Cannot raise object" << std::endl;
       return false;
     }
   
-  swap(*next, *current);
+  std::swap(*next, *current);
   return true;
 }
 
-vector<EditorObj*>
+std::vector<EditorObj*>
 ObjectManager::rect_get_objs(int x1, int y1, int x2, int y2)
 {
-  vector<EditorObj*> retval;
+  std::vector<EditorObj*> retval;
 
   for (EditorObjIter it = editor_objs.begin(); it != editor_objs.end(); ++it)
     if ((*it)->is_in_rect(CL_Rect(x1, y1, x2, y2)))

Index: object_selector.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_selector.cxx,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- object_selector.cxx 28 Sep 2002 11:52:23 -0000      1.29
+++ object_selector.cxx 29 Dec 2002 23:29:01 -0000      1.30
@@ -63,7 +63,6 @@
 #include "../editorobjs/switch_door_obj.hxx"
 #include "../editorobjs/teleporter_obj.hxx"
 
-using namespace std;
 using namespace EditorObjs;
 using namespace WorldObjsData;
 
@@ -284,7 +283,7 @@
          return get_hotspot("entrances");
 
        default:
-         if (verbose) std::cout << "Unknown keypressed" << endl;
+         if (verbose) std::cout << "Unknown keypressed" << std::endl;
        }
     }
   
@@ -294,7 +293,7 @@
 EditorObjLst
 ObjectSelector::get_exit ()
 {
-  string str;
+  std::string str;
   ExitData data;
   data.pos = pos;
   
@@ -555,7 +554,7 @@
 }
 
 std::string
-ObjectSelector::select_surface (vector<surface_obj>& sur_list)
+ObjectSelector::select_surface (std::vector<surface_obj>& sur_list)
 {
   std::cout << "ObjectSelector: Selecting surface out of: " << sur_list.size 
() << std::endl;
   SurfaceSelector sur_selector(&sur_list);
@@ -575,12 +574,12 @@
   
   data.pos = pos;
   
-  std::list<string>* liste = res->get_resources_of_type("surface");
+  std::list<std::string>* liste = res->get_resources_of_type("surface");
   surface_obj sur_obj;
   std::vector<surface_obj> sur_list;
   int j = 0;
 
-  for(std::list<string>::iterator i = liste->begin(); i != liste->end(); ++i)
+  for(std::list<std::string>::iterator i = liste->begin(); i != liste->end(); 
++i)
     {
       // FIXME: This should be moved to ThumbCache
       ++j;
@@ -617,14 +616,14 @@
       if (keys.peek_key().state != CL_Key::NoKey) 
        {
          key = keys.get_key();
-         std::cout << "key: " << key.ascii << endl;
+         std::cout << "key: " << key.ascii << std::endl;
          return key.id;
        }
     }
 }
 
-string
-ObjectSelector::read_string (const string & description, const string & 
def_str)
+std::string
+ObjectSelector::read_string (const std::string & description, const 
std::string & def_str)
 {
   StringReader reader(description, def_str);
   
reader.set_strings(PingusResource::get("global")->get_resources_of_type("surface"));

Index: selection.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/selection.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- selection.cxx       9 Oct 2002 14:49:45 -0000       1.16
+++ selection.cxx       29 Dec 2002 23:29:01 -0000      1.17
@@ -24,35 +24,33 @@
 #include "selection.hxx"
 #include "../math.hxx"
 
-using namespace std;
-
 namespace EditorNS {
 
 void
 Selection::move(float x, float y) 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->set_position_offset(Vector(x, y));
 }
 
 void
 Selection::move(const Vector& pos) 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->set_position_offset(pos);
 }
 
 void
 Selection::drag() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->drag();
 }
 
 void
 Selection::drop() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->drop();
 }
 
@@ -64,16 +62,16 @@
 }
 
 void
-Selection::add(vector<EditorObj*> objs)
+Selection::add(std::vector<EditorObj*> objs)
 {
-  for (vector<EditorObj*>::iterator it = objs.begin(); it != objs.end(); ++it)
+  for (std::vector<EditorObj*>::iterator it = objs.begin(); it != objs.end(); 
++it)
     add(*it);
 }
 
 bool
 Selection::has_object(EditorObj* obj)
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); ++it)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); ++it)
     {
       if (*it == obj)
         return true;
@@ -90,14 +88,14 @@
 void
 Selection::raise() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     object_manager->raise_obj(*it);
 }
 
 void
 Selection::lower() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     object_manager->lower_obj(*it);
 }
 
@@ -138,28 +136,28 @@
 void
 Selection::horizontal_flip() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->horizontal_flip();
 }
 
 void
 Selection::vertical_flip() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->vertical_flip();
 }
 
 void
 Selection::rotate_90() 
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->rotate_90();
 }
 
 void
 Selection::rotate_270()
 {
-  for (vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
+  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); it++)
     (*it)->rotate_270();
 }
 
@@ -167,7 +165,7 @@
 Selection::draw(EditorView * view)
 {
   
-  for (vector<EditorObj*>::iterator i = obj_list.begin(); i != obj_list.end(); 
++i) 
+  for (std::vector<EditorObj*>::iterator i = obj_list.begin(); i != 
obj_list.end(); ++i) 
     {
       (*i)->draw_mark(view);
     }

Index: surface_selector.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/surface_selector.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- surface_selector.cxx        27 Sep 2002 11:26:45 -0000      1.5
+++ surface_selector.cxx        29 Dec 2002 23:29:01 -0000      1.6
@@ -25,32 +25,28 @@
 #include "../pingus_resource.hxx"
 #include "surface_selector.hxx"
 
-using namespace std;
-
-SurfaceSelector::SurfaceSelector(vector<surface_obj>* s)
+SurfaceSelector::SurfaceSelector (std::vector<surface_obj>* s)
+  : font(PingusResource::load_font("Fonts/courier_small", "fonts")),
+    sur_list(s),
+    y_of(0),
+    width(CL_Display::get_width() - (CL_Display::get_width() % 50)),
+    height((sur_list->size() / (CL_Display::get_width() / 50)) * 50),
+    c_obj(std::vector<surface_obj>::iterator())
 {
-  y_of = 0;
-  sur_list = s;
-  font = PingusResource::load_font("Fonts/courier_small", "fonts");
-
-  c_obj = vector<surface_obj>::iterator ();
-
-  width = CL_Display::get_width() - (CL_Display::get_width() % 50);
-  height = (sur_list->size() / (CL_Display::get_width() / 50)) * 50;
 }
 
-SurfaceSelector::~SurfaceSelector()
+SurfaceSelector::~SurfaceSelector ()
 {
   
 }
 
-vector<surface_obj>::iterator
-SurfaceSelector::get_current_obj()
+std::vector<surface_obj>::iterator
+SurfaceSelector::get_current_obj ()
 {
   int x = 0;
   int y = -y_of;
   
-  for(vector<surface_obj>::iterator i = sur_list->begin(); 
+  for(std::vector<surface_obj>::iterator i = sur_list->begin(); 
       i != sur_list->end(); 
       ++i)
     {
@@ -68,21 +64,21 @@
        }
     }
 
-  return vector<surface_obj>::iterator();
+  return std::vector<surface_obj>::iterator();
 }
 
 void
-SurfaceSelector::draw()
+SurfaceSelector::draw ()
 {
   // FIXME: This could heavily optimized if ClanLib would have a 
put_target(x,y,w,h)
-  vector<surface_obj>::iterator tmp_obj = get_current_obj ();
+  std::vector<surface_obj>::iterator tmp_obj = get_current_obj();
   
   if (c_obj != tmp_obj)
     {
-      if (tmp_obj != vector<surface_obj>::iterator ())
-       tmp_obj->display_time = CL_System::get_time ();
+      if (tmp_obj != std::vector<surface_obj>::iterator())
+       tmp_obj->display_time = CL_System::get_time();
       
-      if (c_obj != vector<surface_obj>::iterator ())
+      if (c_obj != std::vector<surface_obj>::iterator())
        c_obj->display_time = 0;
     }
   
@@ -96,12 +92,12 @@
   CL_Display::clear_display();
 
   // Draw all surfaces
-  for(vector<surface_obj>::iterator i = sur_list->begin(); i != 
sur_list->end(); ++i)
+  for(std::vector<surface_obj>::iterator i = sur_list->begin(); i != 
sur_list->end(); ++i)
     {
       if (i->thumbnail.get_width() <= 50 && i->thumbnail.get_height() <= 50)
        {
-         i->thumbnail.put_screen(x + 25 - (i->thumbnail.get_width() / 2), 
-                            y + 25 - (i->thumbnail.get_height() / 2));
+         i->thumbnail.put_screen(x + 25 - (i->thumbnail.get_width()  / 2), 
+                                 y + 25 - (i->thumbnail.get_height() / 2));
        }
       else
        {
@@ -110,8 +106,7 @@
 
       if (i == c_obj)
        {
-         Display::draw_rect(x, y, x + 50, y + 50,
-                            1.0, 1.0, 1.0, 1.0);
+         Display::draw_rect(x, y, x + 50, y + 50, 1.0, 1.0, 1.0, 1.0);
        }
 
       x += 50;
@@ -128,7 +123,7 @@
 
   // Draw the current object in the bottom/left corner when the
   // surface is selected for more then 1sec
-  if (c_obj != vector<surface_obj>::iterator()
+  if (c_obj != std::vector<surface_obj>::iterator()
       && (c_obj->display_time + 350 < CL_System::get_time ()
          || c_obj->large_sur))
     {
@@ -147,7 +142,7 @@
 }
 
 void
-SurfaceSelector::scroll()
+SurfaceSelector::scroll ()
 {
   const int range = 100;
 
@@ -165,11 +160,11 @@
   if (y_of > height) y_of = height;
 }
 
-string
-SurfaceSelector::select()
+std::string
+SurfaceSelector::select ()
 {
-  string str;
-  vector<surface_obj>::iterator iter;
+  std::string str;
+  std::vector<surface_obj>::iterator iter;
 
   while (!CL_Mouse::left_pressed())
     {
@@ -182,12 +177,10 @@
 
   iter = get_current_obj();
   
-  if (iter != vector<surface_obj>::iterator())
+  if (iter != std::vector<surface_obj>::iterator())
     str = iter->name;
-  else 
-    str = "";
 
-  cout << "str: " << str << endl;
+  std::cout << "str: " << str << std::endl;
 
   return str;
 }
@@ -206,15 +199,15 @@
 
 surface_obj& surface_obj::operator= (const surface_obj& old)
 {
-  if (this == &old)
-    return *this;
+  if (this != &old)
+    {
+      thumbnail    = old.thumbnail;
+      large_sur    = old.large_sur;
+      name         = old.name;
+      datafile     = old.datafile;
+      display_time = old.display_time;
+    }
 
-  thumbnail    = old.thumbnail;
-  large_sur    = old.large_sur;
-  name         = old.name;
-  datafile     = old.datafile;
-  display_time = old.display_time;
-  
   return *this;
 }
 




reply via email to

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