Aktualizovat du6/a_station.c
This commit is contained in:
parent
00efac2dbf
commit
a0b35c3a8f
@ -103,13 +103,20 @@ int get_target_capacity(struct station* station,const char* target)
|
|||||||
|
|
||||||
int count_targets(struct station* station)
|
int count_targets(struct station* station)
|
||||||
{
|
{
|
||||||
|
if (station == NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < station->track_count; i++)
|
for (int i = 0; i < station->track_count; i++)
|
||||||
{
|
{
|
||||||
struct car* currentTracks = station->tracks[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;
|
count += 1;
|
||||||
|
currentTracks = currentTracks->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user