pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3893 - in trunk/pingus: . src src/actions src/editor src/w


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3893 - in trunk/pingus: . src src/actions src/editor src/worldobjs
Date: Tue, 22 Jul 2008 04:45:06 +0200

Author: grumbel
Date: 2008-07-22 04:44:55 +0200 (Tue, 22 Jul 2008)
New Revision: 3893

Removed:
   trunk/pingus/src/pingu_action_factory.cpp
   trunk/pingus/src/pingu_action_factory.hpp
Modified:
   trunk/pingus/SConstruct
   trunk/pingus/src/action_holder.cpp
   trunk/pingus/src/action_holder.hpp
   trunk/pingus/src/actions/angel.hpp
   trunk/pingus/src/actions/basher.cpp
   trunk/pingus/src/actions/basher.hpp
   trunk/pingus/src/actions/blocker.cpp
   trunk/pingus/src/actions/blocker.hpp
   trunk/pingus/src/actions/boarder.cpp
   trunk/pingus/src/actions/boarder.hpp
   trunk/pingus/src/actions/bomber.cpp
   trunk/pingus/src/actions/bomber.hpp
   trunk/pingus/src/actions/bridger.cpp
   trunk/pingus/src/actions/bridger.hpp
   trunk/pingus/src/actions/climber.cpp
   trunk/pingus/src/actions/climber.hpp
   trunk/pingus/src/actions/digger.cpp
   trunk/pingus/src/actions/digger.hpp
   trunk/pingus/src/actions/drown.hpp
   trunk/pingus/src/actions/exiter.hpp
   trunk/pingus/src/actions/faller.cpp
   trunk/pingus/src/actions/faller.hpp
   trunk/pingus/src/actions/floater.cpp
   trunk/pingus/src/actions/floater.hpp
   trunk/pingus/src/actions/jumper.cpp
   trunk/pingus/src/actions/jumper.hpp
   trunk/pingus/src/actions/laser_kill.hpp
   trunk/pingus/src/actions/miner.cpp
   trunk/pingus/src/actions/miner.hpp
   trunk/pingus/src/actions/rocket_launcher.cpp
   trunk/pingus/src/actions/rocket_launcher.hpp
   trunk/pingus/src/actions/slider.cpp
   trunk/pingus/src/actions/slider.hpp
   trunk/pingus/src/actions/smashed.hpp
   trunk/pingus/src/actions/splashed.hpp
   trunk/pingus/src/actions/superman.hpp
   trunk/pingus/src/actions/waiter.cpp
   trunk/pingus/src/actions/waiter.hpp
   trunk/pingus/src/actions/walker.cpp
   trunk/pingus/src/actions/walker.hpp
   trunk/pingus/src/editor/action_properties.cpp
   trunk/pingus/src/pingu.cpp
   trunk/pingus/src/pingu.hpp
   trunk/pingus/src/pingu_action.cpp
   trunk/pingus/src/pingu_enums.cpp
   trunk/pingus/src/pingu_enums.hpp
   trunk/pingus/src/pingu_holder.cpp
   trunk/pingus/src/pingus_main.cpp
   trunk/pingus/src/server_event.cpp
   trunk/pingus/src/world.cpp
   trunk/pingus/src/worldobjs/exit.cpp
   trunk/pingus/src/worldobjs/fake_exit.cpp
   trunk/pingus/src/worldobjs/hammer.cpp
   trunk/pingus/src/worldobjs/laser_exit.cpp
   trunk/pingus/src/worldobjs/smasher.cpp
Log:
Removed PinguActionFactory, this closes a memory leak
Renamed action enums to uppercase


Modified: trunk/pingus/SConstruct
===================================================================
--- trunk/pingus/SConstruct     2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/SConstruct     2008-07-22 02:44:55 UTC (rev 3893)
@@ -163,7 +163,6 @@
 'src/pathname.cpp', 
 'src/pingu.cpp', 
 'src/pingu_action.cpp', 
-'src/pingu_action_factory.cpp', 
 'src/pingu_enums.cpp', 
 'src/pingu_holder.cpp', 
 'src/pingus_error.cpp', 

Modified: trunk/pingus/src/action_holder.cpp
===================================================================
--- trunk/pingus/src/action_holder.cpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/action_holder.cpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -16,7 +16,6 @@
 
 #include <iostream>
 #include "pingus_level.hpp"
-#include "pingu_action_factory.hpp"
 #include "action_holder.hpp"
 
 using namespace Actions;

Modified: trunk/pingus/src/action_holder.hpp
===================================================================
--- trunk/pingus/src/action_holder.hpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/action_holder.hpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -21,10 +21,9 @@
 #include <vector>
 #include "pingu_enums.hpp"
 
-
 class PingusLevel;
 class PinguAction;
-
+
 /**
  * The ActionHolder is the backend of the ButtonPanel. It is responsible for
  * creating new PinguActions and (if necessary) restricting the number of
@@ -76,8 +75,7 @@
   ActionHolder (const ActionHolder&);
   ActionHolder& operator= (const ActionHolder&);
 };
-
-
+
 #endif
 
 /* EOF */

Modified: trunk/pingus/src/actions/angel.hpp
===================================================================
--- trunk/pingus/src/actions/angel.hpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/angel.hpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -32,7 +32,7 @@
 public:
   Angel (Pingu* p);
 
-  ActionName get_type () const { return Actions::Angel; }
+  ActionName get_type () const { return Actions::ANGEL; }
 
   void  update ();
   void  draw (SceneContext& gc);

Modified: trunk/pingus/src/actions/basher.cpp
===================================================================
--- trunk/pingus/src/actions/basher.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/basher.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -69,7 +69,7 @@
       if (rel_getpixel(0, -1) == Groundtype::GP_WATER
          || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
        {
-         pingu->set_action(Actions::Drown);
+         pingu->set_action(Actions::DROWN);
        }
       // If walking on to something (i.e. hasn't fallen)
       else if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
@@ -82,7 +82,7 @@
              // Change direction and let walk code walk forward/up to get out.
               Sound::PingusSound::play_sound("chink");
              pingu->direction.change();
-             pingu->set_action(Actions::Walker);
+             pingu->set_action(Actions::WALKER);
            }
          else if (have_something_to_dig())
            {
@@ -94,7 +94,7 @@
          else if (sprite[pingu->direction].get_current_frame() 
                    / float(sprite[pingu->direction].get_frame_count()) > 0.6f) 
            { // FIXME: EVIL! Engine must not relay on graphic
-             pingu->set_action(Actions::Walker);
+             pingu->set_action(Actions::WALKER);
            }
        }
     }
