From 244bfcde5b86180981e99ac9e88eb394f20bcd09 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 17 Apr 2008 05:07:14 +0000 Subject: * Implements 'Set Home to Here' * Implements 'Teleport Home' * User Server has to be updated for it to save your home in grid mode * home position accuracy is in int because the grid comms ExpectUser method tries to convert to Uint and crashes if it gets a float. Added a convert to decimal in ExpectUser but to avoid a breaking change with old revisions, kept the save value in int for now. Eventually it needs to be a float, but lets release another incremental version before doing that. --- OpenSim/Region/ClientStack/ClientView.cs | 51 +++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack/ClientView.cs') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 9c56c52..7a3cff1 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -227,6 +227,7 @@ namespace OpenSim.Region.ClientStack private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation; private PacketStats handlerPacketStats = null; // OnPacketStats;# private RequestAsset handlerRequestAsset = null; // OnRequestAsset; + private UUIDNameRequest handlerTeleportHomeRequest = null; /* Properties */ @@ -776,6 +777,7 @@ namespace OpenSim.Region.ClientStack public event MoneyBalanceRequest OnMoneyBalanceRequest; public event ParcelBuy OnParcelBuy; + public event UUIDNameRequest OnTeleportHomeRequest; #region Scene/Avatar to Client @@ -4188,19 +4190,48 @@ namespace OpenSim.Region.ClientStack case PacketType.TeleportLandmarkRequest: TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; LLUUID lmid = tpReq.Info.LandmarkID; - AssetBase lma = m_assetCache.GetAsset(lmid, false); - - if(lma == null) + AssetLandmark lm; + if (lmid != LLUUID.Zero) { - // Failed to find landmark - - TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); - tpCancel.Info.SessionID = tpReq.Info.SessionID; - tpCancel.Info.AgentID = tpReq.Info.AgentID; - OutPacket(tpCancel, ThrottleOutPacketType.Task); + AssetBase lma = m_assetCache.GetAsset(lmid, false); + + if (lma == null) + { + // Failed to find landmark + + TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); + tpCancel.Info.SessionID = tpReq.Info.SessionID; + tpCancel.Info.AgentID = tpReq.Info.AgentID; + OutPacket(tpCancel, ThrottleOutPacketType.Task); + } + + + try + { + lm = new AssetLandmark(lma); + } + catch (NullReferenceException) + { + // asset not found generates null ref inside the assetlandmark constructor. + TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); + tpCancel.Info.SessionID = tpReq.Info.SessionID; + tpCancel.Info.AgentID = tpReq.Info.AgentID; + OutPacket(tpCancel, ThrottleOutPacketType.Task); + break; + } + } + else + { + + // Teleport home request + handlerTeleportHomeRequest = OnTeleportHomeRequest; + if (handlerTeleportHomeRequest != null) + { + handlerTeleportHomeRequest(this.AgentId,this); + } + break; } - AssetLandmark lm = new AssetLandmark(lma); handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; if (handlerTeleportLandmarkRequest != null) { -- cgit v1.1