count targets

This commit is contained in:
Kamil Gejdoš 2026-04-23 14:03:22 +00:00
parent d04e057d86
commit 3c8bcc3be0

View File

@ -69,6 +69,15 @@ int get_target_capacity(struct station* station,const char* target){
int count_targets(struct station* station){ int count_targets(struct station* station){
int targets = 0; int targets = 0;
//rovnaky while ako uz par krat, pre kazdu kolaj stanice prezriem vagony a ++ pre vsetko co najdem
for (int i = 0; i < station -> track_count; i++) {
struct car* vagon = station -> tracks[i];
while (vagon) {
targets++;
vagon = vagon -> next;
}
}
return targets; return targets;
} }