void BonusTile::HandleTimers(sf::Int32 diff_time)
{
    if (IsRemoved())
        return;

    SpecialTile::HandleTimers(diff_time);
}
bool
SdfNamespaceEdit_Namespace::_Node::Remove(std::string* whyNot)
{
    if (!TF_VERIFY(!IsRemoved())) {
        *whyNot = "Coding error: Node has no parent";
        return false;
    }
    if (!TF_VERIFY(_parent)) {
        *whyNot = "Coding error: Removing root";
        return false;
    }

    _Children::iterator i = _parent->_children->find(*this);
    if (!TF_VERIFY(i != _parent->_children->end())) {
        *whyNot = "Coding error: Node not found under parent";
        return false;
    }

    // Release the node from the parent.  After this call node is not
    // owned by any object.
    if (!TF_VERIFY(_parent->_children->release(i).release() == this)) {
        *whyNot = "Coding error: Found wrong node by key";

        // Try to recover.
        _parent->_children->insert(this);
        return false;
    }

    _parent = NULL;
    return true;
}
CSeq_align_Handle::CSeq_align_Handle(const CSeq_annot_Handle& annot,
                                     TIndex index)
    : m_Annot(annot),
      m_AnnotIndex(index)
{
    _ASSERT(!IsRemoved());
    _ASSERT(annot.x_GetInfo().GetInfo(index).IsAlign());
}
Beispiel #4
0
 template<typename VALUE_T>uint32_t
 Document_t<VALUE_T>::GetObjectSize(uint32_t pos) const
 {
     uint32_t size = 0;
     for (uint32_t idx = 0; idx < GetObjectSpace(pos); ++idx)
         if (!IsRemoved(GetObject(pos, idx))) ++size;
     return size;
 }
Beispiel #5
0
bool TEffect::ApplyInternal(bass_p pChannel)
{
	if (IsRemoved()) return false;
	bUpdated = true;

	iErrorCode = BASS_OK;

	if (eType == BASS_FX_UNKNOWN)
	{
		iErrorCode = BASS_ERROR_ILLPARAM;
		return false;
	}

	if (pChannel == BASS_NULL)
	{
		iErrorCode = BASS_ERROR_HANDLE;
		return false;
	}

	bass_p pOldChannel = this->pChannel;

	if (pOldChannel != pChannel)
	{
		this->pChannel = pChannel;

		if (pOldChannel != BASS_NULL && pFX != BASS_NULL)
		{
			BASS_ChannelRemoveFX(pOldChannel, pFX);
			pFX = BASS_NULL;
		}
	}
	else
	{
		if (pFX != BASS_NULL && bEnabled)
		{
			return true;
		}
	}

	if (!bEnabled)
	{
		RemoveFX();
		return true;
	}

	pFX = BASS_ChannelSetFX(pChannel, eType, 0);
	iErrorCode = BASS_ErrorGetCode();

	if (iErrorCode != BASS_OK)
	{
		RemoveFX();
		return false;
	}

	UpdateInternal();
	ResetInternal();
	return true;
}
Beispiel #6
0
bool TEffect::IsValid()
{
	lock_guard<mutex> Lock(MutexLock);

	if (eType == BASS_FX_UNKNOWN) return false;
	if (IsRemoved()) return false;

	return true;
}
ECode FilePreferencesImpl::FlushSpi() /*throws BackingStoreException*/
{
    // try {
    //if removed, return
    if(IsRemoved()){
        return NOERROR;
    }
    // reload
    AutoPtr<IProperties> currentPrefs;
    if (FAILED(XMLParser::ReadXmlPreferences(mPrefsFile, (IProperties**)&currentPrefs))) {
        return E_BACKING_STORE_EXCEPTION;
    }
    // merge
    AutoPtr<IIterator> it;
    mRemoved->GetIterator((IIterator**)&it);
    Boolean has = FALSE;
    while (it->HasNext(&has), has) {
        AutoPtr<IInterface> value;
        it->GetNext((IInterface**)&value);
        IMap::Probe(currentPrefs)->Remove(value);
    }
    IMap::Probe(mRemoved)->Clear();

    it = NULL;
    mUpdated->GetIterator((IIterator**)&it);
    while (it->HasNext(&has), has) {
        AutoPtr<IInterface> key;
        it->GetNext((IInterface**)&key);

        AutoPtr<IInterface> value;
        IMap::Probe(mPrefs)->Get(key, (IInterface**)&value);
        IMap::Probe(currentPrefs)->Put(key, value);
    }
    IMap::Probe(mUpdated)->Clear();
    // flush
    mPrefs = currentPrefs;
    if (FAILED(XMLParser::WriteXmlPreferences(mPrefsFile, mPrefs))) {
        return E_BACKING_STORE_EXCEPTION;
    }
    return NOERROR;
    // } catch (Exception e) {
    //     // throw new BackingStoreException(e);
    //     return E_BACKING_STORE_EXCEPTION;
    // }
}
void BonusTile::Update()
{
    if (IsRemoved())
        return;

    if (GAME_STATE_PAUSED(sGame.GetGameState()))
    {
        Draw(animationFinished ? &imageUsed : NULL, true);
        return;
    }

    SpecialTile::Update();

    if (isUsed && animating && !animationFinished)
    {
        animating = true;

        if (movingUp)
        {
            SetPositionY(GetPositionY() - 9.0f);

            if (GetPositionY() < startPosition.y - 40.0f)
                movingUp = false;
        }
        else
        {
            SetPositionY(GetPositionY() + 9.0f);

            if (GetPositionY() >= startPosition.y)
            {
                SetPositionY(startPosition.y);
                movingUp = true;
                animating = false;
                animationFinished = true;
                sf::Texture imageCoin;
                imageCoin.loadFromFile("Graphics/Tiles/coin_gold.png");

                switch (urand(0, 1))
                {
                    case 0:
                        sGame.AddCoin(new Coin(window, sf::Vector2f(GetPositionX(), GetPositionY() - 70.0f), imageCoin));
                        break;
                    case 1:
                        sGame.AddCoin(new Coin(window, sf::Vector2f(GetPositionX(), GetPositionY() - 70.0f), imageCoin));
                        break;
                    default:
                        std::cout << "Typo in BonusTile::Update switch (urand)" << std::endl;
                        break;
                }
            }
        }
    }

    if (sf::Keyboard::isKeyPressed(sf::Keyboard::F2))
    {
        SetPosition(startPosition.x, startPosition.y);
        animationFinished = false;
        movingUp = true;
    }

    Draw(animationFinished ? &imageUsed : NULL, true);
}
void CSeq_align_Handle::x_RealReplace(const CSeq_align& new_obj) const
{
    GetAnnot().GetEditHandle().x_GetInfo().Replace(m_AnnotIndex, new_obj);
    _ASSERT(!IsRemoved());
}
Beispiel #10
0
void CSeq_align_Handle::x_RealRemove(void) const
{
    GetAnnot().GetEditHandle().x_GetInfo().Remove(m_AnnotIndex);
    _ASSERT(IsRemoved());
}