//Place the cooled containers
        private void PlaceCContainers()
        {
            //Get al list with containers sorted on weight (reverse because it will sort on the lowest container).
            List <CooledContainer> containerSortedWeight = cList.OrderBy(c => c.weight).Reverse().ToList();

            //Get the first row, cooled containers can only be placed on the first row. 0 will always be the first row.
            Row firstRow = ship.ReturnRow(0);

            //Sort the Row stacks on the LOWEST weight, i will place the heaviest container on the lowes weight to compensate.
            ContainerStack stack = SortStacksOnWeight(firstRow.Stacks).FirstOrDefault();

            foreach (var container in containerSortedWeight)
            {
                if (container != null)
                {
                    if (stack != null && stack.CanAddContainer(container))
                    {
                        if (container.placeLow)
                        {
                            stack.AddContainerToStackLow(container);
                        }
                        else
                        {
                            stack.AddContainerToStack(container);
                        }
                    }
                    else
                    {
                        AddContainerToFalseList(container);
                    }
                }
                stack = SortStacksOnWeight(firstRow.Stacks).FirstOrDefault();
            }
        }
示例#2
0
        private void PlaceValuableContainers(ContainerStack containerStack)
        {
            List <Container> valuedContainers = ContainersToBeAdded.FindAll(c => c.Valuable);

            foreach (var container in valuedContainers)
            {
                if (containerStack.IsContainerAble(container, Ship.Columns))
                {
                    containerStack.AddContainerToStack(container);
                    ContainersToBeAdded.Remove(container);
                }
            }
        }
示例#3
0
        private void PlaceRegularContainers(ContainerStack containerStack)
        {
            List <Container> regularContainers = ContainersToBeAdded.FindAll(c => !c.Cooled && !c.Valuable);

            foreach (var container in regularContainers)
            {
                if (containerStack.IsContainerAble(container, Ship.Columns))
                {
                    containerStack.AddContainerToStack(container);
                    ContainersToBeAdded.Remove(container);
                }
            }
        }