Ejemplo n.º 1
0
void UKillQuestObjective::EnemyKilled(AMech_RPGCharacter* character)
{
	if (character->GetClass()->IsChildOf(killClass) && !IsComplete()) {
		kills += 1;
		NotifyQuest();
	}
	else if (IsComplete()) {
		character->GetGroup()->OnGroupEnemyKilled.RemoveDynamic(this, &UKillQuestObjective::EnemyKilled);
	}
}
Ejemplo n.º 2
0
ResourceBufferHandle ResourceStream::AcquireBufferHandle() {
	ASSERT(IsComplete());

	if (!IsComplete()) {
        ResourceBufferHandle handle;
        
        return handle;
	}
    
    ResourceBufferHandle handle(this, m_FrontBuffer->path, m_FrontBuffer->data, m_FrontBuffer->size, m_FrontBuffer->error, m_FrontBuffer->type);

	m_FrontBuffer->status = kResourceBufferProgress;

	return handle;
}
Ejemplo n.º 3
0
bool
WebGLTexture::GetFakeBlackType(const char* funcName, uint32_t texUnit,
                               FakeBlackType* const out_fakeBlack)
{
    const char* incompleteReason;
    bool initFailed = false;
    if (!IsComplete(funcName, texUnit, &incompleteReason, &initFailed)) {
        if (initFailed) {
            mContext->ErrorOutOfMemory("%s: Failed to initialize texture data.",
                                       funcName);
            return false; // The world just exploded.
        }

        if (incompleteReason) {
            mContext->GenerateWarning("%s: Active texture %u for target 0x%04x is"
                                      " 'incomplete', and will be rendered as"
                                      " RGBA(0,0,0,1), as per the GLES 2.0.24 $3.8.2: %s",
                                      funcName, texUnit, mTarget.get(),
                                      incompleteReason);
        }
        *out_fakeBlack = FakeBlackType::RGBA0001;
        return true;
    }


    *out_fakeBlack = FakeBlackType::None;
    return true;
}
Ejemplo n.º 4
0
/*!	Reassembles the fragments to the specified buffer \a to.
	This buffer must have been added via AddFragment() before.
*/
status_t
FragmentPacket::Reassemble(net_buffer* to)
{
	if (!IsComplete())
		return B_ERROR;

	net_buffer* buffer = NULL;

	net_buffer* fragment;
	while ((fragment = fFragments.RemoveHead()) != NULL) {
		if (buffer != NULL) {
			status_t status;
			if (to == fragment) {
				status = gBufferModule->merge(fragment, buffer, false);
				buffer = fragment;
			} else
				status = gBufferModule->merge(buffer, fragment, true);
			if (status != B_OK)
				return status;
		} else
			buffer = fragment;
	}

	if (buffer != to)
		panic("ipv6 packet reassembly did not work correctly.");

	to->index = fIndex;
		// reset the buffer's device index

	return B_OK;
}
Ejemplo n.º 5
0
 void NotifyIfComplete()
 {
   if (IsComplete())
   {
     Complete.notify_all();
   }
 }
