X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fobject.cpp;h=09d52bf3357b02165410e82e4200877421eddb7e;hb=565c33c91ea355528145ba94b31b2e44309d0834;hp=ca065dcdc77832daa41192d3d7496739d68a193e;hpb=2549a213bacfb2f6993ec143083d72b716854345;p=architektonas diff --git a/src/object.cpp b/src/object.cpp index ca065dc..09d52bf 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -145,22 +145,24 @@ printf("Object: Destroyed!\n"); // them here. :-) /*virtual*/ void Object::Connect(Object * obj, double parameter) { - connected.push_back(Connection(obj, parameter)); + // Check to see if this connection is already in our list... + Connection c(obj, parameter); + std::vector::iterator i; + + for(i=connected.begin(); i!=connected.end(); i++) + { + // Bail out if this connection is already present... + if (*i == c) + return; + } + + // Connection is a new one, add it in... + connected.push_back(c); } /*virtual*/ void Object::Disconnect(Object * obj, double parameter) { -#if 0 - for(uint i=0; i::iterator i; for(i=connected.begin(); i!=connected.end(); i++) @@ -171,25 +173,11 @@ printf("Object: Destroyed!\n"); return; } } -#endif } /*virtual*/ void Object::DisconnectAll(Object * obj) { -#if 0 - // According the std::vector docs, only items at position i and beyond are - // invalidated, everything before i is still valid. So we use that here. - for(uint i=0; i::iterator i; for(i=connected.begin(); i!=connected.end(); ) @@ -199,7 +187,6 @@ printf("Object: Destroyed!\n"); else i++; } -#endif }