private bool CheckWeight(Container container, int width, int depth, int z)
{
int weight;
for (int i = 0; i < ship.GetHeight(); i++)
{
weight = container.GetWeight();
for (int height = i; height < ship.GetHeight(); height++)
{
if (ship.GetContainer(width, depth, height) != null)
{
weight += ship.GetContainer(width, depth, height).GetWeight();
}
}
if (ship.GetContainer(width, depth, i) != null)
{
weight -= ship.GetContainer(width, depth, i).GetWeight();
}
if (weight > 120)
{
return(false);
}
weight = 0;
}
return(true);
}