Aktualizovat du6/a_station.c

This commit is contained in:
Tomáš Vlček 2026-04-23 22:50:43 +00:00
parent 00efac2dbf
commit a0b35c3a8f

View File

@ -103,13 +103,20 @@ int get_target_capacity(struct station* station,const char* target)
int count_targets(struct station* station)
{
if (station == NULL)
{
return 0;
}
int count = 0;
for (int i = 0; i < station->track_count; i++)
{
struct car* currentTracks = station->tracks[i];
while (currentTracks->next->value != NULL && currentTracks->next != NULL)
// while (currentTracks->next->value != NULL && currentTracks->next != NULL)
while (currentTracks != NULL)
{
count += 1;
currentTracks = currentTracks->next;
}
}
return count;