Aktualizovat du6/a_station.c

This commit is contained in:
Tomáš Vlček 2026-04-22 22:45:40 +00:00
parent 3a6c5a844d
commit f1e2f5546e

View File

@ -15,10 +15,11 @@ void destroy_station(struct station* station)
{
return;
}
struct car* currentTracks = station->tracks;
for (int i = 0; i < STATION_SIZE, i++)
//preiteruje cez kazdy jeden 'track/carar' v poli 'tracks' a pre kazdy jeden track
for (int i = 0; i < station->track_count, i++)
{
struct car* currentTracks = station->tracks;
while (currentTracks->next != NULL)
{
struct car* tempTrack = currentTracks;
@ -26,9 +27,16 @@ void destroy_station(struct station* station)
free(tempTrack);
}
}
free(station->tracks);
free(station);
}
int select_track(struct station* station, const char* target){
int select_track(struct station* station, const char* target)
{
if (station == NULL)
{
station = (struct station*)calloc(1, sizeof(station));
}
return 0;
}