1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-10 19:59:24 +00:00

ElevatorPassenger c'est plus propre, c'est ça le vrai polymorphisme du C++ en C

This commit is contained in:
2018-06-18 15:51:48 +02:00
parent 575defc5fc
commit b001cb1a91
7 changed files with 54 additions and 33 deletions

View File

@ -13,14 +13,17 @@ void * runnable_Visitor(void * void_this){
Visitor *this = (Visitor*) void_this;
SharedData * data = GET_INSTANCE(SharedData);
Passenger passenger;
ElevatorPassenger elevator_passenger;
AGENT_OPTIONS
passenger.visitor = this;
elevator_passenger.passenger = passenger;
elevator_passenger.type = VISITOR;
printf("Bonjour, je suis %s et je souhaite rendre visite a %s\n", this->name, this->contact_name);
printf("Bip, %s appel a l'interphone\n%s habite a l'etage %d\n", this->name, this->contact_name, (this->destination = data->use_call_box(data, this->contact_name)));
data->main_building->go_to_floor(data->main_building, this->position, this->destination, passenger, VISITOR);
data->main_building->go_to_floor(data->main_building, this->position, this->destination, elevator_passenger);
return NULL;
}