1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2024-11-22 08:43:22 +00:00
This commit is contained in:
Aethor 2018-06-20 18:05:37 +02:00
parent d157623135
commit f6f12b398d
2 changed files with 3 additions and 2 deletions

View File

@ -166,7 +166,8 @@ void go_to_floor_Building(THIS(Building), int origin, int destination, Passenger
if (origin < 0 || origin >= FLOORS) {CRASH("You are trying to start from a non existing floor\n");} if (origin < 0 || origin >= FLOORS) {CRASH("You are trying to start from a non existing floor\n");}
if (destination < 0 || destination >= FLOORS) {CRASH("You are trying to reach a non existing floor\n");} if (destination < 0 || destination >= FLOORS) {CRASH("You are trying to reach a non existing floor\n");}
this->waiting_passengers->insert_tail(this->waiting_passengers, (void*) &passenger, sizeof(passenger)); //if(this->waiting_passengers->compare(this->waiting_passengers, (void*) &passenger, passenger.compare))
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); 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);

View File

@ -14,7 +14,7 @@ void * runnable_Visitor(void * void_this){
SharedData * data = GET_INSTANCE(SharedData); SharedData * data = GET_INSTANCE(SharedData);
Passenger passenger; Passenger passenger;
AGENT_OPTIONS AGENT_OPTIONS;
passenger.visitor = this; passenger.visitor = this;
passenger.type = VISITOR; passenger.type = VISITOR;