Skip to content
Snippets Groups Projects
Commit 9952beb0 authored by ColinDrieu's avatar ColinDrieu
Browse files

Correction de joueurList.c, modification de partie.c

Correction de la fonction deleteNodeJoueurFromList.
Ajout de fonctions dans partie.c
parent 5d2dca80
No related branches found
No related tags found
No related merge requests found
File deleted
File deleted
......@@ -244,7 +244,7 @@ int deleteLastNodeJoueur(ListJoueur *l){
while(!isNextNodeJoueurList(l,l->lastNodeJoueur)){
nextJoueur(l);
}
l->currentNodeJoueur=l->lastNodeJoueur;
l->lastNodeJoueur=l->currentNodeJoueur;
l->currentNodeJoueur->next=NULL;
deleteNodeJoueur(tempNodeJoueur);
return 1;
......@@ -316,22 +316,23 @@ int deleteNodeJoueurFromList(ListJoueur * l, Joueur * j){
NodeJoueur * tempCurrent=l->currentNodeJoueur;
setOnFirstJoueur(l);
while((getCurrentJoueur(l)!=j)&&(!outOfJoueurList(l))){
if(outOfJoueurList(l)){
if(getCurrentJoueur(l)!=j){
return 0;
}
else{
i=deleteLastNodeJoueur(l);
setOnFirstJoueur(l);
return i;
}
nextJoueur(l);
}
if(outOfJoueurList(l)){
if(getCurrentJoueur(l)!=j){
return 0;
}
else{
i=deleteCurrentNodeJoueur(l);
l->currentNodeJoueur=tempCurrent;
i=deleteLastNodeJoueur(l);
setOnFirstJoueur(l);
return i;
}
}
if(getCurrentJoueur(l)==j){
i=deleteCurrentNodeJoueur(l);
l->currentNodeJoueur=tempCurrent;
return i;
}
}
}
return 0;
......
File deleted
......@@ -78,12 +78,13 @@ int getNbTour(Partie * p){
/*!
* \fn int removeParticipant(Partie * p, Joueur * j)
* \brief La fonction retire un Joueur de la Partie.
* \brief La fonction retire un Joueur de la Partie et sauve ces informations.
*
* \param La Partie p a a modifier, le Joueur a retirer.
* \param La Partie p a a modifier, le Joueur a retirer et a sauver.
* \return 1 si le Joueur a ete correctement retire, 0 sinon.
*/
int removeParticipant(Partie * p, Joueur * j){
//A Ajouter : une fonction sauvant les informations du joueur a retire.
return deleteNodeJoueurFromList(p->participants,j);
}
......@@ -150,5 +151,16 @@ int victoire(Partie * p){
return (p->participants->firstNodeJoueur==p->participants->lastNodeJoueur);
}
/*!
* \fn int victoire(Partie * p)
* \brief La fonction sauve les informations necessaires (Joueur) et supprime la partie.
*
* \param La Partie p a modifier
*/
void finPartie(Partie * p){
//A ajouter : une fonction sauvant les informations sur le Joueur.
deletePartie(p);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment