pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/actions blocker.cxx,1.10,1.11 blocker


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions blocker.cxx,1.10,1.11 blocker.hxx,1.9,1.10
Date: 18 Sep 2002 10:50:59 -0000

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

Modified Files:
        blocker.cxx blocker.hxx 
Log Message:
placed some logic where it belongs, removed catch_pingu from PinguAction

Index: blocker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- blocker.cxx 16 Sep 2002 20:31:09 -0000      1.10
+++ blocker.cxx 18 Sep 2002 10:50:57 -0000      1.11
@@ -23,6 +23,8 @@
 #include "../pingu.hxx"
 #include "../pingus_resource.hxx"
 #include "../string_converter.hxx"
+#include "../pingu_holder.hxx"
+#include "../world.hxx"
 #include "blocker.hxx"
 
 namespace Actions {
@@ -59,7 +61,15 @@
     {
       pingu->set_action(Actions::Faller);
     }
-    
+  else
+    {
+      PinguHolder* pingus = WorldObj::get_world()->get_pingu_p();
+      for(PinguIter i = pingus->begin(); i != pingus->end(); ++i)
+       {
+         catch_pingu(*i);
+       }
+    }
+
   UNUSED_ARG(delta);
 }
 
@@ -75,27 +85,23 @@
   return (rel_getpixel(0,-1) !=  Groundtype::GP_NOTHING);
 }
 
-bool
-Blocker::need_catch()
-{
-  return true;
-}
-
-
 void
 Blocker::catch_pingu(Pingu* target)
 {
-  if (target->get_x () > pingu->get_x () - 16 
-      && target->get_x () < pingu->get_x () + 16
-      && target->get_y () > pingu->get_y () - 32
-      && target->get_y () < pingu->get_y () + 5
-      ) 
+  if (target != pingu)
     {
-      if (target->get_x () > pingu->get_x ()) {
-       target->direction.right();
-      } else {
-       target->direction.left();
-      }
+      if (target->get_x () > pingu->get_x () - 16 
+         && target->get_x () < pingu->get_x () + 16
+         && target->get_y () > pingu->get_y () - 32
+         && target->get_y () < pingu->get_y () + 5
+         ) 
+       {
+         if (target->get_x () > pingu->get_x ()) {
+           target->direction.right();
+         } else {
+           target->direction.left();
+         }
+       }
     }
 }
 

Index: blocker.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- blocker.hxx 10 Sep 2002 19:24:19 -0000      1.9
+++ blocker.hxx 18 Sep 2002 10:50:57 -0000      1.10
@@ -41,12 +41,11 @@
  
   void  draw (GraphicContext& gc);
   void  update(float delta);
-  bool  standing_on_ground();
 
-  bool  need_catch();
-  void  catch_pingu(Pingu* pingu);
-  
 private:
+  bool  standing_on_ground();
+  void  catch_pingu(Pingu* pingu);
+
   Blocker (const Blocker&);
   Blocker operator= (const Blocker&);
 };





reply via email to

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