diff options
author | Adam Frisby | 2009-08-21 14:10:21 +1000 |
---|---|---|
committer | Adam Frisby | 2009-08-21 14:10:21 +1000 |
commit | 29e2067ec354435c2cde8f4cd7c9fd869fd931b3 (patch) | |
tree | 0a5224f501257114f21d9e88bea024dd461f2af8 /OpenSim | |
parent | * Once more into the breach! (diff) | |
download | opensim-SC-29e2067ec354435c2cde8f4cd7c9fd869fd931b3.zip opensim-SC-29e2067ec354435c2cde8f4cd7c9fd869fd931b3.tar.gz opensim-SC-29e2067ec354435c2cde8f4cd7c9fd869fd931b3.tar.bz2 opensim-SC-29e2067ec354435c2cde8f4cd7c9fd869fd931b3.tar.xz |
* Implements a cache in NPCModule for Appearance.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 775dc91..d6b90e1 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -41,6 +41,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
41 | 41 | ||
42 | private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); | 42 | private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); |
43 | 43 | ||
44 | private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>(); | ||
45 | |||
46 | private AvatarAppearance GetAppearance(UUID target, Scene scene) | ||
47 | { | ||
48 | if (m_appearanceCache.ContainsKey(target)) | ||
49 | return m_appearanceCache[target]; | ||
50 | |||
51 | return scene.CommsManager.AvatarService.GetUserAppearance(target); | ||
52 | } | ||
53 | |||
44 | public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) | 54 | public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) |
45 | { | 55 | { |
46 | NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); | 56 | NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); |
@@ -52,7 +62,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
52 | ScenePresence sp; | 62 | ScenePresence sp; |
53 | if(scene.TryGetAvatar(npcAvatar.AgentId, out sp)) | 63 | if(scene.TryGetAvatar(npcAvatar.AgentId, out sp)) |
54 | { | 64 | { |
55 | AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom); | 65 | AvatarAppearance x = GetAppearance(cloneAppearanceFrom, scene); |
56 | 66 | ||
57 | List<byte> wearbyte = new List<byte>(); | 67 | List<byte> wearbyte = new List<byte>(); |
58 | for (int i = 0; i < x.VisualParams.Length; i++) | 68 | for (int i = 0; i < x.VisualParams.Length; i++) |