diff options
author | Justin Clark-Casey (justincc) | 2012-02-09 01:17:59 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-09 01:17:59 +0000 |
commit | 9c84a8162f700fc2eb35018389c12fcfedc02587 (patch) | |
tree | 663c57d6ed5a4eb071fbd7e1ab69315dcb34c067 /OpenSim/Region/OptionalModules/World | |
parent | Add NPC torture tests for 100, 1000 and 2000 create and delete NPC calls. (diff) | |
download | opensim-SC-9c84a8162f700fc2eb35018389c12fcfedc02587.zip opensim-SC-9c84a8162f700fc2eb35018389c12fcfedc02587.tar.gz opensim-SC-9c84a8162f700fc2eb35018389c12fcfedc02587.tar.bz2 opensim-SC-9c84a8162f700fc2eb35018389c12fcfedc02587.tar.xz |
If NPCModule.CreateNPC() fails to create the required ScenePresence (which should in theory never happen), don't add the NPC to the npc list but return UUID.Zero instead.
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 8701431..dc6eefc 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -148,22 +148,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
148 | ScenePresence sp; | 148 | ScenePresence sp; |
149 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 149 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
150 | { | 150 | { |
151 | m_log.DebugFormat( | 151 | // m_log.DebugFormat( |
152 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); | 152 | // "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); |
153 | 153 | ||
154 | sp.CompleteMovement(npcAvatar, false); | 154 | sp.CompleteMovement(npcAvatar, false); |
155 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
156 | m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); | ||
157 | |||
158 | return npcAvatar.AgentId; | ||
155 | } | 159 | } |
156 | else | 160 | else |
157 | { | 161 | { |
158 | m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); | 162 | m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); |
163 | return UUID.Zero; | ||
159 | } | 164 | } |
160 | |||
161 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
162 | } | 165 | } |
163 | |||
164 | m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); | ||
165 | |||
166 | return npcAvatar.AgentId; | ||
167 | } | 166 | } |
168 | 167 | ||
169 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) | 168 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) |