@@ -124,7 +124,7 @@
   if (y_inc < -max_steps_down)
     {
       // The step down is too much.  So stop being a Basher and be a Faller.
-      pingu->set_action(Actions::Faller);
+      pingu->set_action(Actions::FALLER);
     }
   else
     {

Modified: trunk/pingus/src/actions/basher.hpp
===================================================================
--- trunk/pingus/src/actions/basher.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/basher.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -52,7 +52,7 @@
 public:
   Basher (Pingu* p);
 
-  ActionName get_type () const { return Actions::Basher; }
+  ActionName get_type () const { return Actions::BASHER; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/blocker.cpp
===================================================================
--- trunk/pingus/src/actions/blocker.cpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/blocker.cpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -46,7 +46,7 @@
 {
   if (!standing_on_ground())
     {
-      pingu->set_action(Actions::Faller);
+      pingu->set_action(Actions::FALLER);
     }
   else
     {

Modified: trunk/pingus/src/actions/blocker.hpp
===================================================================
--- trunk/pingus/src/actions/blocker.hpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/blocker.hpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -32,7 +32,7 @@
 
   int   y_offset ();
 
-  ActionName get_type() const { return Actions::Blocker; }
+  ActionName get_type() const { return Actions::BLOCKER; }
 
   void  draw (SceneContext& gc);
   void  update();

Modified: trunk/pingus/src/actions/boarder.cpp
===================================================================
--- trunk/pingus/src/actions/boarder.cpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/boarder.cpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -62,7 +62,7 @@
 
         pingu->apply_force (Vector3f(float(speed * pingu->direction * 0.5),
           -float(speed * abs(pingu->direction) * 0.5)));
-        pingu->set_action(Actions::Walker);
+        pingu->set_action(Actions::WALKER);
         return;
       }
     }
@@ -70,7 +70,7 @@
   else
   {
     pingu->apply_force (Vector3f((float)speed * pingu->direction, 0));
-    pingu->set_action(Actions::Walker);
+    pingu->set_action(Actions::WALKER);
   }
 }
 

Modified: trunk/pingus/src/actions/boarder.hpp
===================================================================
--- trunk/pingus/src/actions/boarder.hpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/boarder.hpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -33,7 +33,7 @@
 public:
   Boarder (Pingu* p);
 
-  ActionName get_type () const { return Actions::Boarder; }
+  ActionName get_type () const { return Actions::BOARDER; }
 
   void  draw (SceneContext& gc);
   void  update ();

Modified: trunk/pingus/src/actions/bomber.cpp
===================================================================
--- trunk/pingus/src/actions/bomber.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/bomber.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -77,7 +77,7 @@
   if (sprite[pingu->direction].get_current_frame() <= 9 && (rel_getpixel(0, 
-1) == Groundtype::GP_WATER
       || rel_getpixel(0, -1) == Groundtype::GP_LAVA))
     {
-      pingu->set_action(Actions::Drown);
+      pingu->set_action(Actions::DROWN);
       return;
     }
 
@@ -85,7 +85,7 @@
   if (sprite[pingu->direction].get_current_frame () <= 9 && rel_getpixel(0, 
-1) != Groundtype::GP_NOTHING
       && velocity.y > deadly_velocity)
     {
-      pingu->set_action(Actions::Splashed);
+      pingu->set_action(Actions::SPLASHED);
       return;
     }
 

Modified: trunk/pingus/src/actions/bomber.hpp
===================================================================
--- trunk/pingus/src/actions/bomber.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/bomber.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -40,7 +40,7 @@
 public:
   Bomber (Pingu* p);
 
-  ActionName get_type() const { return Actions::Bomber; }
+  ActionName get_type() const { return Actions::BOMBER; }
   ActionType get_activation_mode() const { return COUNTDOWN_TRIGGERED; }
 
   void draw (SceneContext& gc);

Modified: trunk/pingus/src/actions/bridger.cpp
===================================================================
--- trunk/pingus/src/actions/bridger.cpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/bridger.cpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -109,7 +109,7 @@
       else // We reached a wall...
        {
          pingu->direction.change ();
-         pingu->set_action (Actions::Walker);
+         pingu->set_action (Actions::WALKER);
          return;
        }
     }
@@ -135,13 +135,13 @@
          else
            {
              pingu->direction.change ();
-             pingu->set_action (Actions::Walker);
+             pingu->set_action (Actions::WALKER);
              return;
            }
        }
       else // Out of bricks
        {
-         pingu->set_action(Actions::Waiter);
+         pingu->set_action(Actions::WAITER);
           return;
        }
     }

Modified: trunk/pingus/src/actions/bridger.hpp
===================================================================
--- trunk/pingus/src/actions/bridger.hpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/bridger.hpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -46,7 +46,7 @@
   Bridger(Pingu*);
 
   std::string get_name () const;
-  ActionName get_type () const { return Actions::Bridger; }
+  ActionName get_type () const { return Actions::BRIDGER; }
 
   void   update ();
   void   update_build ();

Modified: trunk/pingus/src/actions/climber.cpp
===================================================================
--- trunk/pingus/src/actions/climber.cpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/climber.cpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -64,14 +64,14 @@
            }
 
          // Finish climbing.
-         pingu->set_action(Actions::Walker);
+         pingu->set_action(Actions::WALKER);
        }
     }
   else
     {
       //    std::cout << "Climber failed, falling down" << std::endl;
       pingu->direction.change();
-      pingu->set_action(Actions::Walker);
+      pingu->set_action(Actions::WALKER);
     }
 }
 
@@ -85,8 +85,8 @@
 Climber::change_allowed(ActionName new_action)
 {
   return
-    (new_action == Actions::Floater) ||
-    (new_action == Actions::Jumper);
+    (new_action == Actions::FLOATER) ||
+    (new_action == Actions::JUMPER);
 }
 
 } // namespace Actions

Modified: trunk/pingus/src/actions/climber.hpp
===================================================================
--- trunk/pingus/src/actions/climber.hpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/climber.hpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -32,7 +32,7 @@
 public:
   Climber (Pingu*);
 
-  ActionName get_type () const { return Actions::Climber; }
+  ActionName get_type () const { return Actions::CLIMBER; }
   ActionType get_activation_mode () const { return WALL_TRIGGERED; }
 
   void draw (SceneContext& gc);

Modified: trunk/pingus/src/actions/digger.cpp
===================================================================
--- trunk/pingus/src/actions/digger.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/digger.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -41,7 +41,7 @@
   if (rel_getpixel(0, -1) ==  Groundtype::GP_WATER
       || rel_getpixel(0, -1) ==  Groundtype::GP_LAVA)
     {
-      pingu->set_action(Actions::Drown);
+      pingu->set_action(Actions::DROWN);
       return;
     }
 
@@ -54,7 +54,7 @@
   if (!have_something_to_dig())
     {
       dig ();
-      pingu->set_action(Actions::Walker);
+      pingu->set_action(Actions::WALKER);
     }
 }
 

Modified: trunk/pingus/src/actions/digger.hpp
===================================================================
--- trunk/pingus/src/actions/digger.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/digger.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -31,7 +31,7 @@
 public:
   Digger(Pingu*);
 
-  ActionName get_type () const { return Actions::Digger; }
+  ActionName get_type () const { return Actions::DIGGER; }
 
   bool have_something_to_dig ();
   void dig ();

Modified: trunk/pingus/src/actions/drown.hpp
===================================================================
--- trunk/pingus/src/actions/drown.hpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/drown.hpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -30,7 +30,7 @@
 public:
   Drown (Pingu* p);
 
-  ActionName get_type () const { return Actions::Drown; }
+  ActionName get_type () const { return Actions::DROWN; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/exiter.hpp
===================================================================
--- trunk/pingus/src/actions/exiter.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/exiter.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -31,7 +31,7 @@
 public:
   Exiter(Pingu*);
   void init(void);
-  ActionName get_type() const { return Actions::Exiter; }
+  ActionName get_type() const { return Actions::EXITER; }
 
   void draw (SceneContext& gc);
   void update();

Modified: trunk/pingus/src/actions/faller.cpp
===================================================================
--- trunk/pingus/src/actions/faller.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/faller.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -102,19 +102,19 @@
           if (rel_getpixel(0, -1) == Groundtype::GP_WATER
               || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
             {
-              pingu->set_action(Actions::Drown);
+              pingu->set_action(Actions::DROWN);
             }
           // Did we stop too fast?
           else if (Math::abs(pingu->get_velocity().y) > deadly_velocity)
             {
               //std::cout << "Pingus splashed: " << pingu->get_velocity().y << 
" " << deadly_velocity << std::endl;
-              pingu->set_action(Actions::Splashed);
+              pingu->set_action(Actions::SPLASHED);
             }
           else
             {
               // This is where the jumper bug happens
               //std::cout << "Reached the unreachable: " << 
pingu->get_velocity().y << std::endl;
-              pingu->set_action(Actions::Walker);
+              pingu->set_action(Actions::WALKER);
             }
         }
       // If the Pingu collided into something while moving up...
@@ -150,7 +150,7 @@
 bool
 Faller::change_allowed (ActionName new_action)
 {
-  return new_action == Actions::Floater || new_action == Actions::Climber;
+  return new_action == Actions::FLOATER || new_action == Actions::CLIMBER;
 }
 
 } // namespace Actions

Modified: trunk/pingus/src/actions/faller.hpp
===================================================================
--- trunk/pingus/src/actions/faller.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/faller.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -39,7 +39,7 @@
 
   bool change_allowed (Actions::ActionName new_action);
 
-  ActionName get_type() const { return Actions::Faller; }
+  ActionName get_type() const { return Actions::FALLER; }
   bool is_tumbling () const;
 
 private:

Modified: trunk/pingus/src/actions/floater.cpp
===================================================================
--- trunk/pingus/src/actions/floater.cpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/floater.cpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -47,7 +47,7 @@
     }
   else
     {
-      pingu->set_action (Actions::Walker);
+      pingu->set_action (Actions::WALKER);
     }
 }
 

Modified: trunk/pingus/src/actions/floater.hpp
===================================================================
--- trunk/pingus/src/actions/floater.hpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/floater.hpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -32,7 +32,7 @@
 public:
   Floater(Pingu* p);
 
-  ActionName get_type() const { return Actions::Floater; }
+  ActionName get_type() const { return Actions::FLOATER; }
   ActionType get_activation_mode() const { return FALL_TRIGGERED; }
 
   void init(void);

Modified: trunk/pingus/src/actions/jumper.cpp
===================================================================
--- trunk/pingus/src/actions/jumper.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/jumper.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -40,7 +40,7 @@
 Jumper::update ()
 {
   // if climber, do a wall-jump, else just jump forward
-  if ((pingu->get_previous_action() == Actions::Climber))
+  if ((pingu->get_previous_action() == Actions::CLIMBER))
     pingu->direction.change();
   
   if (pingu->direction.is_left())
@@ -55,7 +55,7 @@
   // Move the pingu in the air, so that it can start 'falling'
   pingu->set_y(pingu->get_y() - 1);
 
-  pingu->set_action (Actions::Faller);
+  pingu->set_action (Actions::FALLER);
 }
 
 } // namespace Actions

Modified: trunk/pingus/src/actions/jumper.hpp
===================================================================
--- trunk/pingus/src/actions/jumper.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/jumper.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -29,7 +29,7 @@
 public:
   Jumper(Pingu*);
 
-  ActionName get_type() const { return Actions::Jumper; }
+  ActionName get_type() const { return Actions::JUMPER; }
 
   void  draw (SceneContext& gc);
   void  update();

Modified: trunk/pingus/src/actions/laser_kill.hpp
===================================================================
--- trunk/pingus/src/actions/laser_kill.hpp     2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/laser_kill.hpp     2008-07-22 02:44:55 UTC (rev 
3893)
@@ -32,7 +32,7 @@
 public:
   LaserKill (Pingu*);
 
-  ActionName get_type () const { return Actions::Laserkill; }
+  ActionName get_type () const { return Actions::LASERKILL; }
   void init (void);
 
   void draw (SceneContext& gc);

Modified: trunk/pingus/src/actions/miner.cpp
===================================================================
--- trunk/pingus/src/actions/miner.cpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/miner.cpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -59,7 +59,7 @@
       WorldObj::get_world()->remove(miner_radius,
                                     static_cast<int>(pingu->get_x() - 
(miner_radius.get_width() / 2) + pingu->direction),
                                     static_cast<int>(pingu->get_y() - 
miner_radius.get_width() + 3) );
-      pingu->set_action(Actions::Walker);
+      pingu->set_action(Actions::WALKER);
     }
   else if (rel_getpixel(0, -1) == Groundtype::GP_SOLID
        || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
@@ -70,7 +70,7 @@
       WorldObj::get_world()->remove(miner_radius,
                                     static_cast<int>(pingu->get_x() - 
(miner_radius.get_width() / 2) + pingu->direction),
                                     static_cast<int>(pingu->get_y() - 
miner_radius.get_width() + 1) );
-      pingu->set_action(Actions::Walker);
+      pingu->set_action(Actions::WALKER);
 
       // Stop Pingu walking further into the solid.
       pingu->direction.change();

Modified: trunk/pingus/src/actions/miner.hpp
===================================================================
--- trunk/pingus/src/actions/miner.hpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/miner.hpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -33,7 +33,7 @@
   Miner (Pingu* p);
   virtual ~Miner () {}
 
-  ActionName get_type () const { return Actions::Miner; }
+  ActionName get_type () const { return Actions::MINER; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/rocket_launcher.cpp
===================================================================
--- trunk/pingus/src/actions/rocket_launcher.cpp        2008-07-21 23:38:17 UTC 
(rev 3892)
+++ trunk/pingus/src/actions/rocket_launcher.cpp        2008-07-22 02:44:55 UTC 
(rev 3893)
@@ -47,7 +47,7 @@
 {
   if (sprite[pingu->direction].is_finished())
     {
-      pingu->set_action(Actions::Walker);
+      pingu->set_action(Actions::WALKER);
     }
 
   sprite.update();

Modified: trunk/pingus/src/actions/rocket_launcher.hpp
===================================================================
--- trunk/pingus/src/actions/rocket_launcher.hpp        2008-07-21 23:38:17 UTC 
(rev 3892)
+++ trunk/pingus/src/actions/rocket_launcher.hpp        2008-07-22 02:44:55 UTC 
(rev 3893)
@@ -31,7 +31,7 @@
   RocketLauncher(Pingu*);
   ~RocketLauncher() {}
 
-  ActionName get_type () const { return Actions::Rocketlauncher; }
+  ActionName get_type () const { return Actions::ROCKETLAUNCHER; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/slider.cpp
===================================================================
--- trunk/pingus/src/actions/slider.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/slider.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -53,7 +53,7 @@
               pingu->set_velocity(pingu->get_velocity() + Vector3f(-speed, 
0.0));
             }
 
-          pingu->set_action(Actions::Walker);
+          pingu->set_action(Actions::WALKER);
           return;
         }
     }
@@ -61,7 +61,7 @@
   speed -= 7 * 0.025f;
   if (speed < 1)
     {
-      pingu->set_action(Actions::Walker);
+      pingu->set_action(Actions::WALKER);
       return;
     }
 }

Modified: trunk/pingus/src/actions/slider.hpp
===================================================================
--- trunk/pingus/src/actions/slider.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/slider.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -30,7 +30,7 @@
 public:
   Slider (Pingu* p);
 
-  ActionName get_type() const { return Actions::Slider; }
+  ActionName get_type() const { return Actions::SLIDER; }
 
   void draw (SceneContext& gc);
   void update();

Modified: trunk/pingus/src/actions/smashed.hpp
===================================================================
--- trunk/pingus/src/actions/smashed.hpp        2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/smashed.hpp        2008-07-22 02:44:55 UTC (rev 
3893)
@@ -32,7 +32,7 @@
 public:
   Smashed (Pingu*);
 
-  ActionName get_type () const { return Actions::Smashed; }
+  ActionName get_type () const { return Actions::SMASHED; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/splashed.hpp
===================================================================
--- trunk/pingus/src/actions/splashed.hpp       2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/splashed.hpp       2008-07-22 02:44:55 UTC (rev 
3893)
@@ -30,7 +30,7 @@
 public:
   Splashed (Pingu*);
 
-  ActionName get_type () const { return Actions::Splashed; }
+  ActionName get_type () const { return Actions::SPLASHED; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/superman.hpp
===================================================================
--- trunk/pingus/src/actions/superman.hpp       2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/actions/superman.hpp       2008-07-22 02:44:55 UTC (rev 
3893)
@@ -32,7 +32,7 @@
 public:
   Superman (Pingu*);
 
-  ActionName get_type () const { return Actions::Superman; }
+  ActionName get_type () const { return Actions::SUPERMAN; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/waiter.cpp
===================================================================
--- trunk/pingus/src/actions/waiter.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/waiter.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -34,7 +34,7 @@
   sprite.update();
 
   if (countdown < 0)
-    pingu->set_action(Actions::Walker);
+    pingu->set_action(Actions::WALKER);
 
   countdown -= 0.025f;
 }

Modified: trunk/pingus/src/actions/waiter.hpp
===================================================================
--- trunk/pingus/src/actions/waiter.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/waiter.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -34,7 +34,7 @@
 public:
   Waiter (Pingu*);
 
-  ActionName get_type () const { return Actions::Waiter; }
+  ActionName get_type () const { return Actions::WAITER; }
 
   void draw (SceneContext& gc);
   void update ();

Modified: trunk/pingus/src/actions/walker.cpp
===================================================================
--- trunk/pingus/src/actions/walker.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/walker.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -68,7 +68,7 @@
 
   if (rel_getpixel(0, -1) ==  Groundtype::GP_WATER)
     {
-      pingu->set_action(Actions::Drown);
+      pingu->set_action(Actions::DROWN);
       return;
     }
 
@@ -95,7 +95,7 @@
        }
       else
        {
-         pingu->set_action(Actions::Faller);
+         pingu->set_action(Actions::FALLER);
          return;
        }
     }
@@ -165,7 +165,7 @@
              // We take the step, so that we are in the air
              pingu->set_x(pingu->get_x() + pingu->direction);
              // We reached a cliff
-             pingu->set_action(Actions::Faller);
+             pingu->set_action(Actions::FALLER);
              return;
            }
        }
@@ -208,7 +208,7 @@
 {
   gc.color().draw(walker[pingu->direction], pingu->get_pos());
 
-  if (pingu->get_fall_action() && pingu->get_fall_action()->get_type() == 
Actions::Floater)
+  if (pingu->get_fall_action() && pingu->get_fall_action()->get_type() == 
Actions::FLOATER)
     {
       gc.color().draw(floaterlayer[pingu->direction], pingu->get_pos());
     }

Modified: trunk/pingus/src/actions/walker.hpp
===================================================================
--- trunk/pingus/src/actions/walker.hpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/actions/walker.hpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -36,7 +36,7 @@
   void draw (SceneContext& gc);
   void update ();
 
-  ActionName get_type () const { return Actions::Walker; }
+  ActionName get_type () const { return Actions::WALKER; }
 
 private:
   Walker (const Walker&);

Modified: trunk/pingus/src/editor/action_properties.cpp
===================================================================
--- trunk/pingus/src/editor/action_properties.cpp       2008-07-21 23:38:17 UTC 
(rev 3892)
+++ trunk/pingus/src/editor/action_properties.cpp       2008-07-22 02:44:55 UTC 
(rev 3893)
@@ -36,16 +36,16 @@
   : GroupComponent(rect),
     y_pos(0)
 {
-  add_action(Actions::Basher);
-  add_action(Actions::Blocker);
-  add_action(Actions::Bomber);
-  add_action(Actions::Bridger);
-  add_action(Actions::Climber);
-  add_action(Actions::Digger);
-  add_action(Actions::Floater);
-  add_action(Actions::Jumper);
-  add_action(Actions::Miner);
-  add_action(Actions::Slider);
+  add_action(Actions::BASHER);
+  add_action(Actions::BLOCKER);
+  add_action(Actions::BOMBER);
+  add_action(Actions::BRIDGER);
+  add_action(Actions::CLIMBER);
+  add_action(Actions::DIGGER);
+  add_action(Actions::FLOATER);
+  add_action(Actions::JUMPER);
+  add_action(Actions::MINER);
+  add_action(Actions::SLIDER);
 }
 
 ActionProperties::~ActionProperties()

Modified: trunk/pingus/src/pingu.cpp
===================================================================
--- trunk/pingus/src/pingu.cpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingu.cpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -23,24 +23,42 @@
 #include "sound/sound.hpp"
 #include "collision_map.hpp"
 #include "pingu_action.hpp"
-#include "pingu_action_factory.hpp"
 #include "gettext.h"
 #include "debug.hpp"
 #include "display/scene_context.hpp"
 #include "worldobj.hpp"
 #include "resource.hpp"
 #include "fonts.hpp"
+#include "pingu.hpp"
 
+#include "actions/rocket_launcher.hpp"
+#include "actions/boarder.hpp"
+#include "actions/superman.hpp"
+#include "actions/angel.hpp"
+#include "actions/basher.hpp"
+#include "actions/blocker.hpp"
+#include "actions/bomber.hpp"
+#include "actions/bridger.hpp"
+#include "actions/climber.hpp"
+#include "actions/digger.hpp"
+#include "actions/floater.hpp"
+#include "actions/miner.hpp"
+#include "actions/jumper.hpp"
+#include "actions/slider.hpp"
+#include "actions/exiter.hpp"
+#include "actions/smashed.hpp"
+#include "actions/laser_kill.hpp"
+#include "actions/splashed.hpp"
+#include "actions/waiter.hpp"
+#include "actions/drown.hpp"
+#include "actions/faller.hpp"
+#include "actions/walker.hpp"
 
 using namespace Actions;
-
+
 // Init a pingu at the given position while falling
 Pingu::Pingu (int arg_id, const Vector3f& arg_pos, int owner)
-  : action(0),
-    countdown_action (0),
-    wall_action(0),
-    fall_action(0),
-    previous_action(Actions::Faller),
+  : previous_action(FALLER),
     id(arg_id),
     action_time(-1),
     owner_id(owner),
@@ -53,7 +71,7 @@
 
   // Initialisize the action, after this step the action ptr will
   // always be valid in the pingu class
-  action = PinguActionFactory::instance()->create(this, Faller);
+  action = create_action(FALLER);
 }
 
 Pingu::~Pingu ()
