be fast by default; add 'Check Sync around Unsynced Code' option in debug panel
This commit is contained in:
@@ -34,6 +34,7 @@ namespace OpenRA.GameRules
|
|||||||
public bool BotDebug = false;
|
public bool BotDebug = false;
|
||||||
public bool PerfGraph = false;
|
public bool PerfGraph = false;
|
||||||
public float LongTickThreshold = 0.001f;
|
public float LongTickThreshold = 0.001f;
|
||||||
|
public bool SanityCheckUnsyncedCode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GraphicSettings
|
public class GraphicSettings
|
||||||
|
|||||||
@@ -140,9 +140,11 @@ namespace OpenRA
|
|||||||
public static T CheckSyncUnchanged<T>( World world, Func<T> fn )
|
public static T CheckSyncUnchanged<T>( World world, Func<T> fn )
|
||||||
{
|
{
|
||||||
if( world == null ) return fn();
|
if( world == null ) return fn();
|
||||||
int sync = world.SyncHash();
|
var shouldCheckSync = Game.Settings.Debug.SanityCheckUnsyncedCode;
|
||||||
|
int sync = shouldCheckSync ? world.SyncHash() : 0;
|
||||||
bool prevInUnsyncedCode = inUnsyncedCode;
|
bool prevInUnsyncedCode = inUnsyncedCode;
|
||||||
inUnsyncedCode = true;
|
inUnsyncedCode = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return fn();
|
return fn();
|
||||||
@@ -150,7 +152,7 @@ namespace OpenRA
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
inUnsyncedCode = prevInUnsyncedCode;
|
inUnsyncedCode = prevInUnsyncedCode;
|
||||||
if( sync != world.SyncHash() )
|
if( shouldCheckSync && sync != world.SyncHash() )
|
||||||
throw new InvalidOperationException( "CheckSyncUnchanged: sync-changing code may not run here" );
|
throw new InvalidOperationException( "CheckSyncUnchanged: sync-changing code may not run here" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
|||||||
var debug = bg.GetWidget("DEBUG_PANE");
|
var debug = bg.GetWidget("DEBUG_PANE");
|
||||||
debug.GetWidget<CheckboxWidget>("PERFDEBUG_CHECKBOX").Bind(Game.Settings.Debug, "PerfGraph");
|
debug.GetWidget<CheckboxWidget>("PERFDEBUG_CHECKBOX").Bind(Game.Settings.Debug, "PerfGraph");
|
||||||
debug.GetWidget<CheckboxWidget>("GAMETIME_CHECKBOX").Bind(Game.Settings.Game, "MatchTimer");
|
debug.GetWidget<CheckboxWidget>("GAMETIME_CHECKBOX").Bind(Game.Settings.Game, "MatchTimer");
|
||||||
|
debug.GetWidget<CheckboxWidget>("CHECKUNSYNCED_CHECKBOX").Bind(Game.Settings.Debug, "SanityCheckUnsyncedCode");
|
||||||
|
|
||||||
bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => {
|
bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => {
|
||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
|
|||||||
@@ -217,3 +217,10 @@ Background@SETTINGS_MENU:
|
|||||||
Width:300
|
Width:300
|
||||||
Height:20
|
Height:20
|
||||||
Text:Show Game Time Counter
|
Text:Show Game Time Counter
|
||||||
|
Checkbox@CHECKUNSYNCED_CHECKBOX:
|
||||||
|
Id:CHECKUNSYNCED_CHECKBOX
|
||||||
|
X:0
|
||||||
|
Y:60
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Check Sync around Unsynced Code
|
||||||
|
|||||||
@@ -217,3 +217,10 @@ Background@SETTINGS_MENU:
|
|||||||
Width:300
|
Width:300
|
||||||
Height:20
|
Height:20
|
||||||
Text:Show Game Time Counter
|
Text:Show Game Time Counter
|
||||||
|
Checkbox@CHECKUNSYNCED_CHECKBOX:
|
||||||
|
Id:CHECKUNSYNCED_CHECKBOX
|
||||||
|
X:0
|
||||||
|
Y:60
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Check Sync around Unsynced Code
|
||||||
|
|||||||
Reference in New Issue
Block a user