Ejemplo n.º 6
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDmeSingleIndexedComponent::GetComponents( CUtlVector< int > &components, CUtlVector< float > &weights ) const
{
	if ( IsComplete() )
	{
		const int nComponents = Count();

		int *pComponents = reinterpret_cast< int * >( alloca( nComponents * sizeof( int ) ) );
		float *pWeights = reinterpret_cast< float * >( alloca( nComponents * sizeof( float ) ) );

		for ( int i = 0; i < nComponents; ++i )
		{
			pComponents[ i ] = i;
			pWeights[ i ] = 1.0f;
		}

		components.CopyArray( pComponents, nComponents );
		weights.CopyArray( pWeights, nComponents );
	}
	else
	{
		components.RemoveAll();
		components.CopyArray( m_Components.Base(), m_Components.Count() );

		weights.RemoveAll();
		weights.CopyArray( m_Weights.Base(), m_Weights.Count() );
	}
}
Ejemplo n.º 7
0
void XSlideInOut::Draw( void )
{
	if( IsComplete() )
		return;
	if( m_nType == 1 )
	{
		// m_nXPos를 중심으로 좌측에 이전 화면을 찍는다.
		GetpSurface1()->Draw( (float)m_nXPos - GetpSurface1()->GetWidth(), 0.f );
		// m_nXPos를 중심으로 우측에 새 화면을 찍는다.
		GetpSurface2()->Draw( (float)m_nXPos, 0.f );
		m_nXPos -= m_nSpeed;
		if( m_nXPos <= 0 )				// 화면 왼쪽까지 다 이동했으면 완료
			SetComplete( TRUE );
	} else 
	{
		// m_nXPos를 중심으로 좌측에 새 화면을 찍는다.
		GetpSurface2()->Draw( (float)m_nXPos - GetpSurface1()->GetWidth(), 0.f );
		// m_nXPos를 중심으로 우측에 이전 화면을 찍는다.
		GetpSurface1()->Draw( (float)m_nXPos, 0 );
		m_nXPos += m_nSpeed;
		if( m_nXPos >= XE::GetGameWidth() )				// 화면 왼쪽까지 다 이동했으면 완료
			SetComplete( TRUE );		
	}
	XTransition::Draw();
}
Ejemplo n.º 8
0
//
/// The next group is repeated X times
//
TPicResult
TPXPictureValidator::Iteration(LPTSTR input, uint termCh, uint& i, uint& j)
{
  TPicResult rslt;
  uint newTermCh;

  i++;  // Skip '*'

  // Retrieve number

  uint itr = 0;
  for (; _istdigit((tchar)Pic[i]); i++)
    itr = itr * 10 + Pic[i] - _T('0');

  if (i >= termCh)
    return prSyntax;

  newTermCh = CalcTerm(termCh, i);

  //
  // if itr is 0 allow any number, otherwise enforce the number
  //
  uint k = i;
  if (itr) {
    for (uint m = 0; m < itr; m++) {
      i = k;
      rslt = Process(input, newTermCh, i, j);
      if (!IsComplete(rslt)) {
        if (rslt == prEmpty)  // Empty means incomplete since all are required
          rslt = prIncomplete;
        return rslt;
      }
    }
  }
  else {
    do {
      i = k;
      rslt = Process(input, newTermCh, i, j);
    } while (IsComplete(rslt));
    if (rslt == prEmpty || rslt == prError) {
      i++;
      rslt = prAmbiguous;
    }
  }
  i = newTermCh;
  return rslt;
}
Ejemplo n.º 9
0
///Do a modular part of the task.  For example, if the task is to load the entire file, load one BlockFile.
///Relies on DoSomeInternal(), which is the subclasses must implement.
///@param amountWork the percent amount of the total job to do.  1.0 represents the entire job.  the default of 0.0
/// will do the smallest unit of work possible
void ODTask::DoSome(float amountWork)
{
   mBlockUntilTerminateMutex.Lock();

   printf("%s %i subtask starting on new thread with priority\n", GetTaskName(),GetTaskNumber());

   mDoingTask=mTaskStarted=true;
   
   float workUntil = amountWork+PercentComplete();
   
   if(workUntil<PercentComplete())
      workUntil = PercentComplete();
   
   //check periodically to see if we should exit.
   mTerminateMutex.Lock();
   if(mTerminate)
   {
      mBlockUntilTerminateMutex.Unlock();
      mTerminateMutex.Unlock();
      return;
   }  
   mTerminateMutex.Unlock();

   Update();   
   
   //Do Some of the task.
   
   mTerminateMutex.Lock();
   while(PercentComplete() < workUntil && PercentComplete() < 1.0 && !mTerminate)
   {
      wxThread::This()->Yield();
      //release within the loop so we can cut the number of iterations short
      mTerminateMutex.Unlock();
      //TODO: check to see if ondemand has been called
      if(false)
         ODUpdate();
      DoSomeInternal();
      
      //But add the mutex lock back before we check the value again.
      mTerminateMutex.Lock();
   }
   mTerminateMutex.Unlock();
   mDoingTask=false;
   
   mTerminateMutex.Lock();
   //if it is not done, put it back onto the ODManager queue.
   if(!IsComplete() && !mTerminate)
   {
      ODManager::Instance()->AddTask(this);
      printf("%s %i is %f done\n", GetTaskName(),GetTaskNumber(),PercentComplete());
   }
   else
   {
      printf("%s %i complete\n", GetTaskName(),GetTaskNumber());
   }
   mTerminateMutex.Unlock();
   mBlockUntilTerminateMutex.Unlock();
   
}
Ejemplo n.º 10
0
	inline float FractionComplete() const
	{
		if(IsComplete())
		{
			return 1.0f;
		}
		return  mTimeElapsed/mDuration;
	}
