defines refactoring

This commit is contained in:
DCFApixels 2025-03-14 16:53:51 +08:00
parent d15fe38b50
commit e2dcd8a402
12 changed files with 57 additions and 21 deletions

View File

@ -1,4 +1,7 @@
using DCFApixels.DragonECS.Core; #if DISABLE_DEBUG
#undef DEBUG
#endif
using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Graphs.Internal; using DCFApixels.DragonECS.Graphs.Internal;
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -92,7 +95,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetOrNewInverseRelation(int relEntityID) public int GetOrNewInverseRelation(int relEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
var info = _relEntityInfos[relEntityID]; var info = _relEntityInfos[relEntityID];
@ -134,7 +137,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryGetInverseRelation(int relEntityID, out int inverseRelEntityID) public bool TryGetInverseRelation(int relEntityID, out int inverseRelEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
var info = _relEntityInfos[relEntityID]; var info = _relEntityInfos[relEntityID];
@ -166,7 +169,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetRelationOpposite(int relEntityID, int nodeEntityID) public int GetRelationOpposite(int relEntityID, int nodeEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
return new StartEnd(_relEntityInfos[relEntityID]).GetOpposite(nodeEntityID); return new StartEnd(_relEntityInfos[relEntityID]).GetOpposite(nodeEntityID);
@ -174,7 +177,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public StartEnd GetRelationStartEnd(int relEntityID) public StartEnd GetRelationStartEnd(int relEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
return new StartEnd(_relEntityInfos[relEntityID]); return new StartEnd(_relEntityInfos[relEntityID]);
@ -182,7 +185,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsRelationStart(int relEntityID, int nodeEntityID) public bool IsRelationStart(int relEntityID, int nodeEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
return _relEntityInfos[relEntityID].start == nodeEntityID; return _relEntityInfos[relEntityID].start == nodeEntityID;
@ -190,7 +193,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsRelationEnd(int relEntityID, int nodeEntityID) public bool IsRelationEnd(int relEntityID, int nodeEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
return _relEntityInfos[relEntityID].end == nodeEntityID; return _relEntityInfos[relEntityID].end == nodeEntityID;
@ -198,7 +201,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetRelationStart(int relEntityID) public int GetRelationStart(int relEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
return _relEntityInfos[relEntityID].start; return _relEntityInfos[relEntityID].start;
@ -206,7 +209,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetRelationEnd(int relEntityID) public int GetRelationEnd(int relEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); } if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length) { Throw.UndefinedException(); }
#endif #endif
return _relEntityInfos[relEntityID].end; return _relEntityInfos[relEntityID].end;

View File

@ -1,4 +1,7 @@
using DCFApixels.DragonECS.Graphs.Internal; #if DISABLE_DEBUG
#undef DEBUG
#endif
using DCFApixels.DragonECS.Graphs.Internal;
using System; using System;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS

View File

@ -1,4 +1,7 @@
using DCFApixels.DragonECS.Graphs.Internal; #if DISABLE_DEBUG
#undef DEBUG
#endif
using DCFApixels.DragonECS.Graphs.Internal;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {

View File

@ -1,4 +1,7 @@
using DCFApixels.DragonECS.Graphs.Internal; #if DISABLE_DEBUG
#undef DEBUG
#endif
using DCFApixels.DragonECS.Graphs.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -61,7 +64,7 @@ namespace DCFApixels.DragonECS.Graphs.Internal
private SubGraphMap ExecuteFor_Internal(EcsSpan span, JoinMode mode) private SubGraphMap ExecuteFor_Internal(EcsSpan span, JoinMode mode)
{ {
//_executeMarker.Begin(); //_executeMarker.Begin();
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (span.IsNull) { /*_executeMarker.End();*/ Throw.ArgumentNull(nameof(span)); } if (span.IsNull) { /*_executeMarker.End();*/ Throw.ArgumentNull(nameof(span)); }
if (span.WorldID != _graphWorld.ID) { /*_executeMarker.End();*/ Throw.Quiery_ArgumentDifferentWorldsException(); } if (span.WorldID != _graphWorld.ID) { /*_executeMarker.End();*/ Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif #endif

View File

@ -1,4 +1,7 @@
using System; #if DISABLE_DEBUG
#undef DEBUG
#endif
using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;

View File

@ -1,4 +1,7 @@
namespace DCFApixels.DragonECS.Graphs.Internal #if DISABLE_DEBUG
#undef DEBUG
#endif
namespace DCFApixels.DragonECS.Graphs.Internal
{ {
internal static unsafe class IntHash internal static unsafe class IntHash
{ {

View File

@ -1,4 +1,7 @@
using System.Runtime.CompilerServices; #if DISABLE_DEBUG
#undef DEBUG
#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS.Graphs.Internal namespace DCFApixels.DragonECS.Graphs.Internal

View File

@ -1,4 +1,7 @@
using System; #if DISABLE_DEBUG
#undef DEBUG
#endif
using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;

View File

@ -1,4 +1,7 @@
using System.Runtime.CompilerServices; #if DISABLE_DEBUG
#undef DEBUG
#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using TValue = System.Int32; using TValue = System.Int32;

View File

@ -1,4 +1,7 @@
using System; #if DISABLE_DEBUG
#undef DEBUG
#endif
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;

View File

@ -1,4 +1,7 @@
using System; #if DISABLE_DEBUG
#undef DEBUG
#endif
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;

View File

@ -1,4 +1,7 @@
using DCFApixels.DragonECS.Graphs.Internal; #if DISABLE_DEBUG
#undef DEBUG
#endif
using DCFApixels.DragonECS.Graphs.Internal;
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;