Historique des modifications - Message

Message #6009

Sujet: Need help :p


Type Date Auteur Contenu
Dernière modification 12-02-2009 07:00:40 Magun
bon voila je comprend pas pourquoi cela ne marche plus ...

donc pour résumé jais 2 class pour le moment :
  • EntityManager
  • Entity


tout est géré via des std::list<> ( Entity liste pour EntityManager et std::string liste pour Entity )
la ou ça ne colle pas ses que je veut récupéré l'attribut qui se trouve dans un pointeur de Entity qui se trouve dans EntityManager
donc pour résumé dans le main je fait :

    for(int i = 0; i != entity->getNomberEntity(); i++)
    {
        Entity *get = entity->getEntity(i);
        if(get != NULL)
        {
            cout << "At ID : " << get->getID();
            cout << " thas type is " << get->getTypeName();
            cout << " and attribute is : " << get->getAttribute("Attribute").c_str();//! la ou sa ne marche pas
            cout << endl;
        }
    }

les fonctions :
    Entity*EntityManager::getEntity(int loc)
    {
        if(loc <= ent.size())
        {
            int n = 0;
            for (std::list<Entity>::iterator It = ent.begin() ; It != ent.end() ; It++)
                if(n++ == (loc))
                    return &*It;
        }
    }

    std::string Entity::getAttribute(std::string Ent)
    {
        for (std::list<EntityAttribute>::iterator It = Attribute.begin() ; It != Attribute.end() ; It++)
        {
            std::string cmp = ((EntityAttribute)*It).ent;
            if(Ent == cmp)
            {
                return ((EntityAttribute)*It).att;
                break;
            }
        }
        return 0;//for delete warning "control reaches and of non-void function"
    }

voila donc si je récupère l'attribue d'une Entity* cela me retourne : "this application has request the Runtime to terminate ...." exit 0x03
par contre si je passe par le pointeur de l'initialisation de L'Entity, aucun problème ... ( donc ne viens pas de "return ((EntityAttribute)*It).att;" )

je peut poster tout le code s'il y a besoins
merci d'avance tongue
Création du message 12-02-2009 06:00:06 Magun
bon voila je comprend pas pourquoi cela ne marche plus ...

donc pour résumé jais 2 class pour le moment :
  • EntityManager
  • Entity


tout est géré via des std::list<> ( Entity liste pour EntityManager et std::string liste pour Entity )
la ou ça ne colle pas ses que je veut récupéré l'attribut qui se trouve dans un pointeur de Entity qui se trouve dans EntityManager
donc pour résumé dans le main je fait :

    for(int i = 0; i != entity->getNomberEntity(); i++)
    {
        Entity *get = entity->getEntity(i);
        if(get != NULL)
        {
            cout << "At ID : " << get->getID();
            cout << " thas type is " << get->getTypeName();
            cout << " and attribute is : " << get->getAttribute("Attribute").c_str();//! la ou sa ne marche pas
            cout << endl;
        }
    }

les fonctions :
    Entity*EntityManager::getEntity(int loc)
    {
        if(loc <= ent.size())
        {
            int n = 0;
            for (std::list<Entity>::iterator It = ent.begin() ; It != ent.end() ; It++)
                if(n++ == (loc))
                    return &*It;
        }
    }

    std::string Entity::getAttribute(std::string Ent)
    {
        for (std::list<EntityAttribute>::iterator It = Attribute.begin() ; It != Attribute.end() ; It++)
        {
            std::string cmp = ((EntityAttribute)*It).ent;
            if(Ent == cmp)
            {
                return ((EntityAttribute)*It).att;
                break;
            }
        }
        return 0;//for delete warning "control reaches and of non-void function"
    }

voila donc si je récupère l'attribue d'une Entity* cela me retourne : "this application has request the Runtime to terminate ...." exit 0x03
par contre si je passe par le pointeur de l'initialisation de L'Entity, aucun problème ... ( donc ne viens pas de "return ((EntityAttribute)*It).att;" )

je peut poster tout le code s'il y a besoins
merci d'avance tongue

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
157 invités en ligne
membre en ligne: -
RSS Feed