--- objects.cc 14 Aug 2002 22:53:45 -0000 1.31 +++ objects.cc 21 Aug 2002 21:30:55 -0000 @@ -29,6 +29,7 @@ #include "px/tools.hh" #include +#include #include #include #include @@ -336,11 +337,13 @@ public: Bridge(); private: + list my_actors; enum State { OPEN, CLOSED, OPENING, CLOSING } state; string get_type() const {return string_attrib("type");} void actor_enter(Actor *); + void actor_leave(Actor *); void message(const string &m, const Value &); void set_model(); @@ -375,6 +378,12 @@ { if (state != CLOSED) SendMessage(a, "fall"); + my_actors.push_back(a); +} + +void Bridge::actor_leave(Actor *a) +{ + my_actors.erase(find(my_actors.begin(), my_actors.end(), a)); } void Bridge::set_model() @@ -391,6 +400,10 @@ string mname = string("fl-bridge")+get_type(); switch( newstate) { case OPENING: + // can this be done with for_each? + for(list::iterator a=my_actors.begin();a!=my_actors.end();a++) + SendMessage(*a, "fall"); + if( state == CLOSING) get_model()->reverse(); else