没有足够的存储空间来处理此命令 - C#

时间:2013-05-19 21:48:36

标签: c# runtime-error

我是C#编程的新手,我一直遇到以下运行时错误:

“System.Drawing.dll中发生了'System.ComponentModel.Win32Exception'类型的未处理异常”

我将在下面发布相关代码:

    public static Tile[,] tile = new Tile[maxTilesX, maxTilesY];
    public static int netMode = 0;

    public Game1()
    {
        ThreadPool.QueueUserWorkItem(new WaitCallback(worldGenCallBack), 1);
    }

    public static void worldGenCallBack(object threadContext)
    {
        clearWorld();
        generateWorld(-1);
    }

    public static void clearWorld()
    {
        if (netMode != 1)
        {
            for (int k = 0; k < maxTilesX; k++)
            {
                for (int l = 0; l < maxTilesY; l++)
                {
                    tile[k, l] = new Tile(); //The error occurs on this line
                }
            }
        }
    }

我已经完成了一些控制台测试,并且在通过第二个for循环进行了几千个循环之后发生了错误。

编辑:tile-class的相关代码:

public class Tile : Microsoft.Xna.Framework.Game
{
    public bool active;
    public byte type;
}

在worldgeneration过程中,以下代码用于tile

while ((double)num11 < num3) //MAIN OUTPUT 
            {
                tile[i, num11].active = false; 

                tile[i, num11].frameX = -1;
                tile[i, num11].frameY = -1;
                num11++;
            }
            for (int j = (int)num3; j < maxTilesY; j++)
            {
                if ((double)j < num4) 
                {
                    tile[i, j].active = true;

                    tile[i, j].type = 0;

                    tile[i, j].frameX = -1;
                    tile[i, j].frameY = -1;
                }
                else
                {
                    tile[i, j].active = true;

                    tile[i, j].type = 1;

                    tile[i, j].frameX = -1;
                    tile[i, j].frameY = -1;
                }
            }

任何人都可以帮忙吗?

0 个答案:

没有答案