All pastes #1371183 Raw Edit

code

public text v1 · immutable
#1371183 ·published 2009-03-25 01:51 UTC
rendered paste body
void Builder::DeleteObject(PlayerPointer Plr){	GameObjectPointer GObj = Plr->m_GM_SelectedGO;	if( !GObj )	{		SendMsgToPlr(Plr, "No selected GameObject...");		return;	}		if(GObj->m_spawn != 0 && GObj->m_spawn->entry == GObj->GetEntry())	{		uint32 cellx=float2int32(((_maxX-GObj->m_spawn->x)/_cellSize));		uint32 celly=float2int32(((_maxY-GObj->m_spawn->y)/_cellSize));		if(cellx < _sizeX && celly < _sizeY)		{			CellSpawns * c = GObj->GetMapMgr()->GetBaseMap()->GetSpawnsListAndCreate(cellx, celly);			for(GOSpawnList::iterator itr = c->GOSpawns.begin(); itr != c->GOSpawns.end();   itr)				if((*itr) == GObj->m_spawn)				{					c->GOSpawns.erase(itr);					break;				}			WorldDatabase.Execute("DELETE FROM guildbuilder WHERE `id` = '%u'",(unsigned int)GObj->m_spawn->id);			//Plr->BroadcastMessage("%sBuilder:%sDeleted GameObject [ %s%s%s ] ", MSG_COLOR_GREEN, MSG_COLOR_YELLOW, MSG_COLOR_BLUE, GameObjectNameStorage.LookupEntry(GObj->GetEntry())->Name), MSG_COLOR_YELLOW;			GObj->DeleteFromDB();			delete GObj->m_spawn;		}	}	GObj->Despawn(0);		delete GObj;	Plr->m_GM_SelectedGO = 0;}