achhhhhhh

This commit is contained in:
Radovan Kofira 2020-11-10 21:47:36 +01:00
parent 54f923379a
commit 0edab5145b

View File

@ -50,6 +50,22 @@ int select_track(struct station* station, const char* target){
}
void add_target_capacity(struct station* station,const char* target, int capacity){
int i = select_track(station,target);
struct car* slot = station->tracks[i];
if(station->tracks[i]==NULL){
struct car* newCar = malloc(sizeof(struct car));
strcpy(newCar->value,target);
newCar->capacity=capacity;
newCar->next=slot;
station->tracks[i]=newCar;
}
while (slot!=NULL)
{
if(strcmp(slot->value,target)==0){
slot->capacity +=capacity;
}
slot=slot->next;
}
}
int get_target_capacity(struct station* station,const char* target){