From 3c8bcc3be0ee7853ee22305e5c79db04b0c10194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Gejdo=C5=A1?= Date: Thu, 23 Apr 2026 14:03:22 +0000 Subject: [PATCH] count targets --- du6/a_station.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/du6/a_station.c b/du6/a_station.c index aa56ace..f6a49cb 100644 --- a/du6/a_station.c +++ b/du6/a_station.c @@ -69,6 +69,15 @@ int get_target_capacity(struct station* station,const char* target){ int count_targets(struct station* station){ int targets = 0; + + //rovnaky while ako uz par krat, pre kazdu kolaj stanice prezriem vagony a ++ pre vsetko co najdem + for (int i = 0; i < station -> track_count; i++) { + struct car* vagon = station -> tracks[i]; + while (vagon) { + targets++; + vagon = vagon -> next; + } + } return targets; }