1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2024-12-26 09:41:11 +00:00
This commit is contained in:
Aethor 2018-06-20 22:11:48 +02:00
parent 7315e1595e
commit f066e22419
2 changed files with 3 additions and 3 deletions

View File

@ -168,8 +168,8 @@ void go_to_floor_Building(THIS(Building), int origin, int destination, Passenger
this->waiting_passengers->insert_tail(this->waiting_passengers, (void*) passenger, sizeof(Passenger));//todo : check if inside list
}
pthread_cond_wait(this->condition_floors[origin], this->mutex_cond_get_inside_elevator);
elevator_number = this->get_inside_elevator(this, origin, passenger);
elevator_number = this->get_inside_elevator(this, origin, passenger);
if (elevator_number != -1){ //passenger accepted in elevator
if (passenger->type == RESIDENT)
printf("Le résident %s rentre dans l'ascenseur %s depuis l'étage %d\n", passenger->get_name(passenger),
@ -191,7 +191,7 @@ void go_to_floor_Building(THIS(Building), int origin, int destination, Passenger
else if (passenger->type == VISITOR)
printf("Le visiteur %s à l'étage %d n'a pas pu rentrer dans un ascenseur. Préempté !\n", passenger->get_name(passenger), origin);
//reloading fire
this->go_to_floor(this, origin, destination, passenger);
//this->go_to_floor(this, origin, destination, passenger);
}
}

View File

@ -68,7 +68,7 @@ int get_next_floor_Elevator(THIS(Elevator)){
for(i=0;i<this->passengers->get_size(this->passengers);i++){
temp_element = this->passengers->get_element(this->passengers, i);
temp_passenger = (Passenger*) temp_element->get_data(temp_element);
temp_floor = temp_passenger->type == RESIDENT ? temp_passenger->resident->destination : temp_passenger->visitor->destination;
temp_floor = temp_passenger->get_destination(temp_passenger);
if(abs(this->floor - temp_floor) < min_diff && temp_floor != this->floor){
min_diff = abs(this->floor - temp_floor);
next_floor = temp_floor;