count targets
This commit is contained in:
parent
d04e057d86
commit
3c8bcc3be0
@ -69,6 +69,15 @@ int get_target_capacity(struct station* station,const char* target){
|
||||
|
||||
int count_targets(struct station* station){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user