cv6
This commit is contained in:
parent
08ae834f6c
commit
b628b7e760
@ -34,7 +34,7 @@ int index = select_track(station, target);
|
|||||||
current = current->next;
|
current = current->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ak ciel neexistuje, pridá novy zaznam do zoznamu
|
|
||||||
struct car* new_car = (struct car*)malloc(sizeof(struct car));
|
struct car* new_car = (struct car*)malloc(sizeof(struct car));
|
||||||
strncpy(new_car->value, target, TARGET_SIZE - 1);
|
strncpy(new_car->value, target, TARGET_SIZE - 1);
|
||||||
new_car->value[TARGET_SIZE - 1] = '\0';
|
new_car->value[TARGET_SIZE - 1] = '\0';
|
||||||
@ -44,7 +44,16 @@ int index = select_track(station, target);
|
|||||||
}
|
}
|
||||||
|
|
||||||
int get_target_capacity(struct station* station,const char* target){
|
int get_target_capacity(struct station* station,const char* target){
|
||||||
return 0;
|
int index = select_track(station, target);
|
||||||
|
struct car* current = station->tracks[index];
|
||||||
|
|
||||||
|
while (current) {
|
||||||
|
if (strcmp(current->value, target) == 0) {
|
||||||
|
return current->capacity;
|
||||||
|
}
|
||||||
|
current = current->next;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_targets(struct station* station){
|
int count_targets(struct station* station){
|
||||||
|
Loading…
Reference in New Issue
Block a user