File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ namespace cage
4747			return  get_ (Scheme, assetId).template  cast <T>();
4848		}
4949
50+ 		//  returns true if the asset exists and is successfully loaded
51+ 		bool  check (uint32 assetId) const ;
52+ 
5053		//  end thread-safe methods
5154
5255		void  listen (const  String &address = " localhost"  , uint16 port = 65042 , uint64 listenerPeriod = 100000 );
Original file line number Diff line number Diff line change @@ -587,6 +587,18 @@ namespace cage
587587		return  name++;
588588	}
589589
590+ 	bool  AssetsManager::check (uint32 assetId) const 
591+ 	{
592+ 		CAGE_ASSERT (assetId != 0  && assetId != m);
593+ 		const  AssetsManagerImpl *impl = (const  AssetsManagerImpl *)this ;
594+ 		const  auto  &publicIndex = impl->publicIndex ;
595+ 		ScopeLock lock (impl->publicMutex , ReadLockTag ());
596+ 		auto  it = publicIndex.find (assetId);
597+ 		if  (it == publicIndex.end ())
598+ 			return  false ; //  not found
599+ 		return  !it->second ->failed ;
600+ 	}
601+ 
590602	void  AssetsManager::listen (const  String &address, uint16 port, uint64 listenerPeriod)
591603	{
592604		class  AssetListenerImpl 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments