public Ship(int shipHeight, int shipWidth, int maxWeight, int stackAmount, List <ShipContainer> listContainer) { ShipHeight = shipHeight; ShipWidth = shipWidth; StackAmount = stackAmount; MaxColumns = shipWidth / 5; MaxRows = shipHeight / 5; MaxStack = 5; MaxWeight = maxWeight; ListContainer = listContainer; foreach (ShipContainer container in ListContainer) { CurrentWeight += container.Weight; container.Height = ShipHeight / MaxRows; container.Width = ShipHeight / MaxColumns; } ContainerAssigner.CreateGrid(this); AssignContainersToGrid(); ListErrorMessages = new List <string>(); if (!shipMeetsRequirements(this)) { //yet to implement if it doesnt meet requirements } }
public void AssignContainersToGrid() { //Dictionary contain //List<ShipContainer> listNormalContainers = new List<ShipContainer>(); //List<ShipContainer> listChilledContainers = new List<ShipContainer>(); //List<ShipContainer> listValuableContainers = new List<ShipContainer>(); ////Sort container type //foreach (ShipContainer container in ListContainer) //{ // if (container.Type == ListOfTypes.Normale.ToString()) // { // listNormalContainers.Add(new ShipContainer(container)); // } // if (container.Type == ListOfTypes.Gekoelde.ToString()) // { // listChilledContainers.Add(new ShipContainer(container)); // } // if (container.Type == ListOfTypes.Waardevolle.ToString()) // { // listValuableContainers.Add(new ShipContainer(container)); // } //} ContainerAssigner.AssignChilledContainers(this); ContainerAssigner.AssignNormalContainers(this); ContainerAssigner.AssignValuableContainers(this); }