Aktualizovat du6/a_station.c

This commit is contained in:
Tomáš Vlček 2026-04-23 22:32:57 +00:00
parent 09e936a1b7
commit 4cae57030f

View File

@ -20,7 +20,7 @@ void destroy_station(struct station* station)
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 != NULL)
{ {
struct car* tempTrack = currentTracks; struct car* tempTrack = currentTracks;
currentTracks = currentTracks->next; currentTracks = currentTracks->next;
@ -78,8 +78,8 @@ void add_target_capacity(struct station* station,const char* target, int capacit
newCar->capacity = capacity; newCar->capacity = capacity;
//vlozi na zaciatok tracku //vlozi na zaciatok tracku
new_car->next = station->tracks[i]; newCar->next = station->tracks[i];
station->tracks[i] = new_car; station->tracks[i] = newCar;
} }
int get_target_capacity(struct station* station,const char* target) int get_target_capacity(struct station* station,const char* target)