mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 14:56:44 +00:00 
			
		
		
		
	Remove container scripts before deleting container
This commit is contained in:
		
							parent
							
								
									69ccca490e
								
							
						
					
					
						commit
						271fcb80c6
					
				
					 7 changed files with 9 additions and 2 deletions
				
			
		|  | @ -549,6 +549,8 @@ namespace MWBase | |||
| 
 | ||||
|             /// Return the distance between actor's weapon and target's collision box.
 | ||||
|             virtual float getHitDistance(const MWWorld::Ptr& actor, const MWWorld::Ptr& target) = 0; | ||||
| 
 | ||||
|             virtual void removeContainerScripts(const MWWorld::Ptr& reference) = 0; | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -77,6 +77,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Container>(); | ||||
|         if (ref->mBase->mFlags & ESM::Container::Respawn) | ||||
|         { | ||||
|             MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); | ||||
|             ptr.getRefData().setCustomData(NULL); | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -762,6 +762,7 @@ namespace MWClass | |||
|                 // Reset to original position
 | ||||
|                 ptr.getRefData().setPosition(ptr.getCellRef().getPosition()); | ||||
| 
 | ||||
|                 MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); | ||||
|                 ptr.getRefData().setCustomData(NULL); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -1224,6 +1224,7 @@ namespace MWClass | |||
|                 // Reset to original position
 | ||||
|                 ptr.getRefData().setPosition(ptr.getCellRef().getPosition()); | ||||
| 
 | ||||
|                 MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); | ||||
|                 ptr.getRefData().setCustomData(NULL); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -1127,6 +1127,7 @@ namespace MWScript | |||
|                     { | ||||
|                         MWBase::Environment::get().getWorld()->undeleteObject(ptr); | ||||
|                         // resets runtime state such as inventory, stats and AI. does not reset position in the world
 | ||||
|                         MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); | ||||
|                         ptr.getRefData().setCustomData(NULL); | ||||
|                     } | ||||
|                 } | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ namespace MWWorld | |||
|             void remove (RefData *ref); | ||||
| 
 | ||||
|             void remove (const Ptr& ptr); | ||||
|             ///< Remove script for given reference (ignored if reference does not have a scirpt listed).
 | ||||
|             ///< Remove script for given reference (ignored if reference does not have a script listed).
 | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -129,8 +129,9 @@ namespace MWWorld | |||
|             void updateWindowManager (); | ||||
|             void updatePlayer(bool paused); | ||||
|             MWWorld::Ptr getFacedObject(float maxDistance, bool ignorePlayer=true); | ||||
| 
 | ||||
|     public: // FIXME
 | ||||
|             void removeContainerScripts(const Ptr& reference); | ||||
|     private: | ||||
|             void addContainerScripts(const Ptr& reference, CellStore* cell); | ||||
|             void PCDropped (const Ptr& item); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue