pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.91,1.92 blitter.cxx,1.1


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.91,1.92 blitter.cxx,1.12,1.13 button_panel.hxx,1.9,1.10 capture_rectangle.cxx,1.5,1.6 client.cxx,1.17,1.18 config.cxx,1.4,1.5 console.hxx,1.7,1.8 credits.cxx,1.9,1.10 direction.hxx,1.4,1.5 fps_counter.cxx,1.3,1.4 fps_counter.hxx,1.3,1.4 game_counter.hxx,1.4,1.5 groundpiece_data.hxx,1.11,1.12 level_desc.cxx,1.6,1.7 level_result.cxx,1.3,1.4 multiplayer_client_child.cxx,1.9,1.10 pingu.cxx,1.20,1.21 pingu.hxx,1.11,1.12 pingu_action.cxx,1.6,1.7 pingu_action.hxx,1.12,1.13 pingu_holder.cxx,1.4,1.5 pingu_info.cxx,1.3,1.4 pingus_counter.cxx,1.4,1.5 pingus_menu.hxx,1.6,1.7 pingus_menu_manager.hxx,1.9,1.10 pingus_resource.hxx,1.7,1.8 playfield.cxx,1.18,1.19 plt_parser.cxx,1.4,1.5 res_descriptor.hxx,1.6,1.7 screenshot.cxx,1.5,1.6 server.cxx,1.12,1.13 server.hxx,1.4,1.5 smallmap.cxx,1.11,1.12 sound_real.cxx,1.6,1.7 spot_map.cxx,1.8,1.9 string_converter.cxx,1.5,1.6 time_display.cxx,1.4,1.5 trap_data.cxx,1.6,1.7 worldobj.cxx,1.3,1.4 worldobj.hxx,1.4,1.5 worldobj_data.hxx,1.5,1.6 worldobj_data_factory.cxx,1.3,1.4 xml_plf.cxx,1.11,1.12 xml_plf.hxx,1.4,1.5
Date: 4 Sep 2002 14:55:14 -0000

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

Modified Files:
        Makefile.am blitter.cxx button_panel.hxx capture_rectangle.cxx 
        client.cxx config.cxx console.hxx credits.cxx direction.hxx 
        fps_counter.cxx fps_counter.hxx game_counter.hxx 
        groundpiece_data.hxx level_desc.cxx level_result.cxx 
        multiplayer_client_child.cxx pingu.cxx pingu.hxx 
        pingu_action.cxx pingu_action.hxx pingu_holder.cxx 
        pingu_info.cxx pingus_counter.cxx pingus_menu.hxx 
        pingus_menu_manager.hxx pingus_resource.hxx playfield.cxx 
        plt_parser.cxx res_descriptor.hxx screenshot.cxx server.cxx 
        server.hxx smallmap.cxx sound_real.cxx spot_map.cxx 
        string_converter.cxx time_display.cxx trap_data.cxx 
        worldobj.cxx worldobj.hxx worldobj_data.hxx 
        worldobj_data_factory.cxx xml_plf.cxx xml_plf.hxx 
Log Message:
- removed traps
- various cleanup


Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- Makefile.am 24 Aug 2002 11:37:29 -0000      1.91
+++ Makefile.am 4 Sep 2002 14:55:11 -0000       1.92
@@ -29,13 +29,14 @@
        backgrounds         \
        caimagemanipulation \
        editor              \
+       editorobjs          \
        entrances           \
        generic             \
         gui                 \
         input               \
        particles           \
-       traps               \
         worldobjs           \
+       worldobjsdata       \
        worldmap
 
 EXTRA_DIST = README \
@@ -56,8 +57,11 @@
         @LIBS@     \
         \
         caimagemanipulation/libcaimagemanipulation.a \
+       editorobjs/libpingus_editorobjs.a \
+       worldobjsdata/libpingus_worldobjsdata.a \
         worldobjs/libpingus_worldobjs.a \
-       traps/libpingu_traps.a          \
+       worldobjsdata/libpingus_worldobjsdata.a \
+       editorobjs/libpingus_editorobjs.a \
         actions/libpingu_actions.a      \
         entrances/libpingus_entrances.a \
         particles/libpingus_particle.a  \

Index: blitter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/blitter.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- blitter.cxx 17 Aug 2002 17:56:23 -0000      1.12
+++ blitter.cxx 4 Sep 2002 14:55:11 -0000       1.13
@@ -96,8 +96,8 @@
 
   if (!cl_palette)
     {
-      char str[1024];
-      sprintf(str, _("Couldn't find palette: %d"), sprovider->get_depth());
+      char str[128];
+      snprintf(str, 128, _("Couldn't find palette: %d"), 
sprovider->get_depth());
       PingusError::raise(str);
     }
 

Index: button_panel.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/button_panel.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- button_panel.hxx    23 Aug 2002 15:49:48 -0000      1.9
+++ button_panel.hxx    4 Sep 2002 14:55:11 -0000       1.10
@@ -23,7 +23,6 @@
 #include <vector>
 
 #include "action_button.hxx"
-#include "gui/component.hxx"
 
 class CL_Key;
 class Client;

Index: capture_rectangle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/capture_rectangle.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- capture_rectangle.cxx       23 Aug 2002 15:49:48 -0000      1.5
+++ capture_rectangle.cxx       4 Sep 2002 14:55:11 -0000       1.6
@@ -17,6 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <ClanLib/Core/Math/cl_vector.h>
 #include <ClanLib/Display/Font/font.h>
 #include "pingu.hxx"
 #include "string_converter.hxx"

Index: client.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/client.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- client.cxx  17 Aug 2002 01:03:27 -0000      1.17
+++ client.cxx  4 Sep 2002 14:55:11 -0000       1.18
@@ -17,7 +17,6 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include <string>
 #include <config.h>
 #include <ClanLib/Display/Display/display.h>
 #include <ClanLib/Display/Display/mousecursor_provider.h>

Index: config.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/config.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- config.cxx  16 Aug 2002 15:13:59 -0000      1.4
+++ config.cxx  4 Sep 2002 14:55:11 -0000       1.5
@@ -252,9 +252,9 @@
 ConfigParser::syntax_error(std::string error = "")
 {
   std::string error_str;
-  char tmp[256];
+  char tmp[16];
 
-  sprintf(tmp, "%d\n", lineno);
+  snprintf(tmp, 16, "%d\n", lineno);
   
   error_str = std::string(_("PLF: Syntax Error at line ")) + tmp;
 

Index: console.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/console.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- console.hxx 23 Aug 2002 15:49:48 -0000      1.7
+++ console.hxx 4 Sep 2002 14:55:11 -0000       1.8
@@ -20,7 +20,6 @@
 #ifndef HEADER_PINGUS_CONSOLE_HXX
 #define HEADER_PINGUS_CONSOLE_HXX
 
-#include <list>
 #include <string>
 #include <iostream>
 #include "display.hxx"

Index: credits.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/credits.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- credits.cxx 23 Aug 2002 15:49:48 -0000      1.9
+++ credits.cxx 4 Sep 2002 14:55:11 -0000       1.10
@@ -27,7 +27,6 @@
 #include "sound.hxx"
 #include "pingus_resource.hxx"
 #include "credits.hxx"
-#include "game_delta.hxx"
 #include "screen_manager.hxx"
 
 /* Headers needed for i18n / gettext */

Index: direction.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/direction.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- direction.hxx       16 Aug 2002 13:03:34 -0000      1.4
+++ direction.hxx       4 Sep 2002 14:55:11 -0000       1.5
@@ -26,32 +26,24 @@
 class Direction
 {
 private:
-  ///
   int direction;
+  
 public:
-  ///
-  Direction();
-  ///
-  Direction(const Direction& dir);
-  ///
-  ~Direction();
+  Direction ();
+  Direction (const Direction& dir);
+  ~Direction ();
   
-  ///
-  Direction& operator=(const Direction&);
-  ///
-  operator int() { return direction; }
-  ///
-  void change();
-  ///
-  void left();
-  ///
-  void right();
-  ///
-  bool is_left() const;
-  ///
-  bool is_right() const;
-}///
-;
+  Direction& operator= (const Direction&);
+
+  operator int () const { return direction; }
+
+  void change ();
+  void left ();
+  void right ();
+
+  bool is_left () const;
+  bool is_right () const;
+};
 
 #endif
 

Index: fps_counter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/fps_counter.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fps_counter.cxx     20 Jun 2002 12:22:51 -0000      1.3
+++ fps_counter.cxx     4 Sep 2002 14:55:11 -0000       1.4
@@ -84,7 +84,7 @@
   if (start_time + 1000 < current_time) 
     {
       current_fps = fps_count * 1000 / (current_time - start_time);
-      sprintf(fps_string, "%d fps", current_fps);
+      snprintf(fps_string, 16, "%d fps", current_fps);
       fps_count = 0;
       start_time = CL_System::get_time();
     }

