コード例 #1
0
void ClusterInterface::HandleTransporterMapChange(WorldPacket & pck)
{
	//remove when this is stable, ROFL
	DEBUG_LOG("Transport", "Handling clustered map change");
	uint32 tentry, mapid;
	float x, y, z;
	pck >> tentry >> mapid >> x >> y >> z;

	Transporter* t = objmgr.GetTransporterByEntry(tentry);

	//we need to add to our map
	MapMgr* mgr = sInstanceMgr.GetMapMgr(mapid);

	LocationVector l;
	l.x = x;
	l.y = y;
	l.z = z;

	if (mgr == NULL)
		return;

	if (t->IsInWorld())
		t->RemoveFromWorld(false);
	t->SetMapId(mapid);
	//don't start instantly, we start after eventclustermapchange is finished :P
	sEventMgr.RemoveEvents(t);
	//t->m_canmove = false;
	t->AddToWorld(mgr);
	sEventMgr.AddEvent(t, &Transporter::EventClusterMapChange, mapid, l, EVENT_UNK, 1, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT | EVENT_FLAG_MOVE_TO_WORLD_CONTEXT);
}