salut!
Voila j'ay crée un programme pour gerer un petit robot. Dans le
principe ce robot est piloté par des ia (dans la classe ia), et une
"entité supérieure" (la classe motiv) est censé gérer le choix de ces
ia à appliquer.
Donc la classe motiv récupère tous les handleur des différents capteurs
pour les garder, ce qui marche, mais quand elle lance l'activation de
l'ia le programme plante en disant :Unhandled exception at 0x00419b86
in ctrl.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
quand je testais les ia seules, celle ci marchaient, mais la plantage quand c'est appelé depuis la classe motiv.
j'aimerais savoir pourquoi ce code marche pas!
(classe motiv)
motiv::motiv(HWND scan, HWND tipia,HWND moteur1,HWND moteur2,HWND
son1,HWND son2,HWND son3,HWND son4,HWND lum,HWND bouss,HWND choix1,
HWND choix2,HWND choix3,HWND choix4,HWND coord1,HWND coord2, HWND
coord3, HWND coord4, HWND fchoix, HWND fcoordchoix,int nid1, int
nid2)
{
ia* botmot = new ia();
this->scan = scan;
this->tipia = tipia;
this->moteur1 = moteur1;
this->moteur2 = moteur2;
this->son1 = son1;
this->son2 = son2;
this->son3 = son3;
this->son4 = son4;
this->lum = lum;
this->bouss = bouss;
this->choix1 = choix1;
this->choix2 = choix2;
this->choix3 = choix3;
this->choix4 = choix4;
this->coord1 = coord1;
this->coord2 = coord2;
this->coord3 = coord3;
this->coord4 = coord4;
this->fchoix = fchoix;
this->fcoordchoix = fcoordchoix;
this->nid1 = nid1;
this->nid2 = nid2;
}
void motiv::init()
{
this->core();
}
bool motiv::core()
{
botmot->activate(botmot);
return true;
}
(classe ia)
bool ia::activate()
{
if (this->on == FALSE)
{
this->on = TRUE;
return 1;
}
else
{
return 0;
}
return 0;
}
j'ai mis que ce qui me semble nécessaire ici, mais si vous avez besoin de plus demandez!
PS: je suis en win32 sans MFC sous visual studio 2005
Merci!