Un jeu de cartes à piper les une dans les autres - retour accueil
git clone git://bebou.netlib.re/pipe-game
Log | Files | Refs | README |
commit 5983505acaf3e4e8b1e558b395862b915bfabdcf parent 568ce0883ece2c4900e64d097e2929c912229aba Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Wed, 22 Jan 2025 17:53:22 +0100 Les arguments fonctionnent !!!! Incroyable, on peut commencer à faire des trucs marrant maintenant Diffstat:
M | interface.c | | | 14 | ++++++++++++-- |
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/interface.c b/interface.c @@ -53,7 +53,8 @@ bool addcardtopile(char* cardname, pile* p, pile **piles) { /*On quitte si l'argument est vide ou s'il contient un espace*/ /* strchr ne fonctionne pas avec utf-8 mais pour le moment rien * ne fonctionne en utf8 alors bon */ - if(cardname[0]=='\0' || strchr(cardname,' ')!=NULL){return false;} + if(cardname[0]=='\0' || strchr(cardname,' ')!=NULL) + return false; if(p->name=="played") addcardtopile("none",piles[PLAYEDARGS],piles); if(p->name=="playedargs" && cardname!="none") @@ -111,9 +112,17 @@ void updatecmd(char* cmd, pile **p) { return; strcat(cmd,"( cat ./"); strcat(cmd,p[PLAYED]->cards[0]); + if(strcmp(p[PLAYEDARGS]->cards[0],"none")!=0) { + strcat(cmd," "); + strcat(cmd,p[PLAYEDARGS]->cards[0]); + } for (int i=1;i<p[PLAYED]->cardCount;i++) { strcat(cmd," | \n./"); strcat(cmd,p[PLAYED]->cards[i]); + if(strcmp(p[PLAYEDARGS]->cards[i],"none")!=0) { + strcat(cmd," "); + strcat(cmd,p[PLAYEDARGS]->cards[i]); + } } strcat(cmd," ) 2> /dev/null\n"); } @@ -291,9 +300,10 @@ int main(int argc, char **argv) { quit=true; break; case 109: + res[strcspn(res, "\n")] = '\0'; if(addcardtopile(res,&args,piles)>0) { for(int i=0;i<=played.cardCount;i++) - { removecardofpile(i,&played,piles); } + removecardofpile(i,&played,piles); curmenu=&hand; } default: