Esempio n. 1
0
        private void ConfirmPendingInfo()
        {
            List <int> truePendingID = new List <int>();
            int        nextID        = 0;

            for (int k = 0; k < pendingInfos.Count; k++)
            {
                while (nextID < infos.Count && infos[nextID] != null)
                {
                    nextID++;
                }
                if (nextID == infos.Count)
                {
                    infos.Add(pendingInfos[k]);
                }
                else
                {
                    infos[nextID] = pendingInfos[k];
                }
                truePendingID.Add(nextID);
            }
            ushort pendingType  = ModContent.Find <ModTile>("ModLoader/PendingUnloadedTile").Type;
            ushort unloadedType = ModContent.Find <ModTile>("ModLoader/UnloadedTile").Type;

            for (int x = 0; x < Main.maxTilesX; x++)
            {
                for (int y = 0; y < Main.maxTilesY; y++)
                {
                    if (Main.tile[x, y].type == pendingType)
                    {
                        Tile tile = Main.tile[x, y];
                        UnloadedTileFrame frame = new UnloadedTileFrame(tile.frameX, tile.frameY);
                        frame       = new UnloadedTileFrame(truePendingID[frame.FrameID]);
                        tile.type   = unloadedType;
                        tile.frameX = frame.FrameX;
                        tile.frameY = frame.FrameY;
                    }
                }
            }
        }
Esempio n. 2
0
        private void RestoreTiles(List <ushort> canRestore)
        {
            ushort unloadedType = ModContent.Find <ModTile>("ModLoader/UnloadedTile").Type;

            for (int x = 0; x < Main.maxTilesX; x++)
            {
                for (int y = 0; y < Main.maxTilesY; y++)
                {
                    if (Main.tile[x, y].type == unloadedType)
                    {
                        Tile tile = Main.tile[x, y];
                        UnloadedTileFrame frame = new UnloadedTileFrame(tile.frameX, tile.frameY);
                        int frameID             = frame.FrameID;
                        if (canRestore[frameID] > 0)
                        {
                            UnloadedTileInfo info = infos[frameID];
                            tile.type   = canRestore[frameID];
                            tile.frameX = info.frameX;
                            tile.frameY = info.frameY;
                        }
                    }
                }
            }
        }