Esempio n. 1
0
double CScript::DelCollection(const char* cmd, char* retStr)
{
    if(p_SrcShape == NULL) return 0;

    double ret = 0;
    char *pGuidName = GetStringParam( cmd, 0 );
    if (NULL == pGuidName)
    {
        return ret;
    }
    CGUID guid = GetVariableList()->GetGuidValue(pGuidName);

    if( guid == NULL_GUID )
    {
        M_FREE( pGuidName, sizeof(char)*MAX_VAR_LEN );
        return ret;
    }

    CServerRegion* pRegion = reinterpret_cast<CServerRegion*>( p_SrcShape -> GetFather() );
    CShape* pShape = NULL;
    if( pRegion )
        pShape = dynamic_cast<CShape*>( pRegion -> FindChildObject( TYPE_COLLECTION, guid) );
    if( pRegion && pShape )
    {
        pRegion->DelShapeToAround(pShape);

        pRegion->DeleteChildObject(pShape);
        ret = 1;
    }

    M_FREE( pGuidName, sizeof(char)*MAX_VAR_LEN );
    return 1;
}