void FBuildPatchInstaller::ExecuteCompleteDelegate()
{
    // Should be executed in main thread, and already be complete
    check( IsInGameThread() );
    check( IsComplete() );
    // Call the complete delegate
    OnCompleteDelegate.Execute( bSuccess, NewBuildManifest );
}
Ejemplo n.º 12
0
 bool SbpRecvPack::Next()
 {
     ESS_ASSERT(IsComplete());
     
     if (m_currFrameIndex == (m_packInfo->Count() - 1)) return false;
     
     ++m_currFrameIndex;
     return true;
 }
Ejemplo n.º 13
0
void CAnimateProduct::Stop()
{
	if (!IsComplete())
		m_bRequestWait = false;
	else if (m_pPlayingAnimate && m_pSprite)
	{
		m_pSprite->stopAction(m_pPlayingSeq);
		OnPlayEnd(true);
	}
}
bool MoertelT::MOERTEL_TEMPLATE_CLASS(InterfaceT)::BuildNormals()
{
  //-------------------------------------------------------------------
  // interface needs to be complete
  if (!IsComplete()) {
    if (gcomm_->getRank() == 0)
      std::cout << "***ERR*** MoertelT::Interface::Project:\n"
                << "***ERR*** Complete() not called on interface " << Id_
                << "\n"
                << "***ERR*** file/line: " << __FILE__ << "/" << __LINE__
                << "\n";
    return false;
  }

  //-------------------------------------------------------------------
  // send all procs not member of this interface's intra-comm out of here
  if (lcomm_ == Teuchos::null) return true;

  //-------------------------------------------------------------------
  // interface segments need to have at least one function on each side
  std::map<int, Teuchos::RCP<MoertelT::SEGMENT_TEMPLATE_CLASS(SegmentT)>>::
      iterator curr;
  for (int side = 0; side < 2; ++side)
    for (curr = rseg_[side].begin(); curr != rseg_[side].end(); ++curr) {
      if (curr->second->Nfunctions() < 1) {
        std::cout << "***ERR*** MoertelT::Interface::Project:\n"
                  << "***ERR*** interface " << Id_ << ", mortar side\n"
                  << "***ERR*** segment " << curr->second->Id()
                  << " needs at least 1 function set\n"
                  << "***ERR*** file/line: " << __FILE__ << "/" << __LINE__
                  << "\n";
        return false;
      }
    }

  //-------------------------------------------------------------------
  // build nodal normals on both sides
  std::map<int, Teuchos::RCP<MoertelT::MOERTEL_TEMPLATE_CLASS(NodeT)>>::iterator
      ncurr;

  for (int side = 0; side < 2; ++side)

    for (ncurr = rnode_[side].begin(); ncurr != rnode_[side].end(); ++ncurr) {
#if 0
      std::cout << "side " << side << ": " << *(ncurr->second);
#endif
      ncurr->second->BuildAveragedNormal();
#if 0
      std::cout << "side " << side << ": " << *(ncurr->second);
#endif

    }  // for(ncurr ...)

  return true;
}
Ejemplo n.º 15
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDmeSingleIndexedComponent::RemoveComponent( int component )
{
	Assert( !IsComplete() );	// TODO: Convert from complete to complete - component

	const int cIndex = BinarySearch( component );
	if ( cIndex >= m_Components.Count() || m_Components[ cIndex ] != component )	// Component not in selection
		return;

	m_Components.Remove( cIndex );
	m_Weights.Remove( cIndex );
}
Ejemplo n.º 16
0
 std::string SbpRecvPack::ToString() const
 {
     ESS_ASSERT(IsComplete());
     
     std::string res("Received packet begin:");
     res += "\n";
     res += m_packInfo->ConvertToString();
     res += "Received packet end.";
     res += "\n";
     
     return res;
 }
Ejemplo n.º 17
0
void UQuestObjective::NotifyQuest(){
	if (GetQuest() != NULL){
		GetQuest()->ObjectiveUpdated(this);
	}

	if (OnObjectiveCompleted.IsBound() && IsComplete()){
		OnObjectiveCompleted.Broadcast(this);
	}
	else if (OnObjectiveUpdated.IsBound()){
		OnObjectiveUpdated.Broadcast(this);
	}
}
Ejemplo n.º 18
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDmeSingleIndexedComponent::Intersection( const CDmeSingleIndexedComponent &rhs )
{
	const int nLhs = Count();
	const int nRhs = rhs.Count();

	int l = 0;
	int r = 0;

	if ( IsComplete() )
	{
		// TODO
		Assert( 0 );
	}
	else
	{
		CUtlVector< int > newComponents;
		newComponents.EnsureCapacity( nLhs );
		CUtlVector< float > newWeights;
		newWeights.EnsureCapacity( nLhs );

		while ( l < nLhs || r < nRhs )
		{
			// In LHS but not RHS
			while ( l < nLhs && ( r >= nRhs || m_Components[ l ] < rhs.m_Components[ r ] ) )
			{
				++l;
			}

			// In RHS but not LHS
			while ( r < nRhs && ( l >= nLhs || m_Components[ l ] > rhs.m_Components[ r ] ) )
			{
				++r;
			}

			// In Both LHS & RHS
			while ( l < nLhs && r < nRhs && m_Components[ l ] == rhs.m_Components[ r ] )
			{
				newComponents.AddToTail( m_Components[ l ] );
				newWeights.AddToTail( m_Weights[ l ] );
				++l;
				++r;
			}
		}

		m_Components.CopyArray( newComponents.Base(), newComponents.Count() );
		m_Weights.CopyArray( newWeights.Base(), newWeights.Count() );
	}

	m_CompleteCount.Set( 0 );
	m_bComplete.Set( false );
}
Ejemplo n.º 19
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
bool CDmeSingleIndexedComponent::HasComponent( int component ) const
{
	if ( IsComplete() )
		return true;

	const int cIndex = BinarySearch( component );
	if ( cIndex >= m_Components.Count() )
		return false;

	if ( m_Components[ cIndex ] == component )
		return true;

	return false;
}
Ejemplo n.º 20
0
EXPORT_C void CMdEQuery::Cancel()
    {
    // is query incomplete before canceling
    TBool incomplete = !IsComplete();
    
    if( incomplete )
    	{
    	DoCancel();
    	}

	if( iConditions )
		{		
    	iConditions->SetLocked( EFalse );
		}
    
    if( incomplete || IsComplete() == EFalse )
    	{
    	iState = EStateError;
    	if( !iDestroyed )
    	    {
            NotifyCompleted( KErrCancel );
    	    }
    	}
    }
