pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src pingu.cxx,1.5,1.6


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src pingu.cxx,1.5,1.6
Date: 21 Jun 2002 13:42:36 -0000

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

Modified Files:
        pingu.cxx 
Log Message:
- changed check for == 0 to !
- replaced bitwise comparision with logical comparision
- removed dead code
- reordered update() to simplify it


Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pingu.cxx   21 Jun 2002 07:45:35 -0000      1.5
+++ pingu.cxx   21 Jun 2002 13:42:34 -0000      1.6
@@ -117,10 +117,8 @@
 
   act->set_pingu(this);
 
-  // Use the activation time of the action
-
-  // FIXME: ^ XOR?!
-  if (act->get_type() ^ (ActionType)ONCE) 
+  // check for persistent actions
+  if (act->get_type() != (ActionType)ONCE) 
     {
       if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
        {
@@ -249,21 +247,13 @@
 Pingu::update_persistent(float /*delta*/)
 {
   // 
-  if (environment == ENV_AIR && action == 0 && rel_getpixel(0, -1) == 
ColMap::NOTHING) 
+  if (environment == ENV_AIR && !action && rel_getpixel(0, -1) == 
ColMap::NOTHING) 
     {
       for (unsigned int i=0; i < persist.size(); ++i) 
        {
-         if (persist[i]->get_type() & (ActionType)FALL) 
+         if (persist[i]->get_type() == (ActionType)FALL) 
            {
-             if (action && persist[i]->get_name() == action->get_name()) 
-               {
-                 if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
-                   std::cout << "Pingu: Not using action, we already did." << 
std::endl;
-               } 
-             else 
-               {
-                 set_paction(persist[i]->get_name());
-               }
+              set_paction(persist[i]->get_name());
            }
        }
     }
@@ -291,25 +281,20 @@
   if (action_time > -1) 
     --action_time;
 
-  if (action_time == 0 && countdown_action) 
+  if ( !action_time && countdown_action) 
     {
       action = countdown_action;
       action->set_pingu(this);
     }
   
-  if (action && action->is_finished) 
+  if ( !action || action->is_finished) 
     {
-      action = 0;
+      // FIXME: needs a better name now
+      update_normal(delta);
     }
 
   update_persistent(delta);
-
-  /** When we have an action evaluate it, else evaluate the normal
-      walking */
-  if (action) 
-    action->update(delta);
-  else 
-    update_normal(delta);
+  action->update(delta);
 }
 
 // Check if the pingu is on ground and then do something.




reply via email to

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