mirror of
https://gitlab.com/klmp200/LO41.git
synced 2024-11-25 02:24:23 +00:00
Merge branch 'master' of gitlab.com:klmp200/LO41
This commit is contained in:
commit
575defc5fc
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user