Skip to content

Commit

Permalink
Fix BiomeMap OD Loading lagging in MapView
Browse files Browse the repository at this point in the history
StollD committed Oct 24, 2018
1 parent 8a7e0a6 commit 65bf1f2
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Kopernicus.OnDemand/OnDemandStorage.cs
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public static class OnDemandStorage

// OnDemand flags
public static Boolean useOnDemand = true;
public static Boolean useOnDemandBiomes = true;
public static Boolean useOnDemandBiomes = false;
public static Boolean onDemandLoadOnMissing = true;
public static Boolean onDemandLogOnMissing = true;
public static Int32 onDemandUnloadDelay = 10;
8 changes: 8 additions & 0 deletions src/Kopernicus/Configuration/Loader.cs
Original file line number Diff line number Diff line change
@@ -96,6 +96,14 @@ public NumericParser<Boolean> useOnDemand
set { OnDemand.OnDemandStorage.useOnDemand = value; }
}

// If the OnDemand Biome Systems are enabled
[ParserTarget("useOnDemandBiomes")]
public NumericParser<Boolean> useOnDemandBiomes
{
get { return OnDemand.OnDemandStorage.useOnDemandBiomes; }
set { OnDemand.OnDemandStorage.useOnDemandBiomes = value; }
}

// If the OnDemand System should load missing maps
[ParserTarget("onDemandLoadOnMissing")]
public NumericParser<Boolean> onDemandLoadOnMissing
8 changes: 5 additions & 3 deletions src/Kopernicus/Configuration/Parser/BuiltinTypeParsers.cs
Original file line number Diff line number Diff line change
@@ -193,6 +193,7 @@ public void SetFromString(String s)
{
// Should we use OnDemand?
Boolean useOnDemand = OnDemandStorage.useOnDemand;
Boolean useOnDemandBiomes = OnDemandStorage.useOnDemandBiomes;

if (s.StartsWith("BUILTIN/"))
{
@@ -202,7 +203,7 @@ public void SetFromString(String s)
else
{
// are we on-demand? Don't load now.
if (useOnDemand)
if (useOnDemand && typeof(T) == typeof(MapSO) || useOnDemandBiomes && typeof(T) == typeof(CBAttributeMapSO))
{
if (Utility.TextureExists(s))
{
@@ -314,7 +315,8 @@ public void SetFromString(String s)
{
// Should we use OnDemand?
Boolean useOnDemand = OnDemandStorage.useOnDemand;

Boolean useOnDemandBiomes = OnDemandStorage.useOnDemandBiomes;

if (s.StartsWith("BUILTIN/"))
{
s = s.Substring(8);
@@ -323,7 +325,7 @@ public void SetFromString(String s)
else
{
// check if OnDemand.
if (useOnDemand)
if (useOnDemand && typeof(T) == typeof(MapSO) || useOnDemandBiomes && typeof(T) == typeof(CBAttributeMapSO))
{
if (Utility.TextureExists(s))
{

0 comments on commit 65bf1f2

Please sign in to comment.