Aktualizovat du6/a_station.c
This commit is contained in:
parent
1ece09f5e6
commit
11f81e7a80
@ -27,6 +27,7 @@ void destroy_station(struct station* station)
|
|||||||
free(tempTrack);
|
free(tempTrack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//uvolnenie vrchnych prvkov..
|
||||||
free(station->tracks);
|
free(station->tracks);
|
||||||
free(station);
|
free(station);
|
||||||
}
|
}
|
||||||
@ -114,12 +115,13 @@ int count_targets(struct station* station)
|
|||||||
|
|
||||||
int count_capacity(struct station* station){
|
int count_capacity(struct station* station){
|
||||||
int count = 0;
|
int count = 0;
|
||||||
//preiteruje cez vsetky instancie...
|
|
||||||
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 != NULL)
|
while (currentTracks->next != NULL)
|
||||||
{
|
{
|
||||||
|
//skontroluje individualne ich int 'capacity' pole a inkrementuje do vysledneho poctu
|
||||||
count += currentTracks->capacity;
|
count += currentTracks->capacity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user