diff options
author | Charles Krinke | 2008-11-27 05:16:47 +0000 |
---|---|---|
committer | Charles Krinke | 2008-11-27 05:16:47 +0000 |
commit | 921692a15f7b793da55cd4ddc4d85eae4393964e (patch) | |
tree | ebe7565de552bedbd856cd6615bd8107363eea79 /OpenSim/Region/ClientStack | |
parent | Unconditionally set the slam bit oon all object to agent inventory transfers. (diff) | |
download | opensim-SC_OLD-921692a15f7b793da55cd4ddc4d85eae4393964e.zip opensim-SC_OLD-921692a15f7b793da55cd4ddc4d85eae4393964e.tar.gz opensim-SC_OLD-921692a15f7b793da55cd4ddc4d85eae4393964e.tar.bz2 opensim-SC_OLD-921692a15f7b793da55cd4ddc4d85eae4393964e.tar.xz |
Thank you kindly, Nlin for a patch that:
Adds a new method to IClientAPI to allow adding message handlers
for GenericMessages (of which "autopilot" is one). Part 2 adds a
specific autopilot handler in ScenePresence.cs.
2) Removing unused variables and functions.
3) Simplifying the navigation logic in ScenePresence.cs. The
original patch was somewhat complex because it included orientation
logic for a future enhancement of orienting the avatar to point
towards the direction being walked. Currently this isn't working,
though, so I removed the orientation code, which leaves just the
smaller and hopefully simpler-to-understand movement code.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7c66599..e3b91a5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -93,6 +93,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
93 | new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 93 | new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
94 | 94 | ||
95 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); | 95 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); |
96 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers | ||
96 | 97 | ||
97 | protected IScene m_scene; | 98 | protected IScene m_scene; |
98 | 99 | ||
@@ -608,6 +609,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
608 | return result; | 609 | return result; |
609 | } | 610 | } |
610 | 611 | ||
612 | public bool AddGenericPacketHandler(string MethodName, GenericMessage handler) | ||
613 | { | ||
614 | bool result = false; | ||
615 | lock (m_genericPacketHandlers) | ||
616 | { | ||
617 | if (!m_genericPacketHandlers.ContainsKey(MethodName)) | ||
618 | { | ||
619 | m_genericPacketHandlers.Add(MethodName, handler); | ||
620 | result = true; | ||
621 | } | ||
622 | } | ||
623 | return result; | ||
624 | } | ||
625 | |||
611 | /// <summary> | 626 | /// <summary> |
612 | /// Try to process a packet using registered packet handlers | 627 | /// Try to process a packet using registered packet handlers |
613 | /// </summary> | 628 | /// </summary> |
@@ -3457,21 +3472,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3457 | public bool HandleGenericMessage(IClientAPI sender, Packet pack) | 3472 | public bool HandleGenericMessage(IClientAPI sender, Packet pack) |
3458 | { | 3473 | { |
3459 | GenericMessagePacket gmpack = (GenericMessagePacket) pack; | 3474 | GenericMessagePacket gmpack = (GenericMessagePacket) pack; |
3460 | handlerGenericMessage = OnGenericMessage; | 3475 | if (m_genericPacketHandlers.Count == 0) return false; |
3461 | 3476 | handlerGenericMessage = null; | |
3462 | List<string> msg = new List<string>(); | 3477 | string method = Util.FieldToString(gmpack.MethodData.Method).ToLower().Trim(); |
3463 | 3478 | if(m_genericPacketHandlers.TryGetValue(method, out handlerGenericMessage)) | |
3464 | if (handlerGenericMessage != null) | ||
3465 | { | 3479 | { |
3466 | string method = Util.FieldToString(gmpack.MethodData.Method); | 3480 | List<string> msg = new List<string>(); |
3467 | foreach (GenericMessagePacket.ParamListBlock block in gmpack.ParamList) | 3481 | |
3482 | if (handlerGenericMessage != null) | ||
3468 | { | 3483 | { |
3469 | msg.Add(Util.FieldToString(block.Parameter)); | 3484 | foreach (GenericMessagePacket.ParamListBlock block in gmpack.ParamList) |
3485 | { | ||
3486 | msg.Add(Util.FieldToString(block.Parameter)); | ||
3487 | } | ||
3488 | try | ||
3489 | { | ||
3490 | handlerGenericMessage(sender, method, msg); | ||
3491 | return true; | ||
3492 | } | ||
3493 | catch (Exception ex) | ||
3494 | { | ||
3495 | } | ||
3470 | } | 3496 | } |
3471 | |||
3472 | handlerGenericMessage(this, method, msg); | ||
3473 | } | 3497 | } |
3474 | return true; | 3498 | return false; |
3475 | } | 3499 | } |
3476 | 3500 | ||
3477 | public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) | 3501 | public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) |
@@ -3965,12 +3989,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3965 | { | 3989 | { |
3966 | #region Scene/Avatar | 3990 | #region Scene/Avatar |
3967 | 3991 | ||
3968 | case PacketType.GenericMessage: | 3992 | // case PacketType.GenericMessage: |
3969 | GenericMessagePacket gmpack = (GenericMessagePacket)Pack; | 3993 | // GenericMessagePacket gmpack = (GenericMessagePacket)Pack; |
3970 | 3994 | ||
3971 | DecipherGenericMessage(Utils.BytesToString(gmpack.MethodData.Method), gmpack.MethodData.Invoice, gmpack.ParamList); | 3995 | // DecipherGenericMessage(Utils.BytesToString(gmpack.MethodData.Method), gmpack.MethodData.Invoice, gmpack.ParamList); |
3972 | 3996 | ||
3973 | break; | 3997 | // break; |
3974 | case PacketType.AvatarPropertiesRequest: | 3998 | case PacketType.AvatarPropertiesRequest: |
3975 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 3999 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
3976 | 4000 | ||