Index: fps_counter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/fps_counter.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fps_counter.hxx     23 Aug 2002 15:49:48 -0000      1.3
+++ fps_counter.hxx     4 Sep 2002 14:55:11 -0000       1.4
@@ -36,7 +36,7 @@
 
   /** A string holding the current value of frames + "fps", its
       updated every second */
-  char fps_string[64];
+  char fps_string[16];
 
   /** Count the fps until one second is passed */
   int fps_count;

Index: game_counter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_counter.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- game_counter.hxx    23 Aug 2002 15:49:48 -0000      1.4
+++ game_counter.hxx    4 Sep 2002 14:55:11 -0000       1.5
@@ -34,22 +34,22 @@
   bool is_finished;
   CounterType type;
 
-  void check_overflow(void);
+  void check_overflow (void);
 public:
-  GameCounter();
-  ~GameCounter();
+  GameCounter ();
+  ~GameCounter ();
 
-  void set_type(CounterType t);
-  void set_size(int);
-  int  get_size();
-  bool finished();
-  void set_speed(double i);
-  int  value();
-  bool enough_time_passed();
-  int  operator++();
-  int  operator++(int);
-  int  operator--();
-  int  operator=(int i);
+  void set_type (CounterType t);
+  void set_size (int);
+  int  get_size ();
+  bool finished ();
+  void set_speed (double i);
+  int  value ();
+  bool enough_time_passed ();
+  int  operator++ ();
+  int  operator++ (int);
+  int  operator-- ();
+  int  operator= (int i);
   operator int ();
   
 private:

Index: groundpiece_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/groundpiece_data.hxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- groundpiece_data.hxx        24 Aug 2002 11:37:48 -0000      1.11
+++ groundpiece_data.hxx        4 Sep 2002 14:55:11 -0000       1.12
@@ -20,7 +20,6 @@
 #ifndef HEADER_PINGUS_GROUNDPIECE_DATA_HXX
 #define HEADER_PINGUS_GROUNDPIECE_DATA_HXX
 
-#include <iosfwd>
 #include <ClanLib/Core/Math/cl_vector.h>
 #include <ClanLib/Display/Display/surface.h>
 #include "libxmlfwd.hxx"

Index: level_desc.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/level_desc.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- level_desc.cxx      23 Aug 2002 15:49:49 -0000      1.6
+++ level_desc.cxx      4 Sep 2002 14:55:11 -0000       1.7
@@ -78,10 +78,10 @@
     }
 
   {
-    char str[1024];
-    sprintf(str, _("Pingus to Save: %d"), plf->get_number_to_save());
+    char str[64];
+    snprintf(str, 64, _("Pingus to Save: %d"), plf->get_number_to_save());
     font->print_center(CL_Display::get_width() / 2, y_pos, str);
-    sprintf(str, _("Number of Pingus: %d"), plf->get_pingus());
+    snprintf(str, 64, _("Number of Pingus: %d"), plf->get_pingus());
     font->print_center(CL_Display::get_width() / 2, (y_pos += 20), str);
   }
 

