1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2024-11-22 00:33:22 +00:00

les ascensceurs bougent, promis

This commit is contained in:
Amalvy Arthur 2018-06-20 14:19:56 +02:00
parent 7fcb2a8b5a
commit e7601243fa
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ int get_next_floor_Elevator(THIS(Elevator)){
temp_element = this->passengers->get_element(this->passengers, i); temp_element = this->passengers->get_element(this->passengers, i);
temp_passenger = (Passenger*) temp_element->get_data(temp_element); 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->type == RESIDENT ? temp_passenger->resident->destination : temp_passenger->visitor->destination;
if(abs(this->floor - temp_floor) < min_diff){ if(abs(this->floor - temp_floor) < min_diff && temp_floor != this->floor){
min_diff = abs(this->floor - temp_floor); min_diff = abs(this->floor - temp_floor);
next_floor = temp_floor; next_floor = temp_floor;
} }