forked from teamnwah/openmw-tes3coop
		
	Ensure mechanics actors/objects are cleared before adding them
This commit is contained in:
		
							parent
							
								
									c7692acb79
								
							
						
					
					
						commit
						d6324d71bf
					
				
					 2 changed files with 4 additions and 0 deletions
				
			
		|  | @ -170,6 +170,8 @@ namespace MWMechanics | ||||||
|         // erase previous death events since we are currently only tracking them while in an active cell
 |         // erase previous death events since we are currently only tracking them while in an active cell
 | ||||||
|         MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied(); |         MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied(); | ||||||
| 
 | 
 | ||||||
|  |         removeActor(ptr); | ||||||
|  | 
 | ||||||
|         MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); |         MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); | ||||||
|         mActors.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); |         mActors.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -16,6 +16,8 @@ Objects::Objects() | ||||||
| 
 | 
 | ||||||
| void Objects::addObject(const MWWorld::Ptr& ptr) | void Objects::addObject(const MWWorld::Ptr& ptr) | ||||||
| { | { | ||||||
|  |     removeObject(ptr); | ||||||
|  | 
 | ||||||
|     MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); |     MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); | ||||||
|     if(anim) mObjects.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); |     if(anim) mObjects.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue