psEntity::~psEntity()
{
    if(handle != 0)
    {
        handle->RemoveCallback();
    }

    // removing state parameters but only if there are no more references
    csHash<StateParameters*, int>::GlobalIterator statIter(statePar.GetIterator());
    StateParameters* sp;

    while(statIter.HasNext())
    {
        sp = statIter.Next();

        if(sp->references == 1)
        {
            delete sp;
        }
        else
        {
            sp->references--;
        }
    }

    statePar.DeleteAll();
}
Beispiel #2
0
psEntity::~psEntity()
{
    if(IsPlaying())
    {
        handle->RemoveCallback();
    }

    // removing state parameters but only if there are no more references
    csHash<EntityState*, uint>::GlobalIterator statIter(states.GetIterator());
    EntityState* entityState;

    while(statIter.HasNext())
    {
        entityState = statIter.Next();

        if(entityState->references == 1)
        {
            delete entityState;
        }
        else
        {
            entityState->references--;
        }
    }

    states.DeleteAll();
}
psEntity::psEntity(psEntity* const& entity)
{
    factoryName = entity->factoryName;
    meshName = entity->meshName;

    statePar = csHash<StateParameters*, int>(entity->statePar);

    // updating statePar references
    csHash<StateParameters*, int>::GlobalIterator statIter(statePar.GetIterator());
    StateParameters* sp;

    while(statIter.HasNext())
    {
        sp = statIter.Next();
        sp->references++;
    }

    active = entity->active;
    when = entity->when;
    state = entity->state;
    id = entity->id;
    handle = 0;

    minMinRange = entity->minMinRange;
    maxMaxRange = entity->maxMaxRange;
    minTimeOfDayStart = entity->minTimeOfDayStart;
    maxTimeOfDayEnd = entity->maxTimeOfDayEnd;
}
Beispiel #4
0
psEntity::psEntity(psEntity* const &entity)
{
    isFactoryEntity = entity->isFactoryEntity;
    entityName = entity->entityName;

    Debug2(LOG_SOUND, 0, "psEntity::psEntity %s",entityName.GetData());

    states = csHash<EntityState*, uint>(entity->states);

    // updating states references
    csHash<EntityState*, uint>::GlobalIterator statIter(states.GetIterator());
    EntityState* entityState;

    while(statIter.HasNext())
    {
        entityState = statIter.Next();
        entityState->references++;
    }

    isActive = entity->isActive;
    when = entity->when;
    state = entity->state;
    id = entity->id;
    handle = 0;
    position = entity->position;

    minRange = entity->minRange;
    maxRange = entity->maxRange;
}