@@ -112,7 +130,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(boost::shared_ptr<PinguAction> act)
 {
   bool ret_val = false;
   assert(act);
@@ -215,18 +233,18 @@
 bool
 Pingu::request_set_action (ActionName action_name)
 {
-  return request_set_action (PinguActionFactory::instance ()->create (this, 
action_name));
+  return request_set_action(create_action(action_name));
 }
 
 void
 Pingu::set_action (ActionName action_name)
 {
-  set_action(PinguActionFactory::instance()->create(this, action_name));
+  set_action(create_action(action_name));
 }
 
 // Sets an action without any checking
 void
-Pingu::set_action (PinguAction* act)
+Pingu::set_action(boost::shared_ptr<PinguAction> act)
 {
   assert(act);
 
@@ -326,7 +344,7 @@
     {
       set_action(countdown_action);
       // Reset the countdown action handlers
-      countdown_action = 0;
+      countdown_action = boost::shared_ptr<PinguAction>();
       action_time = -1;
       return;
     }
@@ -393,7 +411,7 @@
   return action->get_name();
 }
 
-Actions::ActionName
+ActionName
 Pingu::get_action ()
 {
   return action->get_type();
@@ -440,5 +458,35 @@
   return action->catchable ();
 }
 
-
+boost::shared_ptr<PinguAction>
+Pingu::create_action(ActionName action)
+{
+  switch(action)
+    {
+      case ANGEL:     return boost::shared_ptr<PinguAction>(new Angel(this));
+      case BASHER:    return boost::shared_ptr<PinguAction>(new Basher(this));
+      case BLOCKER:   return boost::shared_ptr<PinguAction>(new Blocker(this));
+      case BOARDER:   return boost::shared_ptr<PinguAction>(new Boarder(this));
+      case BOMBER:    return boost::shared_ptr<PinguAction>(new Bomber(this));
+      case BRIDGER:   return boost::shared_ptr<PinguAction>(new Bridger(this));
+      case CLIMBER:   return boost::shared_ptr<PinguAction>(new Climber(this));
+      case DIGGER:    return boost::shared_ptr<PinguAction>(new Digger(this));
+      case DROWN:     return boost::shared_ptr<PinguAction>(new Drown(this));
+      case EXITER:    return boost::shared_ptr<PinguAction>(new Exiter(this));
+      case FALLER:    return boost::shared_ptr<PinguAction>(new Faller(this));
+      case FLOATER:   return boost::shared_ptr<PinguAction>(new Floater(this));
+      case JUMPER:    return boost::shared_ptr<PinguAction>(new Jumper(this));
+      case LASERKILL: return boost::shared_ptr<PinguAction>(new 
LaserKill(this));
+      case MINER:     return boost::shared_ptr<PinguAction>(new Miner(this));
+      case ROCKETLAUNCHER: return boost::shared_ptr<PinguAction>(new 
RocketLauncher(this));
+      case SLIDER:    return boost::shared_ptr<PinguAction>(new Slider(this));
+      case SMASHED:   return boost::shared_ptr<PinguAction>(new Smashed(this));
+      case SPLASHED:  return boost::shared_ptr<PinguAction>(new 
Splashed(this));
+      case SUPERMAN:  return boost::shared_ptr<PinguAction>(new 
Superman(this));
+      case WAITER:    return boost::shared_ptr<PinguAction>(new Waiter(this));
+      case WALKER:    return boost::shared_ptr<PinguAction>(new Walker(this));
+      default: assert(!"Invalid action name provied");
+    }
+}
+
 /* EOF */

Modified: trunk/pingus/src/pingu.hpp
===================================================================
--- trunk/pingus/src/pingu.hpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingu.hpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -17,6 +17,7 @@
 #ifndef HEADER_PINGUS_PINGU_HPP
 #define HEADER_PINGUS_PINGU_HPP
 
+#include <boost/shared_ptr.hpp>
 #include "math/vector3f.hpp"
 #include "direction.hpp"
 #include "pingu_enums.hpp"
@@ -24,7 +25,7 @@
 class ActionHolder;
 class PinguAction;
 class SceneContext;
-
+
 /** The class for managing one of the many penguins which are walking
     around in the World. All actions are handled by PinguAction
     objects. */
@@ -32,17 +33,17 @@
 {
 private:
   /** The primary action with is currently in use */
-  PinguAction* action;
+  boost::shared_ptr<PinguAction> action;
 
   /** A secondary action which will turn active after a given amount of time
       The only example is currently the bomber. */
-  PinguAction* countdown_action;
+  boost::shared_ptr<PinguAction> countdown_action;
 
   /** the action that gets triggered when the pingu hits a wall */
-  PinguAction* wall_action;
+  boost::shared_ptr<PinguAction> wall_action;
 
   /** the action that gets triggered when the pingu falls */
-  PinguAction* fall_action;
+  boost::shared_ptr<PinguAction> fall_action;
 
   /** The previous_action contains the action type that was in action
       before action got applied, its here to enable action to behave
@@ -64,9 +65,11 @@
 
   Vector3f velocity;
 
-  bool request_set_action (PinguAction*);
-  void set_action (PinguAction*);
+  bool request_set_action(boost::shared_ptr<PinguAction>);
+  void set_action(boost::shared_ptr<PinguAction>);
 
+  boost::shared_ptr<PinguAction> create_action(Actions::ActionName action);
+
 public:
 
   //FIXME make me private
@@ -151,9 +154,9 @@
   /// 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.get(); }
 
-  PinguAction* get_fall_action () { return fall_action; }
+  PinguAction* get_fall_action () { return fall_action.get(); }
 
   /** Returns the `color' of the colmap in the walking direction
       Examples:
@@ -213,8 +216,7 @@
   Pingu (const Pingu&);
   Pingu& operator= (const Pingu&);
 };
+
+#endif
 
-
-#endif /* PINGU_HH */
-
 /* EOF */

Modified: trunk/pingus/src/pingu_action.cpp
===================================================================
--- trunk/pingus/src/pingu_action.cpp   2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingu_action.cpp   2008-07-22 02:44:55 UTC (rev 3893)
@@ -237,7 +237,7 @@
                   // FIXME: quick&dirty way to kill falling pingus
                   if (resultant_force.y >= deadly_velocity)
                     {
-                      pingu->set_action(Actions::Splashed);
+                      pingu->set_action(Actions::SPLASHED);
                       return;
                     }
                  // Make it so that the Pingu won't go down any further.

Deleted: trunk/pingus/src/pingu_action_factory.cpp
===================================================================
--- trunk/pingus/src/pingu_action_factory.cpp   2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/pingu_action_factory.cpp   2008-07-22 02:44:55 UTC (rev 
3893)
@@ -1,194 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//  
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//  
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <iostream>
-#include <assert.h>
-#include "pingus_error.hpp"
-
-#include "actions/rocket_launcher.hpp"
-#include "actions/boarder.hpp"
-#include "actions/superman.hpp"
-#include "actions/angel.hpp"
-#include "actions/basher.hpp"
-#include "actions/blocker.hpp"
-#include "actions/bomber.hpp"
-#include "actions/bridger.hpp"
-#include "actions/climber.hpp"
-#include "actions/digger.hpp"
-#include "actions/floater.hpp"
-#include "actions/miner.hpp"
-#include "actions/jumper.hpp"
-#include "actions/slider.hpp"
-#include "actions/exiter.hpp"
-#include "actions/smashed.hpp"
-#include "actions/laser_kill.hpp"
-#include "actions/splashed.hpp"
-#include "actions/waiter.hpp"
-#include "actions/drown.hpp"
-#include "actions/faller.hpp"
-#include "actions/walker.hpp"
-
-#include "pingu_action_factory.hpp"
-
-
-using namespace Actions;
-
-PinguActionFactory* PinguActionFactory::instance_ = 0;
-
-class PinguActionAbstractFactory
-{
-public:
-  PinguActionAbstractFactory (Actions::ActionName id) {
-    PinguActionFactory::instance ()-> register_factory (id, this);
-  }
-  virtual ~PinguActionAbstractFactory() {}
-
-  virtual PinguAction* create (Pingu* p) =0;
-
-private:
-  PinguActionAbstractFactory (const PinguActionAbstractFactory&);
-  PinguActionAbstractFactory& operator= (const PinguActionAbstractFactory&);
-};
-
-template<class T>
-class PinguActionFactoryImpl : public PinguActionAbstractFactory
-{
-public:
-  PinguActionFactoryImpl (Actions::ActionName id)
-    : PinguActionAbstractFactory (id)
-  {
-  }
-
-  PinguAction* create (Pingu* p) {
-    return new T (p);
-  }
-
-private:
-  PinguActionFactoryImpl (const PinguActionFactoryImpl&);
-  PinguActionFactoryImpl& operator= (const PinguActionFactoryImpl&);
-};
-
-PinguActionFactory::PinguActionFactory ()
-{
-}
-
-PinguActionFactory::~PinguActionFactory ()
-{
-  delete_actions ();
-
-  // Delete the action factories
-  for (std::map<Actions::ActionName, PinguActionAbstractFactory*>::iterator i 
= factories.begin();
-       i != factories.end();
-       ++i)
-    {
-      delete i->second;
-    }
-  factories.clear();
-}
-
-PinguActionFactory*
-PinguActionFactory::instance ()
-{
-  if ( ! instance_)
-    {
-      instance_ = new PinguActionFactory ();
-      instance_->register_core_actions ();
-    }
-  return instance_;
-}
-
-void
-PinguActionFactory::init()
-{
-  instance_ = 0;
-}
-
-void
-PinguActionFactory::deinit()
-{
-  delete instance_;
-       instance_ = 0;
-}
-
-void
-PinguActionFactory::register_core_actions ()
-{
-  new PinguActionFactoryImpl<class Angel>          (Angel);
-  new PinguActionFactoryImpl<class Basher>         (Basher);
-  new PinguActionFactoryImpl<class Blocker>        (Blocker);
-  new PinguActionFactoryImpl<class Boarder>        (Boarder);
-  new PinguActionFactoryImpl<class Bomber>         (Bomber);
-  new PinguActionFactoryImpl<class Bridger>        (Bridger);
-  new PinguActionFactoryImpl<class Climber>        (Climber);
-  new PinguActionFactoryImpl<class Digger>         (Digger);
-  new PinguActionFactoryImpl<class Drown>          (Drown);
-  new PinguActionFactoryImpl<class Exiter>         (Exiter);
-  new PinguActionFactoryImpl<class Faller>         (Faller);
-  new PinguActionFactoryImpl<class Floater>        (Floater);
-  new PinguActionFactoryImpl<class Jumper>         (Jumper);
-  new PinguActionFactoryImpl<class LaserKill>      (Laserkill);
-  new PinguActionFactoryImpl<class Miner>          (Miner);
-  new PinguActionFactoryImpl<class RocketLauncher> (Rocketlauncher);
-  new PinguActionFactoryImpl<class Slider>         (Slider);
-  new PinguActionFactoryImpl<class Smashed>        (Smashed);
-  new PinguActionFactoryImpl<class Splashed>       (Splashed);
-  new PinguActionFactoryImpl<class Superman>       (Superman);
-  new PinguActionFactoryImpl<class Waiter>         (Waiter);
-  new PinguActionFactoryImpl<class Walker>         (Walker);
-}
-
-PinguAction*
-PinguActionFactory::create (Pingu* pingu, ActionName id)
-{
-  //std::cout << "PinguActionFactory: number of actions: " << 
all_actions.size() << std::endl;
-  std::map<ActionName, PinguActionAbstractFactory*>::iterator it = 
factories.find(id);
-
-  if (it == factories.end())
-    PingusError::raise("PinguActionFactory: Invalid id: " + id);
-  else
-    {
-      PinguAction* action = it->second->create (pingu);
-      all_actions.push_back (action);
-      return action;
-    }
-
-  assert(!"PinguActionFactory::create: Unknown ActionName supplied");
-  return 0;
-}
-
-void
-PinguActionFactory::delete_actions ()
-{
-  //std::cout << "PinguActionFactory::delete_actions (): Deleting all Actions: 
"
-  //<< all_actions.size() << std::endl;
-  for (std::vector<PinguAction*>::iterator i = all_actions.begin ();
-       i != all_actions.end (); ++i)
-    {
-      delete *i;
-    }
-  all_actions.clear ();
-  //std::cout << "PinguActionFactory::delete_actions (): Deleting all Actions: 
done" << std::endl;
-}
-
-void
-PinguActionFactory::register_factory (ActionName id, 
PinguActionAbstractFactory* factory)
-{
-  // FIXME: Could need some more error checking
-  factories[id] = factory;
-}
-
-
-/* EOF */

Deleted: trunk/pingus/src/pingu_action_factory.hpp
===================================================================
--- trunk/pingus/src/pingu_action_factory.hpp   2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/pingu_action_factory.hpp   2008-07-22 02:44:55 UTC (rev 
3893)
@@ -1,65 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//  
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//  
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGU_ACTION_FACTORY_HPP
-#define HEADER_PINGUS_PINGU_ACTION_FACTORY_HPP
-
-#include <map>
-#include <vector>
-#include "pingu.hpp"
-
-
-class PinguAction;
-class PinguActionAbstractFactory;
-
-class PinguActionFactory
-{
-private:
-  /** This vector saves all allocated actions to delete them at a later point 
*/
-  std::vector<PinguAction*> all_actions;
-
-  std::map<Actions::ActionName, PinguActionAbstractFactory*> factories;
-  static PinguActionFactory* instance_;
-
-  PinguActionFactory ();
-  ~PinguActionFactory ();
-  void register_core_actions ();
-
-public:
-  static PinguActionFactory* instance ();
-  static void init();
-  static void deinit();
-
-  /** \a f will get deleted in destructor! */
-  void register_factory (Actions::ActionName id, PinguActionAbstractFactory* 
f);
-
-  /** Delete all actions which this class has allocated. This needs to
-      be called seperatly from the constructor, due to the used
-      singleton pattern. [FIXME: if not called memory leak will result] */
-  void delete_actions ();
-
-  /** Allocate the given action */
-  PinguAction* create (Pingu* p, Actions::ActionName id);
-
-private:
-  PinguActionFactory (const PinguActionFactory&);
-  PinguActionFactory& operator= (const PinguActionFactory&);
-};
-
-
-#endif
-
-/* EOF */

Modified: trunk/pingus/src/pingu_enums.cpp
===================================================================
--- trunk/pingus/src/pingu_enums.cpp    2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingu_enums.cpp    2008-07-22 02:44:55 UTC (rev 3893)
@@ -28,29 +28,29 @@
 {
   switch (action)
     {
-    case Angel          : return _("Angel");
-    case Basher         : return _("Basher");
-    case Blocker        : return _("Blocker");
-    case Boarder        : return _("Boarder");
-    case Bomber         : return _("Bomber");
-    case Bridger        : return _("Bridger");
-    case Climber        : return _("Climber");
-    case Digger         : return _("Digger");
-    case Drown          : return _("Drown");
-    case Exiter         : return _("Exiter");
-    case Faller         : return _("Faller");
-    case Floater        : return _("Floater");
-    case Jumper         : return _("Jumper");
-    case Laserkill      : return _("Laserkill");
-    case Miner          : return _("Miner");
-    case Rocketlauncher : return _("Rocketlauncher");
-    case Slider         : return _("Slider");
-    case Smashed        : return _("Smashed");
-    case Splashed       : return _("Splashed");
-    case Superman       : return _("Superman");
-    case Teleported     : return _("Teleported");
-    case Waiter         : return _("Waiter");
-    case Walker         : return _("Walker");
+    case ANGEL          : return _("Angel");
+    case BASHER         : return _("Basher");
+    case BLOCKER        : return _("Blocker");
+    case BOARDER        : return _("Boarder");
+    case BOMBER         : return _("Bomber");
+    case BRIDGER        : return _("Bridger");
+    case CLIMBER        : return _("Climber");
+    case DIGGER         : return _("Digger");
+    case DROWN          : return _("Drown");
+    case EXITER         : return _("Exiter");
+    case FALLER         : return _("Faller");
+    case FLOATER        : return _("Floater");
+    case JUMPER         : return _("Jumper");
+    case LASERKILL      : return _("Laserkill");
+    case MINER          : return _("Miner");
+    case ROCKETLAUNCHER : return _("Rocketlauncher");
+    case SLIDER         : return _("Slider");
+    case SMASHED        : return _("Smashed");
+    case SPLASHED       : return _("Splashed");
+    case SUPERMAN       : return _("Superman");
+    case TELEPORTED     : return _("Teleported");
+    case WAITER         : return _("Waiter");
+    case WALKER         : return _("Walker");
     default             : return "Unknown ActionName";
     }
 }
@@ -59,60 +59,60 @@
 {
   switch (action)
     {
-    case Angel          : return "angel";
-    case Basher         : return "basher";
-    case Blocker        : return "blocker";
-    case Boarder        : return "boarder";
-    case Bomber         : return "bomber";
-    case Bridger        : return "bridger";
-    case Climber        : return "climber";
-    case Digger         : return "digger";
-    case Drown          : return "drown";
-    case Exiter         : return "exiter";
-    case Faller         : return "faller";
-    case Floater        : return "floater";
-    case Jumper         : return "jumper";
-    case Laserkill      : return "laserkill";
-    case Miner          : return "miner";
-    case Rocketlauncher : return "rocketlauncher";
-    case Slider         : return "slider";
-    case Smashed        : return "smashed";
-    case Splashed       : return "splashed";
-    case Superman       : return "superman";
-    case Teleported     : return "teleported";
-    case Waiter         : return "waiter";
-    case Walker         : return "walker";
+    case ANGEL          : return "angel";
+    case BASHER         : return "basher";
+    case BLOCKER        : return "blocker";
+    case BOARDER        : return "boarder";
+    case BOMBER         : return "bomber";
+    case BRIDGER        : return "bridger";
+    case CLIMBER        : return "climber";
+    case DIGGER         : return "digger";
+    case DROWN          : return "drown";
+    case EXITER         : return "exiter";
+    case FALLER         : return "faller";
+    case FLOATER        : return "floater";
+    case JUMPER         : return "jumper";
+    case LASERKILL      : return "laserkill";
+    case MINER          : return "miner";
+    case ROCKETLAUNCHER : return "rocketlauncher";
+    case SLIDER         : return "slider";
+    case SMASHED        : return "smashed";
+    case SPLASHED       : return "splashed";
+    case SUPERMAN       : return "superman";
+    case TELEPORTED     : return "teleported";
+    case WAITER         : return "waiter";
+    case WALKER         : return "walker";
     default             : return "Unknown ActionName";
     }
 }
 
 ActionName action_from_string(const std::string& action)
 {
-  if (action == "angel")          return Angel;
-  if (action == "basher")         return Basher;
-  if (action == "blocker")        return Blocker;
-  if (action == "boarder")        return Boarder;
-  if (action == "bomber")         return Bomber;
-  if (action == "bridger")        return Bridger;
-  if (action == "climber")        return Climber;
-  if (action == "digger")         return Digger;
-  if (action == "drown")          return Drown;
-  if (action == "exiter")         return Exiter;
-  if (action == "faller")         return Faller;
-  if (action == "floater")        return Floater;
-  if (action == "jumper")         return Jumper;
-  if (action == "laserkill")      return Laserkill;
-  if (action == "miner")          return Miner;
-  if (action == "rocketlauncher") return Rocketlauncher;
-  if (action == "slider")         return Slider;
-  if (action == "smashed")        return Smashed;
-  if (action == "splashed")       return Splashed;
-  if (action == "superman")       return Superman;
-  if (action == "teleported")     return Teleported;
-  if (action == "waiter")         return Waiter;
-  if (action == "walker")         return Walker;
+  if (action == "angel")          return ANGEL;
+  if (action == "basher")         return BASHER;
+  if (action == "blocker")        return BLOCKER;
+  if (action == "boarder")        return BOARDER;
+  if (action == "bomber")         return BOMBER;
+  if (action == "bridger")        return BRIDGER;
+  if (action == "climber")        return CLIMBER;
+  if (action == "digger")         return DIGGER;
+  if (action == "drown")          return DROWN;
+  if (action == "exiter")         return EXITER;
+  if (action == "faller")         return FALLER;
+  if (action == "floater")        return FLOATER;
+  if (action == "jumper")         return JUMPER;
+  if (action == "laserkill")      return LASERKILL;
+  if (action == "miner")          return MINER;
+  if (action == "rocketlauncher") return ROCKETLAUNCHER;
+  if (action == "slider")         return SLIDER;
+  if (action == "smashed")        return SMASHED;
+  if (action == "splashed")       return SPLASHED;
+  if (action == "superman")       return SUPERMAN;
+  if (action == "teleported")     return TELEPORTED;
+  if (action == "waiter")         return WAITER;
+  if (action == "walker")         return WALKER;
 
-  return Walker;
+  return WALKER;
 }
 
 } // namespace Actions

Modified: trunk/pingus/src/pingu_enums.hpp
===================================================================
--- trunk/pingus/src/pingu_enums.hpp    2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingu_enums.hpp    2008-07-22 02:44:55 UTC (rev 3893)
@@ -34,45 +34,45 @@
 /** The order of the actions here are the same as the order of actions
     in the buttonpanel, so if the order in the buttonpanel is not what
     it should be it needs to be changed here. */
-enum ActionName
-  { Angel,
-    Basher,
-    Blocker,
-    Boarder,
-    Bomber,
-    Bridger,
-    Climber,
-    Digger,
-    Drown,
-    Exiter,
-    Faller,
-    Floater,
-    Jumper,
-    Laserkill,
-    Miner,
-    Rocketlauncher,
-    Slider,
-    Smashed,
-    Splashed,
-    Superman,
-    Teleported,
-    Waiter,
-    Walker
-  };
+enum ActionName { 
+  ANGEL,
+  BASHER,
+  BLOCKER,
+  BOARDER,
+  BOMBER,
+  BRIDGER,
+  CLIMBER,
+  DIGGER,
+  DROWN,
+  EXITER,
+  FALLER,
+  FLOATER,
+  JUMPER,
+  LASERKILL,
+  MINER,
+  ROCKETLAUNCHER,
+  SLIDER,
+  SMASHED,
+  SPLASHED,
+  SUPERMAN,
+  TELEPORTED,
+  WAITER,
+  WALKER
+};
 
 /** Converts a action enum into its internal string representation, as
     used in the xml or the resource files Bomber => "bomber" */
-std::string action_to_string(ActionName action);
+std::string action_to_string(Actions::ActionName action);
 
 /** Converts a internal action string back into its action enum
     representation  "bomber" => Bomber */
-ActionName  action_from_string(const std::string& action);
+Actions::ActionName action_from_string(const std::string& action);
 
 /** Convert a action enum into its visual representation, aka the
     thing that is seen on the screen for the user Bomber => "Bomber" */
-std::string action_to_screenname(ActionName action);
+std::string action_to_screenname(Actions::ActionName action);
 
-} // namespace Actions
+} // namespace ActionName
 
 // Pingu "globals"
 extern const int pingu_height;

