diff --git a/du6/a_station.c b/du6/a_station.c index f161a1c..9fe09ae 100644 --- a/du6/a_station.c +++ b/du6/a_station.c @@ -1,6 +1,7 @@ #include "a_station.h" #include #include +#include struct station* create_station(){ struct station* station = (struct station*)calloc(1,sizeof(struct station)); @@ -42,7 +43,14 @@ void add_target_capacity(struct station* station,const char* target, int capacit } kolaj = kolaj -> next; // idem pozerat vedlajsiu kolaj } - //TODO create car + //vytvaram novy vagon + struct car* vagon = (struct car*) malloc (sizeof (struct car)); // vyhradim nove miesto v pamati pre novy vagon, + // inac by sa mi nezapisala nova premenna z lokalnej funkcie + strncpy(vagon -> value, target, TARGET_SIZE - 1); + vagon -> value[TARGET_SIZE - 1] = '\0'; //ukoncim string + vagon -> capacity = capacity; //zadam kapacitu + vagon -> next = station -> tracks[track]; // nastavim nasledovnika, zaclenim do databazy + station -> tracks[track] = vagon; // pridam vagon na kolaj }