Browse Source

les ascensceurs bougent, promis

merge-requests/1/head
Amalvy Arthur 4 years ago
parent
commit
e7601243fa
  1. 2
      Elevator/Elevator.c
  2. 2
      residents.txt

2
Elevator/Elevator.c

@ -69,7 +69,7 @@ int get_next_floor_Elevator(THIS(Elevator)){
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;
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);
next_floor = temp_floor;
}

2
residents.txt

@ -4,4 +4,4 @@ Bro;1;1
Ation;1;3
Anium;1;3
Lyne;1;1
Crack;2;2
Crack;2;2

Loading…
Cancel
Save