1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-10 11:49:24 +00:00
This commit is contained in:
2018-06-18 15:20:19 +02:00
parent 8bf2b3358d
commit a76ae7bc03
2 changed files with 9 additions and 4 deletions

View File

@ -9,12 +9,15 @@ SETTER(SharedData, Building *, main_building)
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 */
if (this->main_building == NULL)
if (this->main_building == NULL) {
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");
if (destination_floor > FLOORS)
}
if (destination_floor > FLOORS) {
CRASH("You are trying to reach a floor higher than the highest floor\n");
}
return 0;
}