Modified: trunk/pingus/src/pingu_holder.cpp
===================================================================
--- trunk/pingus/src/pingu_holder.cpp   2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingu_holder.cpp   2008-07-22 02:44:55 UTC (rev 3893)
@@ -66,7 +66,7 @@
       pingu != pingus.end();
       ++pingu)
     {
-      if ((*pingu)->get_action() == Actions::Walker)
+      if ((*pingu)->get_action() == Actions::WALKER)
        (*pingu)->draw (gc);
     }
 
@@ -81,7 +81,7 @@
       pingu != pingus.end();
       ++pingu)
     {
-      if ((*pingu)->get_action() != Actions::Walker)
+      if ((*pingu)->get_action() != Actions::WALKER)
        (*pingu)->draw (gc);
     }
 }

Modified: trunk/pingus/src/pingus_main.cpp
===================================================================
--- trunk/pingus/src/pingus_main.cpp    2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/pingus_main.cpp    2008-07-22 02:44:55 UTC (rev 3893)
@@ -72,7 +72,6 @@
 #include "stat_manager.hpp"
 #include "debug.hpp"
 #include "resource.hpp"
-#include "pingu_action_factory.hpp"
 #include "credits.hpp"
 #include "sound/sound.hpp"
 #include "worldmap/worldmap_screen.hpp"
