1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2024-11-24 18:14:19 +00:00
This commit is contained in:
Antoine Bartuccio 2018-06-18 15:20:19 +02:00
parent 8bf2b3358d
commit a76ae7bc03
Signed by: klmp200
GPG Key ID: E7245548C53F904B
2 changed files with 9 additions and 4 deletions

View File

@ -133,7 +133,9 @@ void insert_inside_List(THIS(List), void * data, size_t data_size, int index){
old_element->previous->next = new_element; old_element->previous->next = new_element;
old_element->previous = new_element; old_element->previous = new_element;
} else OUTSIDE_BOUNDS; } else {
OUTSIDE_BOUNDS;
}
} }

View File

@ -9,12 +9,15 @@ SETTER(SharedData, Building *, main_building)
int call_elevator_SharedData(THIS(SharedData), int starting_floor, int destination_floor){ int call_elevator_SharedData(THIS(SharedData), int starting_floor, int destination_floor){
/* Make the thread wait for an elevator available and return the id of the elevator available */ /* Make the thread wait for an elevator available and return the id of the elevator available */
if (this->main_building == NULL) if (this->main_building == NULL) {
CRASH("No building attached to shared data, you cannot call an elevator\n"); CRASH("No building attached to shared data, you cannot call an elevator\n");
if (starting_floor < 0) }
if (starting_floor < 0) {
CRASH("You cannot start from a floor lower than 0\n"); CRASH("You cannot start from a floor lower than 0\n");
if (destination_floor > FLOORS) }
if (destination_floor > FLOORS) {
CRASH("You are trying to reach a floor higher than the highest floor\n"); CRASH("You are trying to reach a floor higher than the highest floor\n");
}
return 0; return 0;
} }