//----------------------------------------------------------------------------- void ZonePlugin::redraw (const float currentTime, const float elapsedTime) { AbstractPlugin* parent = getParentPlugin(); ZonePlugin* parentZone = dynamic_cast<ZonePlugin*>(parent); // the root zone if( parentZone == NULL ) { // right now do not call the base class // as we want to see the children ... BaseClass::redrawChildren( currentTime, elapsedTime ); if( isVisible() == false ) { return; } // draw "zone area" // zoneUtility( ); } else { // draw "zone area" if( isVisible() == true ) { zoneUtility( ); } BaseClass::redraw( currentTime, elapsedTime ); if( isVisible() == false ) { return; } // textual annotation AbstractPlugin* contentPlugin = getPlugin(0); size_t population = 0; if( contentPlugin != NULL ) { osAVGroup vehicles = contentPlugin->allVehicles(); population = vehicles.size(); } std::ostringstream annote; annote << std::setprecision (2) << std::setiosflags (std::ios::fixed); annote << "Zone: " << getZoneId() << std::endl << "pos(" << position() << ")" << std::endl; annote << "Population: " << population << std::endl << std::ends; draw2dTextAt3dLocation (annote, position(), gGreen, drawGetWindowWidth(), drawGetWindowHeight()); } }
void CBattlefield::cleanup() { ShowDebug("bcnm cleanup id:%i inst:%i \n",this->getID(),this->getBattlefieldNumber()); //wipe enmity from all mobs in list if needed for(int i=0; i<m_EnemyList.size(); i++) { m_EnemyList.at(i)->PBattleAI->SetCurrentAction(ACTION_DESPAWN); m_EnemyList.at(i)->PBCNM = NULL; } //wipe mob list m_EnemyList.clear(); //make chest vanish (if any) for(int i=0; i<m_NpcList.size(); i++) { m_NpcList.at(i)->loc.zone->PushPacket(m_NpcList.at(i), CHAR_INRANGE, new CEntityAnimationPacket(m_NpcList.at(i), CEntityAnimationPacket::FADE_OUT)); m_NpcList.at(i)->animation = ANIMATION_DEATH; m_NpcList.at(i)->status = STATUS_UPDATE; m_NpcList.at(i)->loc.zone->PushPacket(m_NpcList.at(i), CHAR_INRANGE, new CEntityUpdatePacket(m_NpcList.at(i), ENTITY_UPDATE, UPDATE_COMBAT)); } //wipe npc list m_NpcList.clear(); for (auto PAlly : m_AllyList) { zoneutils::GetZone(getZoneId())->DeletePET(PAlly); delete PAlly; } m_AllyList.clear(); luautils::OnBcnmDestroy(this); locked = false; //delete battlefield if(m_Handler==NULL) { ShowError("Battlefield handler is NULL from Battlefield BCNM %i Inst %i \n",m_BcnmID,m_BattlefieldNumber); } m_Handler->wipeBattlefield(this); delete this; }