Ejemplo n.º 21
0
void
StyleSheet::SetEnabled(bool aEnabled)
{
  // Internal method, so callers must handle BeginUpdate/EndUpdate
  bool oldDisabled = mDisabled;
  mDisabled = !aEnabled;

  if (IsComplete() && oldDisabled != mDisabled) {
    EnabledStateChanged();

    if (mDocument) {
      mDocument->SetStyleSheetApplicableState(this, !mDisabled);
    }
  }
}
Ejemplo n.º 22
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
bool CDmeSingleIndexedComponent::GetWeight( int component, float &weight ) const
{
	Assert( !IsComplete() );

	const int cIndex = BinarySearch( component );
	if ( cIndex >= m_Components.Count() )
		return false;

	if ( m_Components[ cIndex ] == component )
	{
		weight = m_Weights[ cIndex ];
		return true;
	}

	return false;
}
Ejemplo n.º 23
0
/**
 * Function to save the result of provisioning.
 *
 * @param[in,out] otmCtx   Context value of ownership transfer.
 * @param[in] res   result of provisioning
 */
static void SetResult(OTMContext_t* otmCtx, const OCStackResult res)
{
    OC_LOG_V(DEBUG, TAG, "IN SetResult : %d ", res);

    if(!otmCtx)
    {
        OC_LOG(WARNING, TAG, "OTMContext is NULL");
        return;
    }

    if(otmCtx->selectedDeviceInfo)
    {
        for(size_t i = 0; i < otmCtx->ctxResultArraySize; i++)
        {
            if(memcmp(otmCtx->selectedDeviceInfo->doxm->deviceID.id,
                      otmCtx->ctxResultArray[i].deviceId.id, UUID_LENGTH) == 0)
            {
                otmCtx->ctxResultArray[i].res = res;
                if(OC_STACK_OK != res)
                {
                    otmCtx->ctxHasError = true;
                }
            }
        }

        g_otmCtx = NULL;

        //If all request is completed, invoke the user callback.
        if(IsComplete(otmCtx))
        {
            otmCtx->ctxResultCallback(otmCtx->userCtx, otmCtx->ctxResultArraySize,
                                       otmCtx->ctxResultArray, otmCtx->ctxHasError);
            OICFree(otmCtx->ctxResultArray);
            OICFree(otmCtx);
        }
        else
        {
            if(OC_STACK_OK != StartOwnershipTransfer(otmCtx,
                                                     otmCtx->selectedDeviceInfo->next))
            {
                OC_LOG(ERROR, TAG, "Failed to StartOwnershipTransfer");
            }
        }
    }

    OC_LOG(DEBUG, TAG, "OUT SetResult");
}
Ejemplo n.º 24
0
void CAnimateProduct::SetSprite(CSpriteProduct* pSpritePro, bool bNullRemove)
{
	if (pSpritePro)
	{
		m_pSpritePro = pSpritePro;
		if (IsComplete() && m_pSpritePro->IsComplete())
			m_pSprite = m_pSpritePro->GetSprite();
		m_pSpritePro->AddAnimate(this);
	}
	else
	{
		m_pSprite = NULL;
		if (m_pSpritePro && bNullRemove)
			m_pSpritePro->RemoveAnimate(GetName());
		m_pSpritePro = NULL;
	}
}
Ejemplo n.º 25
0
NS_IMETHODIMP
nsHtml5Parser::Terminate()
{
  // We should only call DidBuildModel once, so don't do anything if this is
  // the second time that Terminate has been called.
  if (mExecutor->IsComplete()) {
    return NS_OK;
  }
  // XXX - [ until we figure out a way to break parser-sink circularity ]
  // Hack - Hold a reference until we are completely done...
  nsCOMPtr<nsIParser> kungFuDeathGrip(this);
  nsRefPtr<nsHtml5StreamParser> streamKungFuDeathGrip(mStreamParser);
  nsRefPtr<nsHtml5TreeOpExecutor> treeOpKungFuDeathGrip(mExecutor);
  if (mStreamParser) {
    mStreamParser->Terminate();
  }
  return mExecutor->DidBuildModel(true);
}
// Connect to BVH server (for e.g. Axis Neuron SW)
bool APerceptionNeuronController::Connect(FString HostName, int32 Port)
{
	if (bConnected == true)
		return false;

	// Set up reference bone handling
	// Template does not support transition for the reference bone yet
	// Should be no problem, because normally reference bone does not change values.
	if (bReference == true)
	{
		// Skip reference bone x,y,z translation and x,y,z rotation 
		// regardless if displacement is active or not (Axis Neuron sends always 6 floats)
		FloatSkip = 6; 
	}

	// Create TCP Socket and connect
	ISocketSubsystem* const SocketSubSystem = ISocketSubsystem::Get(); 
	if (SocketSubSystem)
	{
		ReceiverSocket = SocketSubSystem->CreateSocket(NAME_Stream, TEXT("PerceptionNeuronSocket"), false);
		if (ReceiverSocket == NULL)
			return false;
	
		auto ResolveInfo = SocketSubSystem->GetHostByName(TCHAR_TO_ANSI(*HostName));
		while (!ResolveInfo->IsComplete());

		if (ResolveInfo->GetErrorCode() == 0)
		{
			const FInternetAddr* Addr = &ResolveInfo->GetResolvedAddress();
			uint32 IP;
			Addr->GetIp(IP);
			
			TSharedRef<FInternetAddr> InetAddr = SocketSubSystem->CreateInternetAddr();
			InetAddr->SetIp(IP);
			InetAddr->SetPort(Port);

			bConnected = ReceiverSocket->Connect(*InetAddr);
		}
	}

	return bConnected;
}
Ejemplo n.º 27
0
/*----------------------------------------------------------------------*
 | do projection of nodes on master and slave side                      |
 *----------------------------------------------------------------------*/
