/* traitement d'une enchere */ void traitement_enchere(char *name, int coups){ pthread_mutex_lock(&mutex_clients); client_list *cl = get_client(clients, name); if(cl->proposition != -1 && coups >= cl->proposition){ /* Echec si un joueur essaye d'encherir une valeur plus grande que celle qu'il a déjà encheri */ echec(cl->socket, name); }else{ client_list *aux = clients; int bool = 0; char *user_incoherent; /* Vérification qu'il n'existe pas une enchere de même valeur */ while(aux != NULL){ if(aux->proposition == coups){ user_incoherent = aux->name; bool = 1; break; } aux = aux->next; } if(bool == 1){ /* Echec */ echec(cl->socket, user_incoherent); }else{
void erreur( int bits, double exact, double approx ) { if (exact==0) { echec(1,"division par 0") ; } int erreur = arrondi(resolution_*(exact-approx)/exact) ; if (erreur<0) { erreur = -erreur ; } std::cout <<std::right<<std::setw(2)<<bits<<" bits : " <<std::left<<exact<<" ~ "<<approx <<" ("<<erreur<<"/"<<resolution_<<")" ; }
void enregistre( Testeur * t ) { if (indice_==taille_) { echec(2,"trop de testeurs") ; } testeurs_[indice_++] = t ; }
void acquiere( Testeur * pt ) { if (indice_==taille_) { echec(2,"trop de testeurs") ; } testeurs_[indice_++] = pt ; }