@@ -784,14 +783,12 @@
   Resource::init();
   Fonts::init();
   Sound::PingusSound::init();
-  PinguActionFactory::init();
 }
 
 void
 PingusMain::deinit_pingus()
 {
   Fonts::deinit();
-  PinguActionFactory::deinit();
   Sound::PingusSound::deinit();
   WorldObjFactory::deinit();
   StatManager::deinit();

Modified: trunk/pingus/src/server_event.cpp
===================================================================
--- trunk/pingus/src/server_event.cpp   2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/server_event.cpp   2008-07-22 02:44:55 UTC (rev 3893)
@@ -30,7 +30,7 @@
   : type(PINGU_ACTION_EVENT),
     time_stamp(0),
     pingu_id(0),
-    pingu_action(Actions::Walker)
+    pingu_action(Actions::WALKER)
 {
 }
 

Modified: trunk/pingus/src/world.cpp
===================================================================
--- trunk/pingus/src/world.cpp  2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/world.cpp  2008-07-22 02:44:55 UTC (rev 3893)
@@ -35,7 +35,7 @@
 #include "collision_map.hpp"
 #include "debug.hpp"
 
-using Actions::Bomber;
+using Actions::BOMBER;
 
 static
 bool WorldObj_less (WorldObj* a, WorldObj* b)
@@ -150,7 +150,7 @@
 
               if (pingu && pingu->get_status() == PS_ALIVE)
                 {
-                  pingu->request_set_action(Bomber);
+                  pingu->request_set_action(BOMBER);
                   break;
                 }
               else

Modified: trunk/pingus/src/worldobjs/exit.cpp
===================================================================
--- trunk/pingus/src/worldobjs/exit.cpp 2008-07-21 23:38:17 UTC (rev 3892)
+++ trunk/pingus/src/worldobjs/exit.cpp 2008-07-22 02:44:55 UTC (rev 3893)
@@ -89,10 +89,10 @@
               // Now, make sure the pingu isn't already exiting, gone, or dead
               if (   (*pingu)->get_status() != PS_EXITED
                      && (*pingu)->get_status() != PS_DEAD
-                     && (*pingu)->get_action() != Actions::Exiter)
+                     && (*pingu)->get_action() != Actions::EXITER)
                 {
                   // Pingu actually exits
-                  (*pingu)->set_action(Actions::Exiter);
+                  (*pingu)->set_action(Actions::EXITER);
                 }
             }
         }

Modified: trunk/pingus/src/worldobjs/fake_exit.cpp
===================================================================
--- trunk/pingus/src/worldobjs/fake_exit.cpp    2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/worldobjs/fake_exit.cpp    2008-07-22 02:44:55 UTC (rev 
3893)
@@ -66,7 +66,7 @@
        if (   pingu->get_pos().x > pos.x + 31 && pingu->get_pos().x < pos.x + 
31 + 15
       && pingu->get_pos().y > pos.y + 56 && pingu->get_pos().y < pos.y + 56 + 
56)
        {
-               if (pingu->get_action() != Actions::Splashed)
+               if (pingu->get_action() != Actions::SPLASHED)
                {
                        if (!smashing) 
                        {
@@ -75,7 +75,7 @@
                        }
        
                        if (surface.get_current_frame() == 4)
-                               pingu->set_action(Actions::Splashed);
+                               pingu->set_action(Actions::SPLASHED);
                }
        }
 }

Modified: trunk/pingus/src/worldobjs/hammer.cpp
===================================================================
--- trunk/pingus/src/worldobjs/hammer.cpp       2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/worldobjs/hammer.cpp       2008-07-22 02:44:55 UTC (rev 
3893)
@@ -53,11 +53,11 @@
       for (PinguIter pingu_it = holder->begin (); pingu_it != holder->end (); 
++pingu_it)
        {
          Pingu* pingu = *pingu_it;
-         if (pingu->get_action() != Actions::Splashed)
+         if (pingu->get_action() != Actions::SPLASHED)
            {
              if (pingu->get_x() > pos.x + 55  && pingu->get_x() < pos.x + 77
                    && pingu->get_y() > pos.y + 146 && pingu->get_y() < pos.y + 
185)
-                 pingu->set_action(Actions::Splashed);
+                 pingu->set_action(Actions::SPLASHED);
            }
        }
       sprite.restart();

Modified: trunk/pingus/src/worldobjs/laser_exit.cpp
===================================================================
--- trunk/pingus/src/worldobjs/laser_exit.cpp   2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/worldobjs/laser_exit.cpp   2008-07-22 02:44:55 UTC (rev 
3893)
@@ -67,10 +67,10 @@
       if (   pingu->get_x () < pos.x + 34 + 10 && pingu->get_x () > pos.x + 34
             && pingu->get_y () < pos.y + 43 + 20 && pingu->get_y () > pos.y + 
43)
        {
-         if (pingu->get_action() != Actions::Laserkill)
+         if (pingu->get_action() != Actions::LASERKILL)
            {
              killing = true;
-             pingu->set_action(Actions::Laserkill);
+             pingu->set_action(Actions::LASERKILL);
            }
        }
     }

Modified: trunk/pingus/src/worldobjs/smasher.cpp
===================================================================
--- trunk/pingus/src/worldobjs/smasher.cpp      2008-07-21 23:38:17 UTC (rev 
3892)
+++ trunk/pingus/src/worldobjs/smasher.cpp      2008-07-22 02:44:55 UTC (rev 
3893)
@@ -76,8 +76,8 @@
                                                      static_cast<int>(pos.x + 
250),
                                                      static_cast<int>(pos.y + 
190)))
                                {
-                                 if ((*pingu)->get_action() != 
Actions::Splashed)
-                                   (*pingu)->set_action(Actions::Splashed);
+                                 if ((*pingu)->get_action() != 
Actions::SPLASHED)
+                                   (*pingu)->set_action(Actions::SPLASHED);
                                }
                            }
                  }
@@ -128,7 +128,7 @@
          && pingu->get_pos().x > pos.x + 190
          && pingu->get_pos().x < pos.x + 210))
     {
-      if (pingu->get_action() != Actions::Splashed)
+      if (pingu->get_action() != Actions::SPLASHED)
        {
          if (!smashing)
            {





reply via email to

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