bool MOERTEL::Interface::ProjectNodes_Orthogonal()
{ 
  if (!IsComplete())
  {
	std::stringstream oss;
    oss << "***ERR*** MOERTEL::Interface::ProjectNodes_Orthogonal:\n"
         << "***ERR*** Complete() not called on interface " << Id() << "\n"
         << "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
	throw ReportError(oss);
  }
  if (!lComm()) return true;

  // project the master nodes onto the slave surface orthogonaly
  ProjectNodes_MastertoSlave_Orthogonal();

  // project the slave nodes onto the master surface orthogonal to adjacent slave segment
  ProjectNodes_SlavetoMaster_Orthogonal();  
  
  return true;
}
Ejemplo n.º 28
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
bool CDmeSingleIndexedComponent::GetComponent( int index, int &component, float &weight ) const
{
	if ( index < Count() )
	{
		if ( IsComplete() )
		{
			component = index;
			weight = 1.0f;
		}
		else
		{
			component = m_Components[ index ];
			weight = m_Weights[ index ];
		}

		return true;
	}

	return false;
}
bool MoertelT::MOERTEL_TEMPLATE_CLASS(InterfaceT)::ProjectNodes_Orthogonal()
{
  if (!IsComplete()) {
    std::stringstream oss;
    oss << "***ERR*** MoertelT::Interface::ProjectNodes_Orthogonal:\n"
        << "***ERR*** Complete() not called on interface " << Id() << "\n"
        << "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
    throw MoertelT::ReportError(oss);
  }
  if (lcomm_ == Teuchos::null) return true;

  // project the master nodes onto the slave surface orthogonaly
  ProjectNodes_MastertoSlave_Orthogonal();

  // project the slave nodes onto the master surface orthogonal to adjacent
  // slave segment
  ProjectNodes_SlavetoMaster_Orthogonal();

  return true;
}
bool MoertelT::MOERTEL_TEMPLATE_CLASS(InterfaceT)::ProjectNodes_NormalField()
{
  if (!IsComplete()) {
    std::stringstream oss;
    oss << "***ERR*** MoertelT::Interface::ProjectNodes_NormalField:\n"
        << "***ERR*** Complete() not called on interface " << Id() << "\n"
        << "***ERR*** file/line: " << __FILE__ << "/" << __LINE__ << "\n";
    throw MoertelT::ReportError(oss);
  }
  if (lcomm_ == Teuchos::null) return true;

  // project the slave nodes onto the master surface along the slave normal
  // field
  ProjectNodes_SlavetoMaster_NormalField();

  // project the master nodes ontp the slave surface along slave's normal field
  ProjectNodes_MastertoSlave_NormalField();

  return true;
}