Changeset 136 for binary-improvements/7dtd-server-fixes/src
- Timestamp:
- Aug 27, 2014, 6:00:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/MapRendering/MapRendering.cs
r135 r136 21 21 22 22 private RegionFileManager rfm; 23 private Texture2D fullMapTexture ;23 private Texture2D fullMapTexture = null; 24 24 private MapRenderBlockBuffer[] zoomLevelBuffers = new MapRenderBlockBuffer[Constants.ZOOMLEVELS]; 25 25 private Color[] chunkColors = new Color[Constants.MAP_CHUNK_SIZE * Constants.MAP_CHUNK_SIZE]; … … 79 79 minPos.ToString (), maxPos.ToString (), 80 80 widthChunks, heightChunks, 81 widthPix, heightPix)); 82 83 fullMapTexture = new Texture2D (widthPix, heightPix); 81 widthPix, heightPix) 82 ); 83 84 if (widthPix <= 8000 && heightPix <= 8000) 85 fullMapTexture = new Texture2D (widthPix, heightPix); 84 86 85 87 Vector2i curFullMapPos; … … 98 100 rfm = null; 99 101 100 byte[] array = fullMapTexture.EncodeToPNG (); 101 File.WriteAllBytes (Constants.MAP_DIRECTORY + "/map.png", array); 102 Texture2D.Destroy (fullMapTexture); 102 if (fullMapTexture != null) { 103 byte[] array = fullMapTexture.EncodeToPNG (); 104 File.WriteAllBytes (Constants.MAP_DIRECTORY + "/map.png", array); 105 Texture2D.Destroy (fullMapTexture); 106 fullMapTexture = null; 107 } 103 108 104 109 renderingFullMap = false; … … 149 154 zoomLevelBuffers [Constants.ZOOMLEVELS - 1].SetPart (blockOffset, Constants.MAP_CHUNK_SIZE, chunkColors); 150 155 151 if (renderingFullMap )156 if (renderingFullMap && fullMapTexture != null) 152 157 fullMapTexture.SetPixels (fullMapPos.x, fullMapPos.y, Constants.MAP_CHUNK_SIZE, Constants.MAP_CHUNK_SIZE, chunkColors); 153 158
Note:
See TracChangeset
for help on using the changeset viewer.