void Texture::UnBind()
{
    if (name!=-1) {
        texHashTable.Delete (texfilename);
        GFXDeleteTexture(name);
        name = -1;
    }
    //glDeleteTextures(1, &name);
}
void collideTrees::Dec()
{
    refcount--;
    if (refcount == 0) {
        unitColliders.Delete( hash_key );
        for (unsigned int i = 0; i < collideTreesMaxTrees; ++i)
            if (rapidColliders[i])
                delete rapidColliders[i];
        if (colShield)
            delete colShield;
        delete this;
        return;
    }
}
void Texture::FileNotFound(const string &texfilename) {
    // We may need to remove from texHashTable if we found the file but it is a bad one
    texHashTable.Delete (texfilename);

    setbad( texfilename);
    name=-1;
    data = NULL;
    if( original != NULL)
    {
        original->name=-1;
        delete original;
        original=NULL;
    }
    palette=NULL;

    return;
}
示例#4
0
Mesh::Mesh( std::string filename, const Vector &scale, int faction, Flightgroup *fg, bool orig ) : hash_name( filename )
{
    this->convex = false;
    Mesh *cpy = LoadMesh( filename.c_str(), scale, faction, fg, vector< std::string > () );
    if (cpy->orig) {
        LoadExistant( cpy->orig );
        delete cpy;         //wasteful, but hey
        if (orig != false) {
            orig = false;
            std::vector< Mesh* > *tmp = bfxmHashTable.Get( this->orig->hash_name );
            if (tmp && tmp->size() && (*tmp)[0] == this->orig) {
                if (this->orig->refcount == 1) {
                    bfxmHashTable.Delete( this->orig->hash_name );
                    delete tmp;
                    orig = true;
                }
            }
            if (meshHashTable.Get( this->orig->hash_name ) == this->orig) {
                if (this->orig->refcount == 1) {
                    meshHashTable.Delete( this->orig->hash_name );
                    orig = true;
                }
            }
            if (orig) {
                Mesh *tmp = this->orig;
                tmp->orig  = this;
                this->orig = NULL;
                refcount   = 2;
                delete[] tmp;
            }
        }
    } else {
        delete cpy;
        fprintf( stderr, "fallback, %s unable to be loaded as bfxm\n", filename.c_str() );
    }
}
void StarSystem::RemoveStarsystemFromUniverse()
{
    if ( star_system_table.Get( filename ) )
        star_system_table.Delete( filename );
}