Lazy allocate

This commit is contained in:
UnknownShadow200 2018-03-25 11:29:31 +11:00
parent 8150ff22ff
commit d05f4ab214
3 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE;USE_DX;USE16_BIT</DefineConstants>
<DefineConstants>TRACE;USE_DX;</DefineConstants>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>

View File

@ -71,11 +71,7 @@ namespace ClassicalSharp {
WorldEvents.OnNewMapLoaded += OnNewMapLoadedCore;
Events.TextureChanged += TextureChangedCore;
#if USE16_BIT
BlockInfo.Allocate(768);
#else
BlockInfo.Allocate(256);
#endif
BlockInfo.Init();
ModelCache = new ModelCache(this);

View File

@ -79,6 +79,10 @@ namespace ClassicalSharp.Network {
net.reader.ExtendedBlocks = true;
net.writer.ExtendedBlocks = true;
if (BlockInfo.Count < 768) {
BlockInfo.Allocate(768);
BlockInfo.Reset();
}
}
#endif
}