Index: level_result.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/level_result.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- level_result.cxx    20 Jun 2002 12:22:51 -0000      1.3
+++ level_result.cxx    4 Sep 2002 14:55:11 -0000       1.4
@@ -47,7 +47,7 @@
 void
 PingusLevelResult::draw(void)
 {
-  char  str[1024];
+  char  str[128];
 
   PingusSound::play_music("../data/music/pingus-2.it");
 
@@ -65,18 +65,18 @@
     font->print_center(CL_Display::get_width() / 2, 100,
                     get_message(100 * world->get_saved_pingus() / 
world->get_allowed_pingus()).c_str());
   */
-  sprintf(str,  _("Pingus saved:   %3d/%3d"), 
+  snprintf(str, 128, _("Pingus saved:   %3d/%3d"), 
          world->get_saved_pingus(),
          world->get_allowed_pingus());
   font->print_center(CL_Display::get_width() / 2, 140, str);
 
-  sprintf(str,  _("Pingus killed:  %3d/%3d"), 
+  snprintf(str, 128, _("Pingus killed:  %3d/%3d"), 
          world->get_allowed_pingus() - world->get_saved_pingus(),
          world->get_allowed_pingus());
   font->print_center(CL_Display::get_width() / 2, 160, str);
 
   /*
-  sprintf(str,  _("Required Time: %2d:%2d:%2d"), 
+  snprintf(str, 128, _("Required Time: %2d:%2d:%2d"), 
          result.time / (60 * game_speed),
          result.time / game_speed % 60, 
          (result.time * 100) / game_speed % 100);
@@ -96,10 +96,9 @@
 }
 
 std::string
-PingusLevelResult::get_message(int saved)
+PingusLevelResult::get_message (int saved)
 {
   if (saved == 100) {
-    // (100%--) survival: Aww, and we wanted to say: 'No Pingus were harmed in 
the completion of this level'
     return _("As many Pingus escaped as entered the level. Thats going to be 
hard to beat.... unless this game becomes pornographic.");
   } else if (saved > 90) {
     return _("Very impressive indeed.");
@@ -109,7 +108,7 @@
     return _("Not too shabby, not too shabby at all.");
   } else if (saved > 60) {
     return _("That was OK, but Pingu life insurance premiums have just gotten 
more expensive.");
-  } else if (saved > 60) {
+  } else if (saved > 55) {
     return _("Maybe this level calls for a different strategy.");
   } else if (saved > 50) {
     return _("Exactly half. Are you saving only the female ones, you kinky 
sod!?");

Index: multiplayer_client_child.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/multiplayer_client_child.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- multiplayer_client_child.cxx        25 Aug 2002 09:08:48 -0000      1.9
+++ multiplayer_client_child.cxx        4 Sep 2002 14:55:11 -0000       1.10
@@ -96,8 +96,8 @@
   /*Pingu* pingu = playfield->get_pingu (controller->get_pos ());
   if (pingu && pingu->get_owner () == controller->get_owner ())
     {
-      char str[256];
-      sprintf(str, "Pingu: %d:%s",
+      char str[64];
+      snprintf(str, 64, "Pingu: %d:%s",
              pingu->get_id(), 
                  
Actions::action_to_string(button_panel->get_action_name()).c_str());
       server->send_event(str);

Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- pingu.cxx   25 Aug 2002 09:08:48 -0000      1.20
+++ pingu.cxx   4 Sep 2002 14:55:11 -0000       1.21
@@ -32,6 +32,7 @@
 #include "my_gettext.hxx"
 #include "debug.hxx"
 #include "string_converter.hxx"
+#include "worldobj.hxx"
 
 using namespace Actions;
 
@@ -39,48 +40,31 @@
 int   Pingu::id_counter = 0;
 
 // Init a pingu at the given position while falling
-Pingu::Pingu(const CL_Vector& arg_pos, int owner)
-  : action(0),
-    countdown_action (0),
-    wall_action(0),
-    fall_action(0),
-    id (++id_counter),
-    font (PingusResource::load_font("Fonts/numbers", "fonts")),
-    owner_id (owner),
-    status (PS_ALIVE),
-    pos (arg_pos)
+Pingu::Pingu (const CL_Vector& arg_pos, int owner)
+            : action(0),
+              countdown_action (0),
+              wall_action(0),
+              fall_action(0),
+              id(++id_counter),
+              font(PingusResource::load_font("Fonts/numbers", "fonts")),
+              action_time(-1),
+              owner_id(owner),
+              status(PS_ALIVE),
+             pos_x(arg_pos.x),
+             pos_y(arg_pos.y),
+              velocity(new CL_Vector(0, 0, 0))
 {
-  action_time = -1;
-
   direction.left ();
-
-  // Set the velocity to zero
-  velocity.x = 0;
-  velocity.y = 0;
-
   set_action(Faller);
 }
 
-Pingu::~Pingu()
-{
-}
-
-// Returns the x position of the pingu
-int
-Pingu::get_x()
-{
-  return int(pos.x);
-}
-
-// Returns the y position of the pingu
-int
-Pingu::get_y()
+Pingu::~Pingu ()
 {
-  return int(pos.y);
+  delete velocity;
 }
 
 int
-Pingu::get_id()
+Pingu::get_id ()
 {
   return id;
 }
@@ -92,18 +76,17 @@
   return action->change_allowed (new_action);
 }
 
-// Set the position of the pingu
-void 
-Pingu::set_pos(int x, int y)
+void
+Pingu::set_pos (const CL_Vector& arg_pos)
 {
-  pos.x = x;
-  pos.y = y;
+  pos_x = arg_pos.x;
+  pos_y = arg_pos.y;
 }
 
-void 
-Pingu::set_pos(const CL_Vector& arg_pos)
+void
+Pingu::set_velocity (const CL_Vector& velocity_)
 {
-  pos = arg_pos;
+  *velocity = velocity_;
 }
 
 // Set the action of the pingu (bridger, blocker, bomber, etc.)
@@ -111,7 +94,7 @@
 // When you select a function on the button panel and click on a
 // pingu, this action will be called with the action name
 bool
-Pingu::request_set_action(PinguAction* act)
+Pingu::request_set_action (PinguAction* act)
 {
   bool ret_val = false;
   assert(act);
@@ -125,78 +108,78 @@
     {    
       switch (act->get_activation_mode()) {
   
-      case INSTANT:
+        case INSTANT:
+  
+          if (act->get_type() == action->get_type()) 
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Already have action" << 
std::endl;
+             ret_val = false;
+           } 
+          else if (action->change_allowed(act->get_type()))
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "setting instant action" << 
std::endl;
+             act->set_pingu(this);
+             set_action(act);
+             ret_val = true;
+           }
+          else
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "change from action " << 
action->get_name () << " not allowed" << std::endl;
+             ret_val = false;
+           }
+          break;
+                
+        case WALL_TRIGGERED:
     
-       if (act->get_type() == action->get_type()) 
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Already have action" << 
std::endl;
-           ret_val = false;
-         } 
-       else if (action->change_allowed(act->get_type()))
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "setting instant action" << std::endl;
-           act->set_pingu(this);
-           set_action(act);
-           ret_val = true;
-         }
-       else
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "change from action " << 
action->get_name () << " not allowed" << std::endl;
-           ret_val = false;
-         }
-       break;
-                  
-      case WALL_TRIGGERED:
-      
-       if (wall_action && wall_action->get_type() == act->get_type())
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "Not using wall action, we have 
already" << std::endl;
-           ret_val = false;
-         }
-       else
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "Setting wall action" << std::endl;
-           wall_action = act;
-           ret_val = true;
-         }
-       break;
-      
-      case FALL_TRIGGERED:
+          if (wall_action && wall_action->get_type() == act->get_type())
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "Not using wall action, we have 
already" << std::endl;
+             ret_val = false;
+           }
+          else
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "Setting wall action" << std::endl;
+             wall_action = act;
+             ret_val = true;
+           }
+          break;
     
-       if (fall_action && fall_action->get_type() == act->get_type())
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "Not using fall action, we have 
already" << std::endl;
-           ret_val = false;
-         }
-       else
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "Setting fall action" << std::endl;
-           fall_action = act;
-           ret_val = true;
-         }
-       break;
+        case FALL_TRIGGERED:
+  
+          if (fall_action && fall_action->get_type() == act->get_type())
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "Not using fall action, we have 
already" << std::endl;
+             ret_val = false;
+           }
+          else
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "Setting fall action" << std::endl;
+             fall_action = act;
+             ret_val = true;
+           }
+          break;
 
-      case COUNTDOWN_TRIGGERED:
-    
-       if (countdown_action && countdown_action->get_type() == act->get_type())
-         {
-           pout(PINGUS_DEBUG_ACTIONS) << "Not using countdown action, we have 
already" << std::endl;
-           ret_val = false;
-           break;
-         }
-        
-       pout(PINGUS_DEBUG_ACTIONS) << "Setting countdown action" << std::endl;
-       // We set the action and start the countdown
-       action_time = act->activation_time();
-       countdown_action = act;
-       ret_val = true;
-       break;
-           
-      default:
-       pout(PINGUS_DEBUG_ACTIONS) << "unknown action activation_mode" << 
std::endl;     
-       assert(0);
-       ret_val = false;
-       break;
+        case COUNTDOWN_TRIGGERED:
+  
+          if (countdown_action && countdown_action->get_type() == 
act->get_type())
+           {
+             pout(PINGUS_DEBUG_ACTIONS) << "Not using countdown action, we 
have already" << std::endl;
+             ret_val = false;
+             break;
+           }
+      
+          pout(PINGUS_DEBUG_ACTIONS) << "Setting countdown action" << 
std::endl;
+          // We set the action and start the countdown
+          action_time = act->activation_time();
+          countdown_action = act;
+          ret_val = true;
+          break;
+         
+        default:
+          pout(PINGUS_DEBUG_ACTIONS) << "unknown action activation_mode" << 
std::endl;     
+          assert(0);
+          ret_val = false;
+          break;
       }
     }
 
@@ -219,14 +202,14 @@
 }
 
 void
-Pingu::set_action(ActionName action_name) 
+Pingu::set_action (ActionName action_name) 
 {
   set_action (PinguActionFactory::instance ()->create (action_name));
 }
 
 // Sets an action without any checking
 void
-Pingu::set_action(PinguAction* act) 
+Pingu::set_action (PinguAction* act) 
 {
   assert(act);
   action = act;
@@ -258,20 +241,20 @@
 }
 
 PinguStatus
-Pingu::get_status(void) const
+Pingu::get_status (void) const
 {
   return status;
 }
 
 PinguStatus
-Pingu::set_status(PinguStatus s)
+Pingu::set_status (PinguStatus s)
 {
   return (status = s);
 }
 
 // Returns true if the given koordinates are above the pingu
 bool
-Pingu::is_over(int x, int y)
+Pingu::is_over (int x, int y)
 {
   CL_Vector center = get_center_pos ();
 
@@ -285,9 +268,9 @@
   assert (x1 < x2);
   assert (y1 < y2);
 
-  return (pos.x > x1 && pos.x < x2 
+  return (pos_x > x1 && pos_x < x2 
          &&
-         pos.y > y1 && pos.y < y2);
+         pos_y > y1 && pos_y < y2);
 }
 
 // Returns the distance between the Pingu and a given coordinate
@@ -301,7 +284,7 @@
 
 // Let the pingu do his job (i.e. walk his way)
 void
-Pingu::update(float delta)
+Pingu::update (float delta)
 {
   if (status == PS_DEAD)
     return;
@@ -336,9 +319,9 @@
 
 // Draws the pingu on the screen with the given offset
 void
-Pingu::draw_offset(int x, int y, float s)
+Pingu::draw_offset (int x, int y, float s)
 {
-  char str[64];
+  char str[16];
   y += 2;
 
   action->draw_offset(x, y,s);
@@ -348,16 +331,17 @@
       // FIXME: some people preffer a 5-0 or a 9-0 countdown, not sure
       // FIXME: about that got used to the 50-0 countdown [counting is
       // FIXME: in ticks, should probally be in seconds]
-      sprintf(str, "%d", action_time);
+      snprintf(str, 16, "%d", action_time);
       
       if (s == 1.0) 
        {
-         font->print_center(int(pos.x + x), int(pos.y - 45) + y, str);
+         font->print_center(static_cast<int>(pos_x + x), 
static_cast<int>(pos_y - 45) + y, str);
        } 
       else if (s > 1.0) 
        {
-         font->print_left(int((pos.x + x) * s), (int)((pos.y - 45 + y) * s) - 
(int(font->get_text_width(str) * s) / 2),
-                          int(s), int(s),
+         font->print_left(static_cast<int>((pos_x + x) * s),
+                          static_cast<int>((pos_y - 45 + y) * s) - 
(static_cast<int>(font->get_text_width(str) * s) / 2),
+                          static_cast<int>(s), static_cast<int>(s),
                           str);
        }
       else 
@@ -368,64 +352,68 @@
 }
 
 int
-Pingu::rel_getpixel(int x, int y)
+Pingu::rel_getpixel (int x, int y)
 {
-  return world->get_colmap()->getpixel(int(pos.x + (x * direction)), 
int((pos.y) - y));
+  return WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pos_x 
+ (x * direction)), 
+                                                       static_cast<int>(pos_y 
- y));
 }
 
 void
-Pingu::catch_pingu(Pingu* pingu)
+Pingu::catch_pingu (Pingu* pingu)
 {
   action->catch_pingu(pingu);
 }
 
 bool
-Pingu::need_catch()
+Pingu::need_catch ()
 {
-  if (status == PS_DEAD)
+  if (status == PS_DEAD || status == PS_EXITED)
     return false;
   
   return action->need_catch();
 }
 
 void
-Pingu::set_direction(Direction d)
+Pingu::set_direction (Direction d)
 {
   direction = d;
 }
 
 bool
-Pingu::is_alive(void)
+Pingu::is_alive (void)
 {
-  if (status != PS_DEAD && status != PS_EXITED)
-    return true;
-  else 
-    return false;
+  return (status != PS_DEAD && status != PS_EXITED);
 }
 
 PinguAction*
-Pingu::get_action()
+Pingu::get_action ()
 {
   return action;
 }
 
 void
-Pingu::apply_force(CL_Vector arg_v)
+Pingu::apply_force (CL_Vector arg_v)
 {
-  velocity += arg_v;
+  *velocity += arg_v;
   // Moving the pingu on pixel up, so that the force can take effect
   // FIXME: this should be handled by a state-machine
-  pos.y -= 1; 
+  --pos_y; 
 }
 
 CL_Vector
-Pingu::get_center_pos ()
+Pingu::get_pos () const
 {
-  return pos + CL_Vector (0, -16); 
+  return CL_Vector(pos_x, pos_y, 0);
+}
+
+CL_Vector
+Pingu::get_center_pos () const
+{
+  return CL_Vector(pos_x, pos_y) + CL_Vector (0, -16); 
 }
 
 int 
-Pingu::set_id(int i)
+Pingu::set_id (int i)
 {
   return (id = i);
 }

Index: pingu.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.hxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pingu.hxx   25 Aug 2002 09:08:48 -0000      1.11
+++ pingu.hxx   4 Sep 2002 14:55:11 -0000       1.12
@@ -20,23 +20,19 @@
 #ifndef HEADER_PINGUS_PINGU_HXX
 #define HEADER_PINGUS_PINGU_HXX
 
-#include <vector>
-#include <string>
-#include <ClanLib/Core/Math/cl_vector.h>
-
 #include "direction.hxx"
 #include "pingu_enums.hxx"
-#include "worldobj.hxx"
 
 // Forward declarations
 class CL_Font;
+class CL_Vector;
 class ActionHolder;
 class PinguAction;
 
 /** The class for managing one of the many penguins which are walking
     around in the World. All actions are handled by PinguAction
     objects. */
-class Pingu : public WorldObj
+class Pingu
 {
 private:
   /** Static id_counter, which holds the id last pingu, which
@@ -64,16 +60,18 @@
   int action_time;
   int owner_id;
 
-public:
-
   /// The stat of the pingu, these can be modified by PinguActions
   PinguStatus status;
   
-  /// The postion of the pingu (CL_Vector::z is always zero)
-  CL_Vector pos;
-  Direction direction;
-  CL_Vector velocity; 
+  float pos_x;
+  float pos_y;
+  
+  CL_Vector* const velocity; 
 
+public:
+
+  //FIXME make me private
+  Direction direction;
 
   bool request_set_action (PinguAction*);
   
@@ -82,57 +80,64 @@
   /** Creates a new Pingu at the given coordinates
       @param pos The start position of the pingu
       @param owner The owner id of the pingu (used for multiplayer) */
-  Pingu(const CL_Vector& pos, int owner);
+  Pingu (const CL_Vector& pos, int owner);
   
   /** Destruct the pingu... */
-  ~Pingu();
+  ~Pingu ();
   
   /** Return the logical pingus position, this is the position which
       is used for collision detection to the ground (the pingus
       feet) */
-  CL_Vector get_pos () { return pos; }
+  CL_Vector get_pos () const;
 
   /** Returns the visible position of the pingu, the graphical center
       of the pingu. */
-  CL_Vector get_center_pos ();
+  CL_Vector get_center_pos () const;
 
   /** Returns the x position of the pingu
    * For backward comp. only
    */
-  int  get_x(void);
+  const float& get_x () const { return pos_x; }
 
   /** Returns the y position of the pingu
       For backward comp. only */
-  int  get_y(void);
+  const float& get_y () const { return pos_y; }
 
   /** Checks if this action allows to be overwritten with the given new action 
*/
   bool change_allowed (Actions::ActionName new_action);
 
   /// Check if the pingu is still alive
-  bool is_alive(void);
+  bool is_alive (void);
 
   /// Return the status of the pingu
-  PinguStatus get_status(void) const; 
+  PinguStatus get_status (void) const; 
 
-  ///
-  PinguStatus set_status(PinguStatus);
+  PinguStatus set_status (PinguStatus);
 
-  PinguAction* get_action();
+  PinguAction* get_action ();
 
   /// Returns the unique id of the pingu
-  int  get_id(void); 
+  int  get_id (void); 
   
   /// Set's the unique id of the pingu
-  int  set_id(int);
+  int  set_id (int);
   
   /// Set the pingu to the given coordinates
-  void set_pos(int x, int y);
+  void set_pos (float x, float y) { pos_x = x; pos_y = y; }
+
+  void set_x (float x) { pos_y = x; }
+  
+  void set_y (float y) { pos_y = y; }
 
   /// Set the pingu to the given coordinates
-  void set_pos(const CL_Vector& arg_pos);
- 
+  void set_pos (const CL_Vector& arg_pos);
+
+  const CL_Vector& get_velocity () const { return *velocity; }
+  
+  void set_velocity (const CL_Vector& velocity_);
+      
   // Set the pingu in the gives direction
-  void set_direction(Direction d);
+  void set_direction (Direction d);
 
   /** Request an action to be set to the pingu, if its a persistent
       action, it will be hold back for later execution, same with a
@@ -150,45 +155,44 @@
   /// set the fall action if we have one
   bool request_fall_action ();
 
-  PinguAction* get_wall_action() { return wall_action; }
+  PinguAction* get_wall_action () { return wall_action; }
   
-  PinguAction* get_fall_action() { return fall_action; }
+  PinguAction* get_fall_action () { return fall_action; }
 
   /** Returns the `color' of the colmap in the walking direction 
       Examples: 
       (0, -1) is the pixel under the pingu
       (1, 0)  is the pixel in front of the pingu
   */
-  int  rel_getpixel(int x, int y);
+  int  rel_getpixel (int x, int y);
 
   /** Let the pingu catch another pingu, so that an action can be
       applied (i.e. let a blocker change the direction f another
       pingu) */
-  void catch_pingu(Pingu* pingu);
+  void catch_pingu (Pingu* pingu);
 
   /** Returns true if the pingu needs to catch another pingu */
-  bool need_catch();
+  bool need_catch ();
   
-  void draw_offset(int x, int y, float s = 1.0);
-  void apply_force(CL_Vector);
+  void draw_offset (int x, int y, float s = 1.0);
+  void apply_force (CL_Vector);
   
-  void update(float delta);
+  void update (float delta);
   
   /** Indicate if the pingu's speed is above the deadly velocity */
   //bool is_tumbling () const;
   
-  float get_z_pos() const { return 0; }
+  float get_z_pos () const { return 0; }
 
   /** @return The owner_id of the owner, only used in multiplayer
       configurations, ought to bed single player */
   int get_owner ();
 
-  ///
-  bool   is_over(int x, int y);
-  ///
+  bool   is_over (int x, int y);
+
   bool   is_inside (int x1, int y1, int x2, int y2);
-  ///
-  double dist(int x, int y);
+
+  double dist (int x, int y);
 
   /** Return true if the pingu can be catched with the mouse and
       another action can be applied, false otherwise (exiter,
@@ -203,4 +207,3 @@
 #endif /* PINGU_HH */
 
 /* EOF */
-

Index: pingu_action.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pingu_action.cxx    23 Aug 2002 15:49:49 -0000      1.6
+++ pingu_action.cxx    4 Sep 2002 14:55:11 -0000       1.7
@@ -22,6 +22,7 @@
 #include "world.hxx"
 #include "pingu.hxx"
 #include "pingu_action.hxx"
+#include "worldobj.hxx"
 
 // Initialise class static.
 const int PinguAction::pingu_height = 26;
@@ -45,7 +46,7 @@
 // Checks if the pingu action needs to catch another pingu (needed for 
 // example by the blocker)
 bool 
-PinguAction::need_catch() 
+PinguAction::need_catch () 
 { 
   return false; 
 }
@@ -55,7 +56,8 @@
 int
 PinguAction::rel_getpixel (int x, int y)
 {
-  return pingu->get_world()->get_colmap()->getpixel(pingu->get_x() + (x * 
pingu->direction), (pingu->get_y ()) - y);
+  return 
WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pingu->get_x() + 
(x * pingu->direction)),
+                                                       
static_cast<int>(pingu->get_y() - y));
 }
 
 ActionType
@@ -76,7 +78,7 @@
 {
   int pixel = rel_getpixel(x, y + pingu_height);
 
-  if (pixel != GroundpieceData::GP_NOTHING && !(pixel &  
GroundpieceData::GP_BRIDGE))
+  if (pixel != GroundpieceData::GP_NOTHING && !(pixel & 
GroundpieceData::GP_BRIDGE))
     return true;
 
   return false;

Index: pingu_action.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pingu_action.hxx    25 Aug 2002 09:08:48 -0000      1.12
+++ pingu_action.hxx    4 Sep 2002 14:55:11 -0000       1.13
@@ -20,7 +20,6 @@
 #ifndef HEADER_PINGUS_PINGU_ACTION_HXX
 #define HEADER_PINGUS_PINGU_ACTION_HXX
 
-#include "worldobj.hxx"
 #include "pingu_enums.hxx"
 
 class Pingu;
@@ -38,7 +37,7 @@
     used to inherit classes which represent the actions. The actions
     are stored in a seperate library, have a look in actions/ for some
     examples. */
-class PinguAction : public WorldObj
+class PinguAction
 {
 protected:
   /** A pointer to the pingu, which hold the action. */
@@ -106,9 +105,6 @@
       another action can be applied, false otherwise (exiter,
       splashed, etc.) */
   virtual bool catchable () { return true; }
-
-  // FIXME: z_pos is currently unused for pingu actions
-  virtual float get_z_pos () const { return 0; }
 
   /// True if Pingu in specified position would bang its head if it were 
walking
   bool head_collision_on_walk (int x, int y);

Index: pingu_holder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_holder.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pingu_holder.cxx    23 Aug 2002 15:49:49 -0000      1.4
+++ pingu_holder.cxx    4 Sep 2002 14:55:11 -0000       1.5
@@ -17,6 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <iostream>
 #include "pingu_holder.hxx"
 #include "pingu.hxx"
 

Index: pingu_info.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_info.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pingu_info.cxx      20 Jun 2002 12:22:51 -0000      1.3
+++ pingu_info.cxx      4 Sep 2002 14:55:11 -0000       1.4
@@ -50,23 +50,22 @@
                        y_pos + CL_Display::get_height() - 5,
                        0.2f, 0.2f, 0.2f, 1.0f);
   if (pingu) {
-    char str1[256];
-    char str2[256];
+    char str[128];
 
-    sprintf(str1, _("pingu_id %d"), pingu->get_id());
+    snprintf(str, 128, _("pingu_id %d"), pingu->get_id());
     font->print_left(x_pos + CL_Display::get_width() - 185, 
                     y_pos + CL_Display::get_height() - 50,
-                    tolowerstr(str1));
+                    str);
 
     if (pingu->get_action()) {
-      sprintf(str2, _("action %s"), pingu->get_action()->get_name().c_str());
+      snprintf(str, 128, _("action %s"), 
pingu->get_action()->get_name().c_str());
     } else {
-      sprintf(str2, _("action none"));
+      snprintf(str, 128, _("action none"));
     }
 
     font->print_left(x_pos + CL_Display::get_width() - 185, 
                     y_pos + CL_Display::get_height() - 30,
-                    tolowerstr(str2));
+                    tolowerstr(str));
   } else {
     font->print_left(x_pos + CL_Display::get_width() - 200, 
                     y_pos + CL_Display::get_height() - 50,

Index: pingus_counter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_counter.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pingus_counter.cxx  20 Jun 2002 11:23:53 -0000      1.4
+++ pingus_counter.cxx  4 Sep 2002 14:55:11 -0000       1.5
@@ -41,19 +41,18 @@
 void 
 PingusCounter::draw(void)
 {
-  char str[256];
+  char str[128];
 
   background.put_screen (CL_Display::get_width ()/2 - 
background.get_width()/2, 0);
   
   World* world = client->get_server()->get_world();
   
-  // FIXME: Buffer overflow...
-  sprintf(str, _("Released: %3d/%3d  Out: %3d  Saved: %3d/%3d"),
-         world->get_released_pingus(),
-         world->get_allowed_pingus(),
-         world->get_pingus_out(),
-         world->get_saved_pingus(),
-         world->get_number_to_save());
+  snprintf(str, 128, _("Released: %3d/%3d  Out: %3d  Saved: %3d/%3d"),
+          world->get_released_pingus(),
+          world->get_allowed_pingus(),
+          world->get_pingus_out(),
+          world->get_saved_pingus(),
+          world->get_number_to_save());
 
   font->print_center(CL_Display::get_width ()/2,3, str);
 }

Index: pingus_menu.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pingus_menu.hxx     23 Aug 2002 15:49:50 -0000      1.6
+++ pingus_menu.hxx     4 Sep 2002 14:55:11 -0000       1.7
@@ -20,8 +20,6 @@
 #ifndef HEADER_PINGUS_PINGUS_MENU_HXX
 #define HEADER_PINGUS_PINGUS_MENU_HXX
 
-#include <list>
-#include "game_delta.hxx"
 #include "pingus_sub_menu.hxx"
 #include "layer_manager.hxx"
 

Index: pingus_menu_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu_manager.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pingus_menu_manager.hxx     23 Aug 2002 15:49:50 -0000      1.9
+++ pingus_menu_manager.hxx     4 Sep 2002 14:55:11 -0000       1.10
@@ -26,8 +26,6 @@
 #include "pingus_menu.hxx"
 #include "intro.hxx"
 #include "option_menu.hxx"
-#include "game_delta.hxx"
-#include "screen.hxx"
 
 class PingusSubMenu;
 

Index: pingus_resource.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_resource.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pingus_resource.hxx 23 Aug 2002 15:49:50 -0000      1.7
+++ pingus_resource.hxx 4 Sep 2002 14:55:11 -0000       1.8
@@ -23,7 +23,6 @@
 #include <map>
 
 #include <ClanLib/Display/Display/surface.h>
-#include "resource_modifier.hxx"
 #include "res_descriptor.hxx"
 
 class CL_Font;

Index: playfield.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/playfield.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- playfield.cxx       25 Aug 2002 09:08:48 -0000      1.18
+++ playfield.cxx       4 Sep 2002 14:55:11 -0000       1.19
@@ -226,9 +226,9 @@
   std::cout << "Playfield::on_primary_button_press(" << x << ", " << y << 
std::endl;
   if (current_pingu)
     {
-      char str[256];
-      sprintf(str, "Pingu: %d:%s", current_pingu->get_id(), 
-                 
Actions::action_to_string(buttons->get_action_name()).c_str());
+      char str[128];
+      snprintf(str, 128, "Pingu: %d:%s", current_pingu->get_id(), 
+                        
Actions::action_to_string(buttons->get_action_name()).c_str());
       server->send_event(str);
     }
 }

Index: plt_parser.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/plt_parser.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- plt_parser.cxx      16 Aug 2002 15:13:59 -0000      1.4
+++ plt_parser.cxx      4 Sep 2002 14:55:11 -0000       1.5
@@ -87,8 +87,8 @@
   } else if (keyword == "Background") {
     background_image = value;
   } else {
-    char str[1024];
-    sprintf(str, _("Unexpected keyword: '%s' at line: %d"), keyword.c_str(), 
lineno);
+    char str[128];
+    snprintf(str, 128, _("Unexpected keyword: '%s' at line: %d"), 
keyword.c_str(), lineno);
     PingusError::raise(str);
   }
 }
