From 1dcd595d361d9f84ab9cac41c4e5623d5a775e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Gejdo=C5=A1?= Date: Thu, 23 Apr 2026 13:38:36 +0000 Subject: [PATCH] target capaciity increase --- du6/a_station.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 }