Skip to content
Snippets Groups Projects
Commit a9a4b7e1 authored by Montjoie Henri's avatar Montjoie Henri
Browse files

merge

parents c418edda bac0407f
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -215,6 +215,7 @@ Case * trouverCase(Carte_Jeu * c, int x, int y){
* \return L'indice de la classe du personnage si le Personnage a été correctement ajouté, -1 sinon.
*/
int ajouterPersonnage(char * nomClasse, int numTab, int numJoueur){
Personnage * p = NULL;
int i;
i=0;
//Recherche de la classe dans le Package
......@@ -226,18 +227,16 @@ int ajouterPersonnage(char * nomClasse, int numTab, int numJoueur){
}
//Création du personnage
Personnage * p = default_personnage(i,packGlobal);
printf("La classe du personnage %d du joueur %d est %s\n", numTab+1, numJoueur, getClasse(p));
p = default_personnage(i,packGlobal);
//Ajout du Personnage à l'équipe du Joueur
switch (numJoueur){
case 1:
setOnFirstJoueur(partieGlobale->participants);
setOnFirstJoueur(getListJoueur(partieGlobale));
break;
case 2:
setOnFirstJoueur(partieGlobale->participants);
nextJoueur(partieGlobale->participants);
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
break;
default:
return -1;
......@@ -269,6 +268,7 @@ int selectionnerCarte(char * nomCarte){
while((strcmp(nomCarte,packGlobal.Cartes_Package[i].nom)!=0)&&(i<nbCartes())){
i++;
}
if(i>=nbCartes()){
return 0;
}
......@@ -276,22 +276,26 @@ int selectionnerCarte(char * nomCarte){
if(initCarte(&packGlobal.Cartes_Package[i],getCarte(partieGlobale),&packGlobal)==0){
return 0;
}
printf("la carte selectionnee est %s\n",nomCarte);
return 1;
}
void initPositions(){
// Positionnement des Personnages sur la Carte_Jeu.
setOnFirstJoueur(partieGlobale->participants);
int i;
setOnFirstJoueur(getListJoueur(partieGlobale));
for(i=0;i<TAILLE_MAX_GROUPE;i++){
printf("test1\n");
setPosition(getCurrentJoueur(partieGlobale->participants)->groupe[i],&partieGlobale->c->Tab_Cases[6+i][0]); //le probleme est ici
printf("test2\n");
setPosition(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),i),&partieGlobale->c->Tab_Cases[6+i][0]);
}
nextJoueur(partieGlobale->participants);
nextJoueur(getListJoueur(partieGlobale));
for(i=0;i<TAILLE_MAX_GROUPE;i++){
setPosition(getCurrentJoueur(partieGlobale->participants)->groupe[i],&partieGlobale->c->Tab_Cases[6+i][HAUT_MAX_CARTE-1]);
setPosition(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),i),&partieGlobale->c->Tab_Cases[6+i][HAUT_MAX_CARTE-1]);
}
return 1;
}
......@@ -27,6 +27,7 @@ Case * trouverCase(Carte_Jeu * c, int x, int y);
int ajouterPersonnage(char * nomClasse, int numTab, int numJoueur);
int selectionnerCarte(char * nomCarte);
void initPositions();
#endif // CONTROLEUR_H
......
......@@ -65,7 +65,7 @@ void setNomJoueur(Joueur * j, char * nom){
* \return Un pointeur vers le Personnage du Joueur a l'indice i dans le tableau groupe, NULL si l'indice n'est pas dans le tableau.
*/
Personnage * getPersonnage(Joueur * j, int i){
if(i<TAILLE_MAX_GROUPE-1){
if(i<TAILLE_MAX_GROUPE){
return j->groupe[i];
}
return NULL;
......
......@@ -10,6 +10,8 @@
#include "carte.h"
#include "Interface.h"
#include "gamePackage.h"
#include "joueur.h"
#include "partie.h"
/*!
......@@ -87,8 +89,6 @@ int main(void)
{
//init_jeu("../resources/Init_jeu.xml");
initJeu();
main_affichage();
......
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