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; }