From 0a369495abcafde0ed28245546dbeecc9b85d342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Gejdo=C5=A1?= Date: Thu, 23 Apr 2026 13:23:02 +0000 Subject: [PATCH] WIP --- du6/a_station.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/du6/a_station.c b/du6/a_station.c index 6de5257..f161a1c 100644 --- a/du6/a_station.c +++ b/du6/a_station.c @@ -33,6 +33,17 @@ int select_track(struct station* station, const char* target){ } void add_target_capacity(struct station* station,const char* target, int capacity){ + int track = select_track(station, target); // zistim ktora kolaj by to mala byt + struct car* kolaj = station -> tracks[track]; // "loadnem" si kolaj aby som s nou vedel pracovat + while (kolaj) { // hladam ci to existuje a ked najdem tak pridam kapacitu kym stojim na kolaji + if (strcmp (kolaj -> value, target) == 0) { + kolaj -> capacity = kolaj -> capacity + capacity;// ak najdem zhodu (strcmp == 0) tak pridam kapacitu (napojim novy vagon) + return; + } + kolaj = kolaj -> next; // idem pozerat vedlajsiu kolaj + } + //TODO create car + } int get_target_capacity(struct station* station,const char* target){