Changeset 140 for binary-improvements/7dtd-server-fixes/src/MapRendering
- Timestamp:
- Aug 28, 2014, 1:38:06 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/MapRendering/MapRendering.cs
r136 r140 26 26 private System.Timers.Timer chunkSaveTimer = new System.Timers.Timer (500); 27 27 private bool renderingFullMap = false; 28 public static bool renderingEnabled = true; 28 29 29 30 private MapRendering () … … 41 42 public static void RenderSingleChunk (Chunk chunk) 42 43 { 43 ThreadPool.QueueUserWorkItem ((o) => 44 { 45 try { 46 if (!Instance.renderingFullMap) { 47 Chunk c = (Chunk)o; 48 Vector3i cPos = c.GetWorldPos (); 49 Vector2i cPos2 = new Vector2i (cPos.x / Constants.MAP_CHUNK_SIZE, cPos.z / Constants.MAP_CHUNK_SIZE); 50 Instance.RenderChunk (c, cPos2); 51 Instance.chunkSaveTimer.Stop (); 52 Instance.chunkSaveTimer.Start (); 44 if (renderingEnabled) { 45 ThreadPool.QueueUserWorkItem ((o) => 46 { 47 try { 48 if (!Instance.renderingFullMap) { 49 Chunk c = (Chunk)o; 50 Vector3i cPos = c.GetWorldPos (); 51 Vector2i cPos2 = new Vector2i (cPos.x / Constants.MAP_CHUNK_SIZE, cPos.z / Constants.MAP_CHUNK_SIZE); 52 Instance.RenderChunk (c, cPos2); 53 Instance.chunkSaveTimer.Stop (); 54 Instance.chunkSaveTimer.Start (); 55 } 56 } catch (Exception e) { 57 Log.Out ("Exception in MapRendering.RenderSingleChunk(): " + e); 53 58 } 54 } catch (Exception e) { 55 Log.Out ("Exception in MapRendering.RenderSingleChunk(): " + e); 56 } 57 }, chunk); 59 }, chunk); 60 } 58 61 } 59 62 … … 114 117 115 118 private int saveCount = 0; 119 private long renderCount = 0; 116 120 117 121 private void SaveAllBlockMaps (object source, System.Timers.ElapsedEventArgs e) … … 119 123 Monitor.Enter (zoomLevelBuffers); 120 124 try { 121 Log.Out ("------- SaveAllBlockMaps " + ++saveCount );125 Log.Out ("------- SaveAllBlockMaps " + ++saveCount + " - " + renderCount); 122 126 for (int i = 0; i < Constants.ZOOMLEVELS; i++) { 123 127 zoomLevelBuffers [i].SaveBlock (); … … 142 146 Monitor.Enter (zoomLevelBuffers); 143 147 try { 148 renderCount++; 144 149 ushort[] mapColors = chunk.GetMapColors (); 145 150 if (mapColors != null) {
Note:
See TracChangeset
for help on using the changeset viewer.