@@ -128,8 +128,8 @@
   c = get_char();
 
   if (c != ch) {
-    char str[1024];
-    sprintf(str, "Unexpected '%c' at line: %d", c, lineno);
+    char str[48];
+    snprintf(str, 48, "Unexpected '%c' at line: %d", c, lineno);
     PingusError::raise(str);
   }
   jump_spaces();

Index: res_descriptor.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/res_descriptor.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- res_descriptor.hxx  23 Aug 2002 15:49:50 -0000      1.6
+++ res_descriptor.hxx  4 Sep 2002 14:55:11 -0000       1.7
@@ -20,7 +20,6 @@
 #ifndef HEADER_PINGUS_RES_DESCRIPTOR_HXX
 #define HEADER_PINGUS_RES_DESCRIPTOR_HXX
 
-#include <string>
 #include "resource_modifier.hxx"
 
 /// Resource descriptor, tells were to find a resource.

Index: screenshot.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/screenshot.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- screenshot.cxx      17 Aug 2002 17:56:23 -0000      1.5
+++ screenshot.cxx      4 Sep 2002 14:55:11 -0000       1.6
@@ -161,11 +161,11 @@
 Screenshot::get_filename()
 {
   std::string tmp_filename;
-  char str [256];
+  char str [16];
   int i = 1;
 
   do {
-    sprintf(str, "%d.pnm", i);
+    snprintf(str, 16, "%d.pnm", i);
     tmp_filename = System::get_statdir() + "screenshots/" 
       + "pingus-" + get_date() + "-" + std::string(str);
     ++i;

Index: server.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/server.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- server.cxx  25 Aug 2002 09:08:48 -0000      1.12
+++ server.cxx  4 Sep 2002 14:55:11 -0000       1.13
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <algorithm>
+#include <iostream>
 #include <stdio.h>
 #include "system.hxx"
 #include "pingu.hxx"
@@ -32,11 +33,11 @@
 using namespace std;
 using Actions::action_from_string;
 
-PingusEvent::PingusEvent()
+PingusEvent::PingusEvent ()
 {
 }
 
-PingusEvent::PingusEvent(std::string event_str)
+PingusEvent::PingusEvent (const std::string& event_str)
 {
   std::string game_time_str;
   std::string::size_type split_pos = event_str.find(":");

Index: server.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/server.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- server.hxx  23 Aug 2002 15:49:50 -0000      1.4
+++ server.hxx  4 Sep 2002 14:55:11 -0000       1.5
@@ -42,7 +42,7 @@
 
 public:
   PingusEvent ();
-  PingusEvent (std::string);
+  PingusEvent (const std::string& event_str);
   
   PingusEvent (const PingusEvent& old);
   PingusEvent operator= (const PingusEvent&);

Index: smallmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- smallmap.cxx        17 Aug 2002 17:56:23 -0000      1.11
+++ smallmap.cxx        4 Sep 2002 14:55:11 -0000       1.12
@@ -199,21 +199,23 @@
 {
   int x;
   int y;
-  PinguHolder* pingus = client->get_server()->get_world()->get_pingu_p();
+  World* const& world = client->get_server()->get_world();
+  PinguHolder* pingus = world->get_pingu_p();
 
   for(PinguIter i = pingus->begin(); i != pingus->end(); ++i)
     {
       //FIXME: Replace this with put pixel
-      x = x_pos + ((*i)->get_x() * width / 
client->get_server()->get_world()->get_colmap()->get_width());
-      y = y_pos + ((*i)->get_y() * height / 
client->get_server()->get_world()->get_colmap()->get_height());
+      x = static_cast<int>(x_pos + ((*i)->get_x() * width  / 
world->get_colmap()->get_width()));
+      y = static_cast<int>(y_pos + ((*i)->get_y() * height / 
world->get_colmap()->get_height()));
 
       CL_Display::draw_line(x, y, x, y-1, 1.0, 1.0, 0.0, 1.0);
     }
 }
 
 void
-SmallMap::update(float /*delta*/)
+SmallMap::update (float delta)
 {
+  UNUSED_ARG(delta);
 }
 
 bool
@@ -224,22 +226,22 @@
 }
 
 void
-SmallMap::on_pointer_move(int x, int y)
+SmallMap::on_pointer_move (int x, int y)
 {
   int cx, cy;
   ColMap* colmap = client->get_server()->get_world()->get_colmap();
 
   if (scroll_mode)
     {
-      cx = (x - x_pos) * int(colmap->get_width()) / width;
-      cy = (y - y_pos) * int(colmap->get_height()) / height ;
+      cx = (x - x_pos) * static_cast<int>(colmap->get_width()  / width);
+      cy = (y - y_pos) * static_cast<int>(colmap->get_height() / height);
       
       client->get_playfield()->set_viewpoint(cx, cy);
     }
 }
 
 void
-SmallMap::on_primary_button_press(int x, int y)
+SmallMap::on_primary_button_press (int x, int y)
 {
   scroll_mode = true;
 

Index: sound_real.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound_real.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sound_real.cxx      23 Aug 2002 15:49:50 -0000      1.6
+++ sound_real.cxx      4 Sep 2002 14:55:11 -0000       1.7
@@ -126,7 +126,7 @@
 
 
 void
-PingusSoundReal::real_play_music(const std::string & arg_filename, float 
volume)
+PingusSoundReal::real_play_music (const std::string & arg_filename, float 
volume)
 {
   std::string filename;
 
@@ -158,7 +158,7 @@
 
     sample = new CL_SoundBuffer (new CL_Sample(filename.c_str(), NULL), true);
         
-  } else {  // MikMod unterstützt verschiedene Formate
+  } else {  // MikMod should support the rest...
   
 #ifdef HAVE_LIBCLANMIKMOD
       sample = new CL_SoundBuffer (new 
CL_Streamed_MikModSample(filename.c_str()), true);

Index: spot_map.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/spot_map.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- spot_map.cxx        23 Aug 2002 15:49:50 -0000      1.8
+++ spot_map.cxx        4 Sep 2002 14:55:11 -0000       1.9
@@ -370,8 +370,8 @@
   //  assert(sprovider->get_depth() == 8);
   if (sprovider->get_depth() != 8)
     {
-      char str[1024];
-      sprintf(str, _("Image has wrong color depth: %d"), 
sprovider->get_depth());
+      char str[128];
+      snprintf(str, 128, _("Image has wrong color depth: %d"), 
sprovider->get_depth());
       PingusError::raise(str);
     }
   //  assert(provider->get_pixel_format() == RGBA8888);

Index: string_converter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/string_converter.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- string_converter.cxx        8 Jul 2002 17:05:09 -0000       1.5
+++ string_converter.cxx        4 Sep 2002 14:55:11 -0000       1.6
@@ -48,24 +48,24 @@
 std::string 
 StringConverter::to_string (int i)
 {
-  char buffer[64];
-  sprintf (buffer, "%d", i);
+  char buffer[16];
+  snprintf (buffer, 16, "%d", i);
   return buffer;
 }
 
 std::string 
 StringConverter::to_string (long int i)
 {
-  char buffer[128];
-  sprintf (buffer, "%ld", i);
+  char buffer[32];
+  snprintf (buffer, 32, "%ld", i);
   return buffer;
 }
 
 std::string 
 StringConverter::to_string (float i)
 {
-  char buffer[256];
-  sprintf (buffer, "%f", i);
+  char buffer[48];
+  snprintf (buffer, 48, "%f", i);
   return buffer;
 }
 

Index: time_display.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/time_display.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- time_display.cxx    21 Jun 2002 07:45:35 -0000      1.4
+++ time_display.cxx    4 Sep 2002 14:55:11 -0000       1.5
@@ -37,11 +37,11 @@
 TimeDisplay::draw()
 {
   int time_value = server->get_world()->get_time_left();
-  char time_string[256];
+  char time_string[8];
   
   if (time_value == -1 && !(pingus_debug_flags & PINGUS_DEBUG_GAMETIME))
     {
-      sprintf(time_string, "00");
+      snprintf(time_string, 8, "00");
     }
   else
     {  
@@ -52,9 +52,7 @@
          int minutes   = (time_value / (60 * game_speed));
          char* p;
 
-         // FIXME: Buffer overflow...
-         //sprintf(time_string, "%2d:%2d:%2d", minutes, seconds, millisecs);
-         sprintf(time_string, "%2d:%2d", minutes, seconds);
+         snprintf(time_string, 8, "%2d:%2d", minutes, seconds);
 
          p = time_string;
 
@@ -68,8 +66,7 @@
       else
        {
          time_value = server->get_world()->get_time_passed();
-         // FIXME: Buffer overflow...
-         sprintf(time_string, "%4d", time_value);
+         snprintf(time_string, 8, "%4d", time_value);
        }
     }
   font->print_right(CL_Display::get_width() - 5, 1, time_string);

Index: trap_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/trap_data.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- trap_data.cxx       23 Aug 2002 15:49:51 -0000      1.6
+++ trap_data.cxx       4 Sep 2002 14:55:11 -0000       1.7
@@ -18,13 +18,6 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <fstream>
-#include "traps/smasher.hxx"
-#include "traps/hammer.hxx"
-#include "traps/fake_exit.hxx"
-#include "traps/guillotine.hxx"
-#include "traps/laser_exit.hxx"
-#include "traps/spike.hxx"
-#include "traps/bumper.hxx"
 
 #include "pingus_error.hxx"
 #include "editor/plfobj.hxx"
@@ -100,7 +93,7 @@
 
 WorldObj* 
 TrapData::create_WorldObj ()
-{
+{/*
   if (type == "smasher") {
     return new Smasher(*this);
   } else if (type == "hammer") {
@@ -117,7 +110,7 @@
     return new Bumper(*this);
   }
   PingusError::raise("Trap: `" + type + "' is unknown");
-  
+  */
   return 0; // never reached;
 }
 

Index: worldobj.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- worldobj.cxx        23 Aug 2002 15:49:52 -0000      1.3
+++ worldobj.cxx        4 Sep 2002 14:55:11 -0000       1.4
@@ -34,18 +34,6 @@
   // z_pos = 0;
 }
 
-WorldObj::WorldObj (const WorldObj& old)
-{
-  UNUSED_ARG(old);
-}
-
-void
-WorldObj::operator= (const WorldObj& old)
-{
-  UNUSED_ARG(old);
-}
-
-
 WorldObj::~WorldObj()
 {
   

Index: worldobj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- worldobj.hxx        23 Aug 2002 15:49:52 -0000      1.4
+++ worldobj.hxx        4 Sep 2002 14:55:11 -0000       1.5
@@ -47,14 +47,14 @@
   /** Creates a new WorldObj*/
   WorldObj ();
 
-  WorldObj (const WorldObj& old);
-  void operator= (const WorldObj& old);
+  WorldObj (const WorldObj&)       { }
+  void operator= (const WorldObj&) { }
 
   /** Destroys a world object */
-  virtual ~WorldObj();
+  virtual ~WorldObj ();
 
   /** Returns the $z$-position of this object. */
-  virtual float get_z_pos() const =0;
+  virtual float get_z_pos () const =0;
 
   /** Draws this WorldObject on the screen with the specified offset. If not
    *  overloaded, this method does nothing.
@@ -63,16 +63,18 @@
    *  @param y the $y$-coordinate of this object
    *  @param s the scalar by with the object is zoomed (1.0 is default)
    */
-  virtual void draw_offset(int x, int y, float s = 1.0);
+  virtual void draw_offset (int x, int y, float s = 1.0);
 
   /** Draws the objects collision map to the main collision map, this
    *  can be used for traps which need a solid ground. */
-  virtual void draw_colmap();
+  virtual void draw_colmap ();
 
   /** The update function is called once a game loop, the delta
    * specifies how much time is passed since the last update
    * delta = 1.0 means that one second of realtime has passed. */
-  virtual void update(float delta);
+  virtual void update (float delta);
+  
+  virtual WorldObjData* get_data () { return 0; }
 };
 
 #endif

Index: worldobj_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj_data.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- worldobj_data.hxx   23 Aug 2002 15:49:52 -0000      1.5
+++ worldobj_data.hxx   4 Sep 2002 14:55:11 -0000       1.6
@@ -20,9 +20,8 @@
 #ifndef HEADER_PINGUS_WORLDOBJ_DATA_HXX
 #define HEADER_PINGUS_WORLDOBJ_DATA_HXX
 
+#include <iosfwd>
 #include <vector>
-
-#include "editor/editorobj.hxx"
 
 class WorldObj;
 class EditorObj;

Index: worldobj_data_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj_data_factory.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- worldobj_data_factory.cxx   16 Aug 2002 15:13:59 -0000      1.3
+++ worldobj_data_factory.cxx   4 Sep 2002 14:55:11 -0000       1.4
@@ -39,6 +39,16 @@
 #include "entrance_data.hxx"
 #include "worldobj_data_factory.hxx"
 
+#include "worldobjsdata/bumper_data.hxx"
+#include "worldobjsdata/fake_exit_data.hxx"
+#include "worldobjsdata/guillotine_data.hxx"
+#include "worldobjsdata/hammer_data.hxx"
+#include "worldobjsdata/laser_exit_data.hxx"
+#include "worldobjsdata/smasher_data.hxx"
+#include "worldobjsdata/spike_data.hxx"
+
+using namespace WorldObjsData;
+
 WorldObjDataFactory* WorldObjDataFactory::instance_ = 0;
 
 WorldObjDataFactory::WorldObjDataFactory ()
@@ -58,6 +68,14 @@
       new WorldObjDataFactoryImpl<LiquidData>("liquid");
       new WorldObjDataFactoryImpl<HotspotData>("hotspot");
       new WorldObjDataFactoryImpl<EntranceData>("entrance");
+
+      new WorldObjDataFactoryImpl<BumperData>("bumper");
+      new WorldObjDataFactoryImpl<FakeExitData>("fake_exit");
+      new WorldObjDataFactoryImpl<GuillotineData>("guillotine");
+      new WorldObjDataFactoryImpl<HammerData>("hammer");
+      new WorldObjDataFactoryImpl<LaserExitData>("laser_exit");
+      new WorldObjDataFactoryImpl<SmasherData>("smasher");
+      new WorldObjDataFactoryImpl<SpikeData>("spike");
 
       // Special Objects 
       new WorldObjDataFactoryImpl<SwitchDoorData>("switchdoor");

Index: xml_plf.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_plf.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- xml_plf.cxx 25 Aug 2002 09:08:48 -0000      1.11
+++ xml_plf.cxx 4 Sep 2002 14:55:11 -0000       1.12
@@ -27,14 +27,13 @@
 #include "worldobj_group_data.hxx"
 #include "exit_data.hxx"
 #include "entrance_data.hxx"
-#include "trap_data.hxx"
 #include "hotspot_data.hxx"
 #include "liquid_data.hxx"
 
 using namespace std;
 using Actions::action_from_string;
 
-XMLPLF::XMLPLF(const std::string& filename)
+XMLPLF::XMLPLF (const std::string& filename)
 {
   //  std::cout << "----- Parsing .xml file" << std::endl;
   //std::cout << "--- Checksum: " << std::flush;
@@ -72,21 +71,21 @@
   //std::cout << "parsing file" << std::endl;
   xmlNodePtr cur = doc->ROOT;
 
-  if (xmlIsBlankNode(cur)) cur = cur->next;
+  cur = XMLhelper::skip_blank(cur);
 
-  if (cur != NULL && strcmp((const char*)cur->name, "pingus-level") == 0)
+  if (cur && !strcmp(reinterpret_cast<const char*>(cur->name), "pingus-level"))
     {
       //std::cout << "parse_file...." << std::endl;
 
-      if (xmlIsBlankNode(cur)) cur = cur->next;
+      cur = XMLhelper::skip_blank(cur);
 
-      if (cur->children == NULL)
+      if (!cur->children)
        std::cout << "XMLPLF: node: " << cur->name << std::endl;
       
       cur = cur->children;
-      if (xmlIsBlankNode(cur)) cur = cur->next;
+      cur = XMLhelper::skip_blank(cur);
       
-      while (cur != NULL)
+      while (cur)
        {
          if (xmlIsBlankNode(cur)) 
            {
@@ -95,61 +94,61 @@
            }
 
          //puts("global loop");
-         if (strcmp((char*)cur->name, "global") == 0)
+         if (!strcmp(reinterpret_cast<const char*>(cur->name), "global"))
            {
              parse_global(cur);
            }
-         else if (strcmp((char*)cur->name, "action-list") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"action-list"))
            {
              parse_actions(cur);
            }
-         else if (strcmp((char*)cur->name, "background") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"background"))
            {
              parse_background(cur);
            }
-         else if (strcmp((char*)cur->name, "groundpiece") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"groundpiece"))
            {
              parse_groundpiece(cur);
            }
-         else if (strcmp((char*)cur->name, "exit") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), "exit"))
            {
              worldobjs_data.push_back (new ExitData (doc, cur));
            }
-         else if (strcmp((char*)cur->name, "entrance") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"entrance"))
            {
              worldobjs_data.push_back (new EntranceData (doc, cur));
            }
-         else if (strcmp((char*)cur->name, "trap") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), "trap"))
            {
-             worldobjs_data.push_back (new TrapData (doc, cur));
+             parse_traps(doc, cur);
            }
