1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-12 04:39:23 +00:00

c'est plus beau

This commit is contained in:
Aethor
2018-06-20 22:06:45 +02:00
parent f6dc3e5f3a
commit 7315e1595e
8 changed files with 39 additions and 24 deletions

View File

@ -9,6 +9,14 @@ int compare_Passenger(void * passenger1, void * passenger2){
((Passenger*) passenger2)->get_name((Passenger*) passenger2)) == 0);
}
int get_destination_Passenger(THIS(Passenger)){
if (this->type == RESIDENT)
return this->resident->get_destination(this->resident);
if (this->type == VISITOR)
return this->visitor->get_destination(this->visitor);
return -1;
}
int get_id_Passenger(THIS(Passenger)){
if (this->type == RESIDENT)
return this->resident->get_id(this->resident);
@ -52,10 +60,11 @@ Passenger *_init_Passenger(void* passenger_data, PASSENGER_TYPE type){
//new_passenger->compare = compare_Passenger;
LINK_ALL(Passenger, new_passenger,
get_id,
get_name,
compare,
runnable
get_id,
get_name,
get_destination,
compare,
runnable
)
return new_passenger;

View File

@ -20,6 +20,7 @@ typedef struct o_Passenger {
PUBLIC char * (*get_name)(_THIS(Passenger));
PUBLIC int (*get_id)(_THIS(Passenger));
PUBLIC int (*get_destination)(_THIS(Passenger));
PUBLIC void * (*runnable)(void* void_this);
PUBLIC int (*compare)(void * passenger1, void * passenger2);//yeah I know, but i needed int (*) (void*, void*)