gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/server character.h sprite_instance.cpp


From: Vitaly Alexeev
Subject: [Gnash-commit] gnash/server character.h sprite_instance.cpp
Date: Wed, 16 Aug 2006 14:45:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Vitaly Alexeev <alexeev>        06/08/16 14:45:28

Modified files:
        server         : character.h sprite_instance.cpp 

Log message:
        If we already have object with same events on this plane,  then move it 
instead of replacing

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.31&r2=1.32

Patches:
Index: character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- character.h 13 Aug 2006 12:59:33 -0000      1.13
+++ character.h 16 Aug 2006 14:45:28 -0000      1.14
@@ -183,6 +183,11 @@
                        }
        }
 
+               const hash<event_id, as_value>* get_event_handlers() const
+       {
+           return &m_event_handlers;
+       }
+
                virtual void has_keypress_event() {}
 
     // Movie interfaces.  By default do nothing.  sprite_instance and some 
others override these.

Index: sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- sprite_instance.cpp 9 Aug 2006 01:59:06 -0000       1.31
+++ sprite_instance.cpp 16 Aug 2006 14:45:28 -0000      1.32
@@ -1556,9 +1556,34 @@
                    || (name && existing_char->get_name() == name)))
                {
 //                             IF_VERBOSE_DEBUG(log_msg("add changed to move 
on depth %d\n", depth));//xxxxxx
+                       // compare events 
+                       hash<event_id, as_value>* existing_events = 
(hash<event_id, as_value>*) existing_char->get_event_handlers();
+                       int n = event_handlers.size();
+                       if (existing_events->size() == n)
+                       {
+                               bool same_events = true;
+                               for (int i = 0; i < n; i++)
+                               {
+                                       as_value result;
+                                       if 
(existing_events->get(event_handlers[i]->m_event, &result))
+                                       {
+                                               // compare actionscipt in event
+                                               if (event_handlers[i]->m_method 
== result)
+                                               {
+                                                       continue;
+                                               }
+                                       }
+                                       same_events = false;
+                                       break;
+                               }
+                               
+                               if (same_events)
+                               {
                    move_display_object(depth, true, color_transform, true, 
matrix, ratio, clip_depth);
                    return NULL;
                }
+                       }
+               }
            //printf("%s: character %s, id is %d, count is %d\n", __FUNCTION__, 
existing_char->get_name(), character_id,m_display_list.get_character_count()); 
// FIXME:
 
            assert(cdef);




reply via email to

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