-         else if (strcmp((char*)cur->name, "hotspot") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), "hotspot"))
            {
              worldobjs_data.push_back(new HotspotData (doc, cur));
            }
-         else if (strcmp((char*)cur->name, "liquid") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), "liquid"))
            {
              worldobjs_data.push_back(new LiquidData (doc, cur));
            }
-         else if (strcmp ((char*)cur->name, "worldobj") == 0)
+         else if (!strcmp (reinterpret_cast<const char*>(cur->name), 
"worldobj"))
            {
-             worldobjs_data.push_back(WorldObjDataFactory::instance ()->create 
(doc, cur));
+             worldobjs_data.push_back(WorldObjDataFactory::instance()->create 
(doc, cur));
            }
-         else if (strcmp((char*)cur->name, "group") == 0)
+         else if (!strcmp(reinterpret_cast<const char*>(cur->name), "group"))
            {
              parse_group(cur);
            }
-         else if (strcmp ((char*)cur->name, "start-position") == 0)
+         else if (!strcmp (reinterpret_cast<const char*>(cur->name), 
"start-position"))
            {
              parse_start_pos(cur);
            }
-         else if (strcmp ((char*)cur->name, "weather") == 0)
+         else if (!strcmp (reinterpret_cast<const char*>(cur->name), 
"weather"))
            {
              parse_weather(cur);
            }     
          else
            {
-             printf("XMLPLF: Unhandled: %s\n", (char*)cur->name);
+             printf("XMLPLF: Unhandled: %s\n", reinterpret_cast<const 
char*>(cur->name));
            }
          cur = cur->next;
        }
