WIP
This commit is contained in:
parent
ae15257aca
commit
0a369495ab
@ -33,6 +33,17 @@ int select_track(struct station* station, const char* target){
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 track = select_track(station, target); // zistim ktora kolaj by to mala byt
|
||||||
|
struct car* kolaj = station -> tracks[track]; // "loadnem" si kolaj aby som s nou vedel pracovat
|
||||||
|
while (kolaj) { // hladam ci to existuje a ked najdem tak pridam kapacitu kym stojim na kolaji
|
||||||
|
if (strcmp (kolaj -> value, target) == 0) {
|
||||||
|
kolaj -> capacity = kolaj -> capacity + capacity;// ak najdem zhodu (strcmp == 0) tak pridam kapacitu (napojim novy vagon)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
kolaj = kolaj -> next; // idem pozerat vedlajsiu kolaj
|
||||||
|
}
|
||||||
|
//TODO create car
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_target_capacity(struct station* station,const char* target){
|
int get_target_capacity(struct station* station,const char* target){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user