From 50e1efccf31a4286e5dd7353a06249d0e44aaf45 Mon Sep 17 00:00:00 2001 From: ZaxisFr Date: Thu, 24 Jan 2019 11:58:22 +0100 Subject: [PATCH] Creation fichier score --- p_combinaisons.adb | 12 +++++++++--- p_jeu.adb | 9 +++++---- p_vue_graph.adb | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/p_combinaisons.adb b/p_combinaisons.adb index a9c686f..6d24150 100644 --- a/p_combinaisons.adb +++ b/p_combinaisons.adb @@ -1,5 +1,5 @@ -with sequential_IO; -with text_io; use text_io; +with sequential_IO, p_jeu; +with text_io; use text_io, p_jeu, p_jeu.p_score_io; package body p_combinaisons is @@ -287,8 +287,14 @@ package body p_combinaisons is -- {Génère Fout.txt et foutcont.txt contenant respectivement toutes les solutions et les solutions contigües} f: p_cases_io.file_type; fout, foutcont: text_io.file_type; - + fscore : p_score_io.file_type; begin + begin + open(fscore, IN_FILE,"score"); + exception + when others => create(fscore, IN_FILE, "score"); + end; + close(fscore); open(f, IN_FILE, "CarreGaudi"); CreeVectGaudi(f, V); triVectGaudi(V); diff --git a/p_jeu.adb b/p_jeu.adb index a76fa61..7eb479c 100644 --- a/p_jeu.adb +++ b/p_jeu.adb @@ -34,9 +34,9 @@ package body p_jeu is procedure enregistrerScore(score: in TR_Score) is -- {} => {le score a été enregistré dans le fichier de scores} - f: p_score_io.file_type; + f :p_score_io.file_type; begin - create(f, APPEND_FILE, "score"); + open(f, APPEND_FILE, "score"); write(f, score); close(f); end enregistrerScore; @@ -44,7 +44,8 @@ package body p_jeu is procedure finJeu(abandon: in boolean) is -- {} => {Finit le jeu} begin - if not abandon then enregistrerScore((pseudo, compterPoints)); end if; +-- if not abandon then +enregistrerScore((pseudo, compterPoints));-- end if; delete(fichierJeu); close(fichierSolution); end finJeu; @@ -124,7 +125,7 @@ end Nbscores; while permutation loop permutation := false; for j in reverse i+1..V'last loop - if V(j).score < V(j-1).score then + if V(j).score > V(j-1).score then permut(V(j), V(j-1)); permutation := true; end if; diff --git a/p_vue_graph.adb b/p_vue_graph.adb index 14b47bd..37c1405 100644 --- a/p_vue_graph.adb +++ b/p_vue_graph.adb @@ -211,8 +211,8 @@ package body p_vue_graph is triBullesScores(VScore); fenetre:= DebutFenetre("Scoreboard",500,600); while i <= 10 and i <= VScore'last loop - ajouterTexte(fenetre, "Joueurs" &integer'image(i) , " Joueur : " & VScore(i).pseudo, 50,50 + (50*i),250,130); - ajouterTexte(fenetre, "Score" &integer'image(i) , "Points : " & integer'image(VScore(i).Score), 250,50 + (50*i),3200,130); + ajouterTexte(fenetre, "Joueurs" &integer'image(i) , " Joueur : " & VScore(i).pseudo, 50,50 + (50*i),250,30); + ajouterTexte(fenetre, "Score" &integer'image(i) , "Points : " & integer'image(VScore(i).Score), 250,50 + (50*i),250,30); i := i+1; end loop; ajouterBouton(fenetre, "valider", "Valider", 200 , 560 , 100 , 30);