@@ -160,11 +159,11 @@
 }
 
 void
-XMLPLF::parse_start_pos(xmlNodePtr cur)
+XMLPLF::parse_start_pos (xmlNodePtr cur)
 {
   cur = cur->children;
 
-  while (cur != NULL)
+  while (cur)
     {
       if (xmlIsBlankNode(cur)) 
        {
@@ -172,11 +171,11 @@
          continue;
        }
       
-      if (strcmp((char*)cur->name, "position") == 0)
+      if (!strcmp(reinterpret_cast<const char*>(cur->name), "position"))
        {
          CL_Vector pos = XMLhelper::parse_vector(doc, cur);
-         start_x_pos = int(pos.x);
-         start_y_pos = int(pos.y);
+         start_x_pos = static_cast<int>(pos.x);
+         start_y_pos = static_cast<int>(pos.y);
        }
       else
        {
@@ -187,12 +186,12 @@
 }
 
 void
-XMLPLF::parse_weather(xmlNodePtr cur)
+XMLPLF::parse_weather (xmlNodePtr cur)
 {
   WeatherData weather;
   cur = cur->children;
 
-  while (cur != NULL)
+  while (cur)
     {
       if (xmlIsBlankNode(cur)) 
        {
@@ -200,7 +199,7 @@
          continue;
        }
       
-      if (strcmp((char*)cur->name, "type") == 0)
+      if (!strcmp(reinterpret_cast<const char*>(cur->name), "type"))
        {
          weather.type = XMLhelper::parse_string(doc, cur);
        }
@@ -210,17 +209,18 @@
        }
       cur = cur->next;
     }
+    
   weathers.push_back(weather);
 }
 
 void
-XMLPLF::parse_group(xmlNodePtr cur)
+XMLPLF::parse_group (xmlNodePtr cur)
 {
   cur = cur->children;
 
-  WorldObjGroupData* group = new WorldObjGroupData ();
+  WorldObjGroupData* group = new WorldObjGroupData;
 
-  while (cur != NULL)
+  while (cur)
     {
       if (xmlIsBlankNode(cur)) 
        {
@@ -228,41 +228,41 @@
          continue;
        }
       
-      if (strcmp((char*)cur->name, "groundpiece") == 0)
+      if (!strcmp(reinterpret_cast<const char*>(cur->name), "groundpiece"))
        {
          parse_groundpiece(cur);
        }
-      else if (strcmp((char*)cur->name, "exit") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "exit"))
        {
          group->add (new ExitData (doc, cur));
        }
-      else if (strcmp((char*)cur->name, "entrance") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "entrance"))
        {
          group->add (new EntranceData (doc, cur));
        }
-      else if (strcmp((char*)cur->name, "trap") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "trap"))
        {
-         group->add (new TrapData (doc, cur));
+         parse_traps(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "hotspot") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "hotspot"))
        {
          group->add(new HotspotData (doc, cur));
        }
