Aktualizovat du6/a_station.c
This commit is contained in:
parent
8ef08b72cc
commit
080b124870
@ -16,7 +16,7 @@ void destroy_station(struct station* station)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//preiteruje cez kazdy jeden 'track/carar' v poli 'tracks' a pre kazdy jeden track
|
//preiteruje cez kazdy jeden 'track/carar' v poli 'tracks' a
|
||||||
for (int i = 0; i < station->track_count, i++)
|
for (int i = 0; i < station->track_count, i++)
|
||||||
{
|
{
|
||||||
struct car* currentTracks = station->tracks;
|
struct car* currentTracks = station->tracks;
|
||||||
@ -40,19 +40,45 @@ int select_track(struct station* station, const char* target)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_target_capacity(struct station* station,const char* target, int capacity){
|
void add_target_capacity(struct station* station,const char* target, int capacity)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_target_capacity(struct station* station,const char* target){
|
int get_target_capacity(struct station* station,const char* target)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < station->track_count, i++)
|
||||||
|
{
|
||||||
|
struct car* currentTracks = station->tracks[i];
|
||||||
|
while (currentTracks->next != NULL)
|
||||||
|
{
|
||||||
|
if (strcmp(currentTracks->value, target) == 0)
|
||||||
|
{
|
||||||
|
return currentTracks->capacity;
|
||||||
|
}
|
||||||
|
currentTracks = currentTracks->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_targets(struct station* station){
|
int count_targets(struct station* station)
|
||||||
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)
|
||||||
|
{
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
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];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user