gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12337: Minor cleanups; nothing impo


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12337: Minor cleanups; nothing important.
Date: Mon, 26 Jul 2010 12:01:18 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12337 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2010-07-26 12:01:18 +0200
message:
  Minor cleanups; nothing important.
modified:
  libcore/movie_root.cpp
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp    2010-07-25 04:34:15 +0000
+++ b/libcore/movie_root.cpp    2010-07-26 09:39:53 +0000
@@ -54,7 +54,6 @@
 #include <sstream>
 #include <map>
 #include <bitset>
-#include <typeinfo>
 #include <cassert>
 #include <functional> // std::bind2nd, std::equal_to
 #include <boost/algorithm/string/case_conv.hpp>
@@ -368,7 +367,7 @@
 
 //#define GNASH_DEBUG_LEVELS_SWAPPING 1
 
-    int oldDepth = movie->get_depth();
+    const int oldDepth = movie->get_depth();
 
 #ifdef GNASH_DEBUG_LEVELS_SWAPPING
     log_debug("Before swapLevels (source depth %d, target depth %d) "
@@ -380,48 +379,43 @@
                 i->second->get_depth());
     }
 #endif
-
-    if ( oldDepth < DisplayObject::staticDepthOffset ) // should include 
_level0 !
-    {
-        IF_VERBOSE_ASCODING_ERRORS(
-        log_aserror(_("%s.swapDepth(%d): movie has a depth (%d) below "
-                "static depth zone (%d), won't swap its depth"),
-                movie->getTarget(), depth, oldDepth,
-                DisplayObject::staticDepthOffset);
-        );
-        return;
-    }
-
-    if ( oldDepth >= 0 ) 
-    {
-        IF_VERBOSE_ASCODING_ERRORS(
-        log_aserror(_("%s.swapDepth(%d): movie has a depth (%d) below "
-                "static depth zone (%d), won't swap its depth"),
-                movie->getTarget(), depth, oldDepth,
-                DisplayObject::staticDepthOffset);
-        );
-        return;
-    }
-
-    int oldNum = oldDepth; // -DisplayObject::staticDepthOffset;
+    // should include _level0 !
+    if (oldDepth < DisplayObject::staticDepthOffset) {
+        IF_VERBOSE_ASCODING_ERRORS(
+        log_aserror(_("%s.swapDepth(%d): movie has a depth (%d) below "
+                "static depth zone (%d), won't swap its depth"),
+                movie->getTarget(), depth, oldDepth,
+                DisplayObject::staticDepthOffset);
+        );
+        return;
+    }
+
+    if (oldDepth >= 0) {
+        IF_VERBOSE_ASCODING_ERRORS(
+        log_aserror(_("%s.swapDepth(%d): movie has a depth (%d) below "
+                "static depth zone (%d), won't swap its depth"),
+                movie->getTarget(), depth, oldDepth,
+                DisplayObject::staticDepthOffset);
+        );
+        return;
+    }
+
+    const int oldNum = oldDepth; 
     Levels::iterator oldIt = _movies.find(oldNum);
-    if ( oldIt == _movies.end() )
-    {
+    if (oldIt == _movies.end()) {
         log_debug("%s.swapDepth(%d): target depth (%d) contains no movie",
             movie->getTarget(), depth, oldNum);
         return;
     }
 
-    int newNum = depth; // -DisplayObject::staticDepthOffset;
+    const int newNum = depth; 
     movie->set_depth(depth);
     Levels::iterator targetIt = _movies.find(newNum);
-    if ( targetIt == _movies.end() )
-    {
+    if (targetIt == _movies.end()) {
         _movies.erase(oldIt);
         _movies[newNum] = movie;
     }
-    else
-    {
+    else {
         MovieClip* otherMovie = targetIt->second;
         otherMovie->set_depth(oldDepth);
         oldIt->second = otherMovie;
@@ -452,21 +446,20 @@
 movie_root::dropLevel(int depth)
 {
     // should be checked by caller
-    assert ( depth >= 0 && depth <= 1048575 );
+    // TODO: don't use a magic number! See MovieClip::removeMovieClip().
+    assert(depth >= 0 && depth <= 1048575);
 
     Levels::iterator it = _movies.find(depth);
-    if ( it == _movies.end() )
-    {
+    if (it == _movies.end()) {
         log_error("movie_root::dropLevel called against a movie not "
                 "found in the levels container");
         return;
     }
 
     MovieClip* mo = it->second;
-    if (mo == _rootMovie)
-    {
+    if (mo == _rootMovie) {
         IF_VERBOSE_ASCODING_ERRORS(
-        log_aserror(_("Original root movie can't be removed"));
+            log_aserror(_("Original root movie can't be removed"));
         );
         return;
     }
@@ -484,10 +477,10 @@
 {
     extern_movie->set_depth(num + DisplayObject::staticDepthOffset);
     Levels::iterator it = _movies.find(extern_movie->get_depth());
-    if ( it == _movies.end() )
-    {
-        log_error("TESTME: loadMovie called on level %d which is not available 
at load time, skipped placement for now");
-        return; // skip
+    if (it == _movies.end()) {
+        log_error("TESTME: loadMovie called on level %d which is not "
+                "available at load time, skipped placement for now");
+        return; 
     }
 
     // TODO: rework this to avoid the double scan 
@@ -509,7 +502,7 @@
 movie_root::reset()
 {
     sound::sound_handler* sh = _runResources.soundHandler();
-    if ( sh ) sh->reset();
+    if (sh) sh->reset();
     clear();
     _disableScripts = false;
 }


reply via email to

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