target capaciity increase

This commit is contained in:
Kamil Gejdoš 2026-04-23 13:38:36 +00:00
parent 0a369495ab
commit 1dcd595d36

View File

@ -1,6 +1,7 @@
#include "a_station.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct station* create_station(){
struct station* station = (struct station*)calloc(1,sizeof(struct station));
@ -42,7 +43,14 @@ void add_target_capacity(struct station* station,const char* target, int capacit
}
kolaj = kolaj -> next; // idem pozerat vedlajsiu kolaj
}
//TODO create car
//vytvaram novy vagon
struct car* vagon = (struct car*) malloc (sizeof (struct car)); // vyhradim nove miesto v pamati pre novy vagon,
// inac by sa mi nezapisala nova premenna z lokalnej funkcie
strncpy(vagon -> value, target, TARGET_SIZE - 1);
vagon -> value[TARGET_SIZE - 1] = '\0'; //ukoncim string
vagon -> capacity = capacity; //zadam kapacitu
vagon -> next = station -> tracks[track]; // nastavim nasledovnika, zaclenim do databazy
station -> tracks[track] = vagon; // pridam vagon na kolaj
}