void Elevator::HandleStopBeep(Environment &env, const Event &e) { if (ForMe(e)) { if (beeping_ != 0) { env.CancelEvent(beeping_); beeping_ = 0; } else env.SendEvent("Elevator::Beeped", 0, this); } }
void Person::HandleBeeping(Environment &env, const Event &e) { Elevator *ele = static_cast<Elevator*>(e.GetSender()); if (elevator_ == ele && elevator_) { beeping_ = true; env.CancelEvent(action_); // Cancel Interface::Interact Exit(env); } }
void Person::Cancel(Environment &env) { if (action_) { env.CancelEvent(action_); env.SendEvent("Person::Canceled", 0, this); action_ = 0; isEnteringOrExiting_ = false; } }