-      else if (strcmp((char*)cur->name, "liquid") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "liquid"))
        {
          group->add(new LiquidData (doc, cur));
        }
-      else if (strcmp((char*)cur->name, "group") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "group"))
        {
          parse_group(cur);
        }
-      else if (strcmp ((char*)cur->name, "worldobj") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "worldobj"))
        {
-         group->add(WorldObjDataFactory::instance ()->create (doc, cur));
+         group->add(WorldObjDataFactory::instance ()->create(doc, cur));
        }
       else
        {
-         printf("Unhandled: %s\n", (char*)cur->name);
+         printf("Unhandled: %s\n", reinterpret_cast<const char*>(cur->name));
        }
       cur = cur->next;
     }
@@ -271,13 +271,13 @@
 }
 
 void 
-XMLPLF::parse_background(xmlNodePtr cur)
+XMLPLF::parse_background (xmlNodePtr cur)
 {
   // The allocated objects are delete'd in the destructor
   //FIXME: Repair me backgrounds.push_back(BackgroundData::create (doc, cur));
-  char* type_cstr = (char*)xmlGetProp(cur, (xmlChar*)"type");
+  char* type_cstr = reinterpret_cast<char*>(xmlGetProp(cur, 
reinterpret_cast<const xmlChar*>("type")));
 
-  if (type_cstr != 0)
+  if (type_cstr)
     {
       std::string type (type_cstr);
 
@@ -294,11 +294,11 @@
 }
 
 void 
-XMLPLF::parse_actions(xmlNodePtr cur)
+XMLPLF::parse_actions (xmlNodePtr cur)
 {
   cur = cur->children;
 
-  while (cur != NULL)
+  while (cur)
     {
       if (xmlIsBlankNode(cur)) 
        {
@@ -307,9 +307,9 @@
        }
  
       ActionData button;
-      button.name = action_from_string((const char*) cur->name);
+      button.name = action_from_string(reinterpret_cast<const 
char*>(cur->name));
 
-      char* count = (char*)xmlGetProp(cur, (xmlChar*)"count");
+      char* count = reinterpret_cast<char*>(xmlGetProp(cur, 
reinterpret_cast<const xmlChar*>("count")));
       if (count)
        {
          from_string(count, button.number_of);
@@ -318,7 +318,7 @@
       else
        {
          //std::cout << "XMLPLF::parse_actions (): No 'count' given, fallback 
to the old format" << std::endl;
-         char* number = (char*)xmlNodeListGetString(doc, cur->children, 1);
+         char* number = reinterpret_cast<char*>(xmlNodeListGetString(doc, 
cur->children, 1));
          if (number) {
            //std::cout << "xmlNoder..Result: " << number << std::endl;
            button.number_of = StringConverter::to_int(number);
@@ -335,10 +335,10 @@
 }
 
 void
-XMLPLF::parse_global(xmlNodePtr cur)
+XMLPLF::parse_global (xmlNodePtr cur)
 {
   cur = cur->children;
-  while (cur != NULL)
+  while (cur)
     {
       if (xmlIsBlankNode(cur)) 
        {
@@ -346,10 +346,10 @@
          continue;
        }
 
-      if (strcmp((char*)cur->name, "levelname") == 0)
+      if (!strcmp(reinterpret_cast<const char*>(cur->name), "levelname"))
        {
-         char* name = (char*)xmlNodeListGetString(doc, cur->children, 1);
-         char* lang = (char*)xmlGetProp(cur, (xmlChar*)"lang");
+         char* name = reinterpret_cast<char*>(xmlNodeListGetString(doc, 
cur->children, 1));
+         char* lang = reinterpret_cast<char*>(xmlGetProp(cur, 
reinterpret_cast<const xmlChar*>("lang")));
 
          if (name) {
            if (lang)
@@ -358,13 +358,15 @@
              levelname[default_language] = name;
          }
 
-         if (name) xmlFree(name);
-         if (lang) xmlFree(lang);
+         if (name)
+           xmlFree(name);
+         if (lang)
+           xmlFree(lang);
        }
-      else if (strcmp((char*)cur->name, "description") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"description"))
        {
-         char* desc = (char*)xmlNodeListGetString(doc, cur->children, 1);
-         char* lang = (char*)xmlGetProp(cur, (xmlChar*)"lang");
+         char* desc = reinterpret_cast<char*>(xmlNodeListGetString(doc, 
cur->children, 1));
+         char* lang = reinterpret_cast<char*>(xmlGetProp(cur, 
reinterpret_cast<const xmlChar*>("lang")));
 
          if (desc) {
            if (lang)               
@@ -373,47 +375,49 @@
              description[default_language] = desc;
          }
 
-         if (desc) xmlFree(desc);        
-         if (lang) xmlFree(lang);
+         if (desc)
+           xmlFree(desc);        
+         if (lang)
+           xmlFree(lang);
        }
-      else if (strcmp((char*)cur->name, "author") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "author"))
        {
-         char* tmp_author = (char*)xmlNodeListGetString(doc, cur->children, 1);
+         char* tmp_author = reinterpret_cast<char*>(xmlNodeListGetString(doc, 
cur->children, 1));
          if (tmp_author) {
            author = tmp_author;
            xmlFree(tmp_author);
          }
          //std::cout << "Author: " << author << " -----------------------" << 
std::endl;
        }
-      else if (strcmp((char*)cur->name, "number-of-pingus") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"number-of-pingus"))
        {
          number_of_pingus = XMLhelper::parse_int(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "difficulty") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "difficulty"))
        {
          difficulty = XMLhelper::parse_int(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "playable") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "playable"))
        {
          playable = XMLhelper::parse_int(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "comment") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "comment"))
        {
          comment = XMLhelper::parse_string(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "number-to-save") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), 
"number-to-save"))
        {
          number_to_save = XMLhelper::parse_int(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "time") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "time"))
        {
          max_time = XMLhelper::parse_int(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "height") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "height"))
        {
          height = XMLhelper::parse_int(doc, cur);
        }
