void SSaPCollisionManager::collide(BroadPhaseCollisionManager* other_manager_, void* cdata, CollisionCallBack callback) const { SSaPCollisionManager* other_manager = static_cast<SSaPCollisionManager*>(other_manager_); if((size() == 0) || (other_manager->size() == 0)) return; if(this == other_manager) { collide(cdata, callback); return; } std::vector<CollisionObject*>::const_iterator it, end; if(this->size() < other_manager->size()) { for(it = objs_x.begin(), end = objs_x.end(); it != end; ++it) if(other_manager->collide_(*it, cdata, callback)) return; } else { for(it = other_manager->objs_x.begin(), end = other_manager->objs_x.end(); it != end; ++it) if(collide_(*it, cdata, callback)) return; } }
void Potion::collide(const Pos& pos, Actor* const actor) { if(eng.map->cells[pos.x][pos.y].featureStatic->isBottomless() == false || actor != NULL) { // ItemData* const potData = // eng.itemDataHandler->dataList[d.id]; const bool PLAYER_SEE_CELL = eng.map->cells[pos.x][pos.y].isSeenByPlayer; if(PLAYER_SEE_CELL) { // TODO Use standard animation Renderer::drawGlyph('*', Panel::map, pos, data_->clr); if(actor != NULL) { if(actor->deadState == ActorDeadState::alive) { eng.log->addMsg( "The potion shatters on " + actor->getNameThe() + "."); } } else { Feature* const f = eng.map->cells[pos.x][pos.y].featureStatic; eng.log->addMsg("The potion shatters on " + f->getDescr(true) + "."); } } //If the blow from the bottle didn't kill the actor, apply what's inside if(actor != NULL) { if(actor->deadState == ActorDeadState::alive) { collide_(pos, actor); if( actor->deadState == ActorDeadState::alive && data_->isIdentified == false && PLAYER_SEE_CELL) { eng.log->addMsg("It had no apparent effect..."); } } } } }
void SSaPCollisionManager::collide(CollisionObject* obj, void* cdata, CollisionCallBack callback) const { if(size() == 0) return; collide_(obj, cdata, callback); }