mirror of
https://gitlab.com/klmp200/LO41.git
synced 2025-07-10 19:59:24 +00:00
Meilleure gestion des scénari
This commit is contained in:
@ -11,17 +11,23 @@ GETTER(Visitor, int, id);
|
||||
void _free__Visitor(THIS(Visitor)){
|
||||
if (this->name != NULL)
|
||||
free(this->name);
|
||||
if (this->contact_name != NULL)
|
||||
free(this->contact_name);
|
||||
free(this);
|
||||
}
|
||||
|
||||
Visitor *_init_Visitor(int id, char* name){
|
||||
Visitor *_init_Visitor(int id, char* name, char * contact_name){
|
||||
Visitor * new_visitor = malloc_or_die(sizeof(Visitor));
|
||||
new_visitor->name = strdup(name);
|
||||
new_visitor->id = id;
|
||||
new_visitor->contact_id = -1;
|
||||
new_visitor->position = 0;
|
||||
new_visitor->destination = -1;
|
||||
|
||||
if (contact_name != NULL)
|
||||
new_visitor->contact_name = strdup(contact_name);
|
||||
else
|
||||
new_visitor->contact_name = NULL;
|
||||
|
||||
LINK_ALL(Visitor, new_visitor,
|
||||
get_name,
|
||||
get_id
|
||||
|
@ -10,7 +10,7 @@
|
||||
typedef struct o_Visitor {
|
||||
PRIVATE int id;
|
||||
PRIVATE char * name;
|
||||
PRIVATE int contact_id;
|
||||
PRIVATE char * contact_name;
|
||||
PRIVATE int position;
|
||||
PRIVATE int destination;
|
||||
|
||||
@ -22,6 +22,6 @@ typedef struct o_Visitor {
|
||||
|
||||
FRIENDLY(name, Building)
|
||||
|
||||
Visitor *_init_Visitor(int id, char* name);
|
||||
Visitor *_init_Visitor(int id, char* name, char* contact_name);
|
||||
|
||||
#endif //LO41_VISITOR_H
|
||||
|
Reference in New Issue
Block a user