mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 11:26:37 +00:00 
			
		
		
		
	implemented locking/unlocking for doors (can not be invoked by user interaction yet)
This commit is contained in:
		
							parent
							
								
									f3bf46f1a9
								
							
						
					
					
						commit
						459dd82896
					
				
					 4 changed files with 38 additions and 0 deletions
				
			
		|  | @ -50,6 +50,9 @@ namespace MWClass | ||||||
|         ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref = |         ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref = | ||||||
|             ptr.get<ESM::Door>(); |             ptr.get<ESM::Door>(); | ||||||
| 
 | 
 | ||||||
|  |         // TODO check lock
 | ||||||
|  |         // TODO check trap
 | ||||||
|  | 
 | ||||||
|         if (ref->ref.teleport) |         if (ref->ref.teleport) | ||||||
|         { |         { | ||||||
|             // teleport door
 |             // teleport door
 | ||||||
|  | @ -74,6 +77,19 @@ namespace MWClass | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     void Door::lock (const MWWorld::Ptr& ptr, int lockLevel) const | ||||||
|  |     { | ||||||
|  |         if (lockLevel<0) | ||||||
|  |             lockLevel = 0; | ||||||
|  | 
 | ||||||
|  |         ptr.getCellRef().lockLevel = lockLevel; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void Door::unlock (const MWWorld::Ptr& ptr) const | ||||||
|  |     { | ||||||
|  |         ptr.getCellRef().lockLevel = 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     std::string Door::getScript (const MWWorld::Ptr& ptr) const |     std::string Door::getScript (const MWWorld::Ptr& ptr) const | ||||||
|     { |     { | ||||||
|         ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref = |         ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref = | ||||||
|  |  | ||||||
|  | @ -21,6 +21,12 @@ namespace MWClass | ||||||
|                 const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const; |                 const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const; | ||||||
|             ///< Generate action for activation
 |             ///< Generate action for activation
 | ||||||
| 
 | 
 | ||||||
|  |             virtual void lock (const MWWorld::Ptr& ptr, int lockLevel) const; | ||||||
|  |             ///< Lock object
 | ||||||
|  | 
 | ||||||
|  |             virtual void unlock (const MWWorld::Ptr& ptr) const; | ||||||
|  |             ///< Unlock object
 | ||||||
|  | 
 | ||||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; |             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||||
|             ///< Return name of the script attached to ptr
 |             ///< Return name of the script attached to ptr
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -77,6 +77,16 @@ namespace MWWorld | ||||||
|         throw std::runtime_error ("class does not support inserting into a container"); |         throw std::runtime_error ("class does not support inserting into a container"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     void Class::lock (const Ptr& ptr, int lockLevel) const | ||||||
|  |     { | ||||||
|  |         throw std::runtime_error ("class does not support locking"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void Class::unlock (const Ptr& ptr) const | ||||||
|  |     { | ||||||
|  |         throw std::runtime_error ("class does not support unlocking"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     std::string Class::getScript (const Ptr& ptr) const |     std::string Class::getScript (const Ptr& ptr) const | ||||||
|     { |     { | ||||||
|         return ""; |         return ""; | ||||||
|  |  | ||||||
|  | @ -98,6 +98,12 @@ namespace MWWorld | ||||||
|             ///< Insert into a container or throw an exception, if class does not support inserting into
 |             ///< Insert into a container or throw an exception, if class does not support inserting into
 | ||||||
|             /// a container.
 |             /// a container.
 | ||||||
| 
 | 
 | ||||||
|  |             virtual void lock (const Ptr& ptr, int lockLevel) const; | ||||||
|  |             ///< Lock object (default implementation: throw an exception)
 | ||||||
|  | 
 | ||||||
|  |             virtual void unlock (const Ptr& ptr) const; | ||||||
|  |             ///< Unlock object (default implementation: throw an exception)
 | ||||||
|  | 
 | ||||||
|             virtual std::string getScript (const Ptr& ptr) const; |             virtual std::string getScript (const Ptr& ptr) const; | ||||||
|             ///< Return name of the script attached to ptr (default implementation: return an empty
 |             ///< Return name of the script attached to ptr (default implementation: return an empty
 | ||||||
|             /// string).
 |             /// string).
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue