mirror of
https://gitlab.com/klmp200/LO41.git
synced 2024-11-25 02:24:23 +00:00
GCC YOU FAGGOT !
This commit is contained in:
parent
fd2463904a
commit
ab0e742cd4
@ -150,18 +150,18 @@ void go_to_floor_Building(THIS(Building), int origin, int destination, Passenger
|
|||||||
|
|
||||||
pthread_cond_wait(this->condition_floors[origin], this->mutex_get_inside_elevator);
|
pthread_cond_wait(this->condition_floors[origin], this->mutex_get_inside_elevator);
|
||||||
elevator_number = this->get_inside_elevator(this, origin, passenger, type);
|
elevator_number = this->get_inside_elevator(this, origin, passenger, type);
|
||||||
if (type == resident)
|
if (type == RESIDENT)
|
||||||
printf("Le résident %s rentre dans l'ascenseur %s depuis l'étage %d\n", passenger.resident->name,
|
printf("Le résident %s rentre dans l'ascenseur %s depuis l'étage %d\n", passenger.resident->name,
|
||||||
this->elevators[elevator_number]->name, origin);
|
this->elevators[elevator_number]->name, origin);
|
||||||
else if (type == visitor)
|
else if (type == VISITOR)
|
||||||
printf("Le visiteur %s rentre dans l'ascenseur %s depuis l'étage %d\n", passenger.visitor->name,
|
printf("Le visiteur %s rentre dans l'ascenseur %s depuis l'étage %d\n", passenger.visitor->name,
|
||||||
this->elevators[elevator_number]->name, origin);
|
this->elevators[elevator_number]->name, origin);
|
||||||
|
|
||||||
pthread_cond_wait(this->condition_floors[destination], this->mutex_get_outside_elevator);
|
pthread_cond_wait(this->condition_floors[destination], this->mutex_get_outside_elevator);
|
||||||
if (type == resident)
|
if (type == RESIDENT)
|
||||||
printf("Le résident %s sors de l'ascenseur %s à l'étage %d\n", passenger.resident->name,
|
printf("Le résident %s sors de l'ascenseur %s à l'étage %d\n", passenger.resident->name,
|
||||||
this->elevators[elevator_number]->name, destination);
|
this->elevators[elevator_number]->name, destination);
|
||||||
else if (type == visitor)
|
else if (type == VISITOR)
|
||||||
printf("Le visiteur %s sors de l'ascenseur %s à l'étage %d\n", passenger.visitor->name,
|
printf("Le visiteur %s sors de l'ascenseur %s à l'étage %d\n", passenger.visitor->name,
|
||||||
this->elevators[elevator_number]->name, destination);
|
this->elevators[elevator_number]->name, destination);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "../Resident/Resident.h"
|
#include "../Resident/Resident.h"
|
||||||
#include "../Visitor/Visitor.h"
|
#include "../Visitor/Visitor.h"
|
||||||
|
|
||||||
typedef enum {resident, visitor} PASSENGER_TYPE;
|
typedef enum {RESIDENT, VISITOR} PASSENGER_TYPE;
|
||||||
|
|
||||||
typedef union u_Passenger {
|
typedef union u_Passenger {
|
||||||
Resident * resident;
|
Resident * resident;
|
||||||
|
@ -11,7 +11,7 @@ GETTER(Resident, int, apartment_floor);
|
|||||||
|
|
||||||
void * runnable_Resident(void * void_this){
|
void * runnable_Resident(void * void_this){
|
||||||
Resident * this = (Resident*) void_this;
|
Resident * this = (Resident*) void_this;
|
||||||
printf("Je suis le resident %s et je suis a l'etage %d en direction de l'etage %d\n",
|
printf("Je suis le RESIDENT %s et je suis a l'etage %d en direction de l'etage %d\n",
|
||||||
this->name, this->apartment_floor, this->destination);
|
this->name, this->apartment_floor, this->destination);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ void _free__Resident(THIS(Resident)){
|
|||||||
}
|
}
|
||||||
|
|
||||||
Resident *_init_Resident(int id, char* name, int apartment_floor, int destination){
|
Resident *_init_Resident(int id, char* name, int apartment_floor, int destination){
|
||||||
/* If the destination is the same as the apartment_floor or negative, the resident will not move */
|
/* If the destination is the same as the apartment_floor or negative, the RESIDENT will not move */
|
||||||
Resident * new_resident = malloc_or_die(sizeof(Resident));
|
Resident * new_resident = malloc_or_die(sizeof(Resident));
|
||||||
new_resident->name = strdup(name);
|
new_resident->name = strdup(name);
|
||||||
new_resident->id = id;
|
new_resident->id = id;
|
||||||
|
Loading…
Reference in New Issue
Block a user