-      else if (strcmp((char*)cur->name, "width") == 0)
+      else if (!strcmp(reinterpret_cast<const char*>(cur->name), "width"))
        {
          width = XMLhelper::parse_int(doc, cur);
        }
@@ -427,9 +431,28 @@
 }
 
 void 
-XMLPLF::parse_groundpiece(xmlNodePtr cur)
+XMLPLF::parse_groundpiece (xmlNodePtr cur)
 {
   groundpieces.push_back(GroundpieceData (doc, cur));
+}
+
+void
+XMLPLF::parse_traps (xmlDocPtr doc, xmlNodePtr cur)
+{
+  xmlNodePtr cur_ = XMLhelper::skip_blank(cur->children);
+  
+  if (!strcmp(reinterpret_cast<const char*>(cur_->name), "type"))
+    {
+      char* name = reinterpret_cast<char*>(xmlNodeListGetString(doc, 
cur_->children, 1));
+      if (name)
+       {
+         worldobjs_data.push_back(WorldObjDataFactory::instance()->create 
(name, doc, XMLhelper::skip_blank(cur)));
+         xmlFree(name);
+         return;
+       }
+    }
+
+  std::cout << "XMLPLF::parse_traps: Invalid data structure" << std::endl;
 }
 
 /* EOF */

Index: xml_plf.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_plf.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xml_plf.hxx 23 Aug 2002 15:49:52 -0000      1.4
+++ xml_plf.hxx 4 Sep 2002 14:55:11 -0000       1.5
@@ -28,7 +28,7 @@
 private:
   xmlDocPtr doc;  
 
-  void parse_file();
+  void parse_file ();
 
   void parse_background  (xmlNodePtr cur);
   void parse_actions     (xmlNodePtr cur);
@@ -37,6 +37,7 @@
   void parse_group       (xmlNodePtr cur);
   void parse_start_pos   (xmlNodePtr cur);
   void parse_weather     (xmlNodePtr cur);
+  void parse_traps       (xmlDocPtr  doc, xmlNodePtr node);
 
 public:
   XMLPLF (const std::string& filename);





reply via email to

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