From b1b80d3be0bc17db26e94385a1c7ddee11673720 Mon Sep 17 00:00:00 2001
From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>
Date: Sun, 31 Mar 2024 15:18:43 +0200
Subject: [PATCH] Tier0: fix DEBUG compile error

Only occurred in DEBUG as Assert otherwise gets compiled out, and CThreadSpinRWLock::m_iWriteDepth only exists when compiled with REENTRANT_THREAD_SPIN_RW_LOCK. The game does not feature this so this is not defined. Moved to the REENTRANT_THREAD_SPIN_RW_LOCK block to only check on this assert when this feature is enabled.
---
 r5dev/public/tier0/threadtools.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/r5dev/public/tier0/threadtools.h b/r5dev/public/tier0/threadtools.h
index a531269c..67fa97e8 100644
--- a/r5dev/public/tier0/threadtools.h
+++ b/r5dev/public/tier0/threadtools.h
@@ -431,9 +431,10 @@ FORCEINLINE bool CThreadSpinRWLock::TryLockForWrite()
 	if (!(curValue.m_i32 & 0x00010000) && ThreadInterlockedAssignIf((LONG*)&curValue.m_i32, 0x00010000, 0))
 	{
 		ThreadMemoryBarrier();
-		Assert(m_iWriteDepth == 0 && m_writerId == 0);
+		Assert(m_writerId == 0);
 		m_writerId = ThreadGetCurrentId();
 #ifdef REENTRANT_THREAD_SPIN_RW_LOCK
+		Assert(m_iWriteDepth == 0);
 		m_iWriteDepth++;
 #endif
 		return true;