//------------------------------------------------------------------------------------- void EntityCoordinateNode::update() { // 在这里做一下更新的原因是,很可能在CoordinateNode::update()的过程中导致实体位置被移动 // 而导致次数update被调用,在某种情况下会出现问题 // 例如:// A->B, B-A(此时old_*是B), A->B(此时old_*是B,而xx等目的地就是B),此时update中会误判为没有移动。 // https://github.com/kbengine/kbengine/issues/407 old_xx(x()); old_yy(y()); old_zz(z()); CoordinateNode::update(); addFlags(COORDINATE_NODE_FLAG_ENTITY_NODE_UPDATING); ++entityNodeUpdating_; // 此处必须使用watcherNodes_.size()而不能使用迭代器遍历,防止在update中导致增加了watcherNodes_数量而破坏迭代器 for (std::vector<CoordinateNode*>::size_type i = 0; i < watcherNodes_.size(); ++i) { CoordinateNode* pCoordinateNode = watcherNodes_[i]; if (!pCoordinateNode) continue; pCoordinateNode->update(); } --entityNodeUpdating_; if (entityNodeUpdating_ == 0) removeFlags(COORDINATE_NODE_FLAG_ENTITY_NODE_UPDATING); clearDelWatcherNodes(); }
void ChatData::invalidateParticipants() { auto wasCanEdit = canEdit(); participants.clear(); admins.clear(); removeFlags(MTPDchat::Flag::f_admin); invitedByMe.clear(); botStatus = 0; if (wasCanEdit != canEdit()) { Notify::peerUpdatedDelayed(this, Notify::PeerUpdate::Flag::ChatCanEdit); } Notify::peerUpdatedDelayed(this, Notify::PeerUpdate::Flag::MembersChanged | Notify::PeerUpdate::Flag::AdminsChanged); }
//------------------------------------------------------------------------------------- void EntityCoordinateNode::update() { CoordinateNode::update(); addFlags(COORDINATE_NODE_FLAG_ENTITY_NODE_UPDATING); ++entityNodeUpdating_; // 此处必须使用watcherNodes_.size()而不能使用迭代器遍历,防止在update中导致增加了watcherNodes_数量而破坏迭代器 for (std::vector<CoordinateNode*>::size_type i = 0; i < watcherNodes_.size(); ++i) { CoordinateNode* pCoordinateNode = watcherNodes_[i]; if (!pCoordinateNode) continue; pCoordinateNode->update(); } --entityNodeUpdating_; if (entityNodeUpdating_ == 0) removeFlags(COORDINATE_NODE_FLAG_ENTITY_NODE_UPDATING); clearDelWatcherNodes(); }
void Transporter::BuildStopMovePacket(MapMgr* /*targetMap*/) { removeFlags(GO_FLAG_NONSELECTABLE); setState(GO_STATE_CLOSED); }