Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): count logic reads inside the overlap window

Olcay Seygan91b7b507bb8b
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h b/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h
index 85a394e92..74ff7d314 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h
@@ -112,6 +112,7 @@ class RecursiveLock
unsigned int m_depth = 0; ///< read and written by the holder only
std::mutex m_parkMutex; ///< guards the sleep, not the lock
std::condition_variable m_parkCv;
+ std::atomic<unsigned long long> m_contended{ 0 }; ///< enters that found the lock held (LOGIC-THREAD.md phase 3)
static uintptr_t self()
{
@@ -140,6 +141,7 @@ class RecursiveLock
void lockContended()
{
+ m_contended.fetch_add( 1, std::memory_order_relaxed );
for (int spin = 0; spin < 128; ++spin)
{
cpuRelax();
@@ -168,6 +170,8 @@ class RecursiveLock
}
public:
+ unsigned long long contended() const { return m_contended.load( std::memory_order_relaxed ); }
+
void lock()
{
const uintptr_t me = self();
@@ -202,10 +206,13 @@ class RecursiveUnfairLock
os_unfair_lock m_lock = OS_UNFAIR_LOCK_INIT;
std::atomic<uintptr_t> m_owner{ 0 }; ///< the holder's pthread_self(), 0 when free
unsigned int m_depth = 0; ///< read and written by the holder only
+ std::atomic<unsigned long long> m_contended{ 0 }; ///< enters that found the lock held (LOGIC-THREAD.md phase 3)
static uintptr_t self() { return reinterpret_cast<uintptr_t>( pthread_self() ); }
public:
+ unsigned long long contended() const { return m_contended.load( std::memory_order_relaxed ); }
+
void lock()
{
const uintptr_t me = self();
@@ -216,7 +223,11 @@ public:
++m_depth;
return;
}
- os_unfair_lock_lock( &m_lock );
+ if (!os_unfair_lock_trylock( &m_lock ))
+ {
+ m_contended.fetch_add( 1, std::memory_order_relaxed );
+ os_unfair_lock_lock( &m_lock );
+ }
m_owner.store( me, std::memory_order_relaxed );
m_depth = 1;
}
@@ -257,6 +268,11 @@ class CriticalSection
#endif
}
+ public:
+ /** How many enters found another thread holding it, since the start. The logic thread's report
+ * prints the memory pools' (LOGIC-THREAD.md hazard 13). */
+ unsigned long long getContendedCount( void ) const { return m_mutex.contended(); }
+
public: // Use these when entering/exiting a critical section.
void enter( void )
{
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
index cd35ecc6c..ddd894300 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
@@ -30,6 +30,7 @@
#include "Lib/BaseType.h"
#include "Common/GameType.h"
+#include <atomic>
#include <functional>
#include <vector>
@@ -91,6 +92,49 @@ namespace LogicThread
noteCensus( channel );
}
+ /** LOGIC-THREAD.md phase 3, step 2. The overlap window is the part of the main thread's pass that
+ * will run beside the tick: W3DDisplay::draw from after the particle update to after End_Render
+ * (phase 0's "render"). It is marked at every setting, and these accessors of state logic owns
+ * count a call made from inside it, one count each, into HEADLESS LOGICTHREAD WINDOW. Every count
+ * is a read the render has to take from a copy made at the sync point before the tick may run
+ * beside it. A call from any other thread or place costs an atomic flag's load. */
+ enum WindowRead
+ {
+ WINDOW_DRAWABLE_OBJECT, ///< Drawable::getObject: the render's way into an Object
+ WINDOW_FIND_OBJECT, ///< GameLogic::findObjectByID
+ WINDOW_OBJECT_LIST, ///< GameLogic::getFirstObject, a walk of logic's object list
+ WINDOW_LOGIC_FRAME, ///< GameLogic::getFrame, which the tick advances
+ WINDOW_THING, ///< Thing::getPosition and getTransformMatrix: an Object's, or a Drawable's the tick writes at once
+ WINDOW_SHROUD, ///< PartitionData::getShroudedStatus, a cache it fills
+ WINDOW_PARTITION, ///< PartitionManager's cell shroud reads
+ WINDOW_TERRAIN, ///< TerrainLogic's heights and water
+ WINDOW_PLAYER, ///< PlayerList::getNthPlayer
+ WINDOW_RADAR_OBJECT, ///< RadarObject::friend_getObject, the radar's list of Objects
+ WINDOW_COUNT
+ };
+
+ /** TRUE while the main thread is inside the window; read first, so every other caller pays this load. */
+ extern std::atomic<Int> g_windowOpen;
+ void noteWindow( WindowRead read );
+
+ inline void windowRead( WindowRead read )
+ {
+ if( g_windowOpen.load( std::memory_order_relaxed ) && !t_isLogicThread )
+ noteWindow( read );
+ }
+
+ /** The window's span on the main thread, closed when it goes out of scope (a continue included). */
+ class OverlapWindow
+ {
+ public:
+ OverlapWindow( void ) : m_open( FALSE ) {}
+ ~OverlapWindow( void ) { close(); }
+ void open( void );
+ void close( void );
+ private:
+ Bool m_open;
+ };
+
/** Read -logicthread and start the thread if it asks for one. Called once, from GameEngine::init. */
void init( void );
@@ -177,6 +221,7 @@ namespace LogicThread
} // namespace LogicThread
#define LOGIC_CENSUS( channel ) LogicThread::census( LogicThread::channel )
+#define LOGIC_WINDOW_READ( read ) LogicThread::windowRead( LogicThread::read )
/** LOGIC-THREAD.md phase 2, M6. First line of a client entry point logic calls: inside a tick the
* call queues itself (a lambda calling the function again with copies of its arguments) and returns;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h
index b92260650..da5112011 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/Radar.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/Radar.h
@@ -38,6 +38,7 @@
#include "Lib/BaseType.h"
#include "Common/SubsystemInterface.h"
#include "Common/GameMemory.h"
+#include "Common/LogicThread.h"
#include "GameClient/Display.h" // for ShroudLevel
#include "GameClient/Color.h"
@@ -103,8 +104,8 @@ public:
inline Color getColor( void ) const { return m_color; }
inline void friend_setObject( Object *obj ) { m_object = obj; }
- inline Object *friend_getObject( void ) { return m_object; }
- inline const Object *friend_getObject( void ) const { return m_object; }
+ inline Object *friend_getObject( void ) { LOGIC_WINDOW_READ( WINDOW_RADAR_OBJECT ); return m_object; }
+ inline const Object *friend_getObject( void ) const { LOGIC_WINDOW_READ( WINDOW_RADAR_OBJECT ); return m_object; }
inline void friend_setNext( RadarObject *next ) { m_next = next; }
inline RadarObject *friend_getNext( void ) { return m_next; }
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Thing.h b/GeneralsMD/Code/GameEngine/Include/Common/Thing.h
index 7608741fd..00c9e3754 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/Thing.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/Thing.h
@@ -60,6 +60,7 @@
//-----------------------------------------------------------------------------
#include "Common/GameMemory.h"
#include "Common/KindOf.h"
+#include "Common/LogicThread.h"
#include "Common/Override.h"
#include "WWMath/matrix3d.h" ///< @todo Decide if we're keeping the WWMath libs (MSB)
@@ -121,7 +122,7 @@ public:
// don't want this behavior? then call setTransformMatrix instead.
void setOrientation( Real angle );
- inline const Coord3D *getPosition() const { return &m_cachedPos; }
+ inline const Coord3D *getPosition() const { LOGIC_WINDOW_READ( WINDOW_THING ); return &m_cachedPos; }
inline Real getOrientation() const { return m_cachedAngle; }
/// for a load: the angle as it stood when saved, which the one setTransformMatrix derives from the matrix is a few bits off
void restoreOrientation( Real angle ) { m_cachedAngle = angle; m_cacheFlags &= ~VALID_DIRVECTOR; }
@@ -143,7 +144,7 @@ public:
void convertBonePosToWorldPos(const Coord3D* bonePos, const Matrix3D* boneTransform, Coord3D* worldPos, Matrix3D* worldTransform) const;
void setTransformMatrix( const Matrix3D *mx ); ///< set the world transformation matrix
- const Matrix3D* getTransformMatrix() const { return &m_transform; } ///< return the world transformation matrix
+ const Matrix3D* getTransformMatrix() const { LOGIC_WINDOW_READ( WINDOW_THING ); return &m_transform; } ///< return the world transformation matrix
void transformPoint( const Coord3D *in, Coord3D *out ); ///< transform this point using the m_transform matrix of this thing
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
index cdcec8334..4df96c7e2 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
@@ -385,8 +385,8 @@ public:
void setTerrainDecalSize(Real x, Real y);
void setTerrainDecalFadeTarget(Real target, Real rate = ConvertRetailPerFrameRate(0.1f)); ///< rate is opacity per logic frame
- inline Object *getObject( void ) { return m_object; } ///< return object ID bound to this drawble
- inline const Object *getObject( void ) const { return m_object; } ///< return object ID bound to this drawble
+ inline Object *getObject( void ) { LOGIC_WINDOW_READ( WINDOW_DRAWABLE_OBJECT ); return m_object; } ///< return object ID bound to this drawble
+ inline const Object *getObject( void ) const { LOGIC_WINDOW_READ( WINDOW_DRAWABLE_OBJECT ); return m_object; } ///< return object ID bound to this drawble
inline DrawableInfo *getDrawableInfo(void) {return &m_drawableInfo;}
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h
index c669f1ff6..f28139ec3 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h
@@ -36,6 +36,7 @@
#include "Common/GameCommon.h" // ensure we get DUMP_PERF_STATS, or not
#include "Common/GameType.h"
+#include "Common/LogicThread.h"
#include "Common/Snapshot.h"
#include "Common/STLTypedefs.h"
#include "Common/ObjectStatusTypes.h"
@@ -493,7 +494,7 @@ inline void GameLogic::setWidth( Real width ) { m_width = width; }
inline Real GameLogic::getWidth( void ) { return m_width; }
inline void GameLogic::setHeight( Real height ) { m_height = height; }
inline Real GameLogic::getHeight( void ) { return m_height; }
-inline UnsignedInt GameLogic::getFrame( void ) { return m_frame; }
+inline UnsignedInt GameLogic::getFrame( void ) { LOGIC_WINDOW_READ( WINDOW_LOGIC_FRAME ); return m_frame; }
inline Bool GameLogic::isInGame( void ) { return !(m_gameMode == GAME_NONE); }
@@ -521,6 +522,7 @@ inline UnsignedShort GameLogic::getSuperweaponRestriction() const { return m_sup
inline Object* GameLogic::findObjectByID( ObjectID id )
{
+ LOGIC_WINDOW_READ( WINDOW_FIND_OBJECT );
if( id == INVALID_ID )
return NULL;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
index 52ad94fa3..0e09d860f 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
@@ -102,8 +102,9 @@ PlayerList::~PlayerList()
}
//-----------------------------------------------------------------------------
-Player *PlayerList::getNthPlayer(Int i)
-{
+Player *PlayerList::getNthPlayer(Int i)
+{
+ LOGIC_WINDOW_READ( WINDOW_PLAYER );
if( !isValidPlayerIndex( i ) )
{
// DEBUG_CRASH( ("Illegal player index\n") );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
index b95f3b928..1f450bd38 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
@@ -24,6 +24,7 @@
#include "PreRTS.h"
#include "Common/LogicThread.h"
#include "Common/AudioEventRTS.h"
+#include "Common/CriticalSection.h"
#include "Common/EarlyCommandLine.h"
#include "Common/GameAudio.h"
#include "Common/MessageStream.h"
@@ -41,6 +42,7 @@
#include <condition_variable>
#include <exception>
#include <mutex>
+#include <random>
#include <thread>
#include <vector>
#if defined(_WIN32)
@@ -48,6 +50,7 @@
#endif
thread_local Bool LogicThread::t_isLogicThread = FALSE;
+std::atomic<Int> LogicThread::g_windowOpen( 0 );
namespace
{
@@ -83,6 +86,26 @@ namespace
const Int HANDOFF_BUCKETS = 1001;
Int s_handoffHistogram[ HANDOFF_BUCKETS ] = { 0 };
+ // phase 3 step 2: reads of logic state from inside the overlap window, and how many windows there were
+ std::atomic<Int64> s_windowReads[ LogicThread::WINDOW_COUNT ];
+ Int64 s_windows = 0;
+ const char *const WINDOW_NAMES[ LogicThread::WINDOW_COUNT ] =
+ {
+ "drawableobject", "findobject", "objectlist", "logicframe", "thing", "shroud", "partition",
+ "terrain", "player", "radarobject"
+ };
+
+ // -logicthread 2: 1 with a jitter on both sides of the handoff, so the races step 3 must not have
+ // meet more orders. A generator per thread and of its own: nothing here may touch a game stream.
+ Int s_mode = 0;
+ void jitter( void )
+ {
+ if( s_mode < 2 )
+ return;
+ static thread_local std::minstd_rand random( (unsigned)LogicClock::now().time_since_epoch().count() );
+ std::this_thread::sleep_for( std::chrono::microseconds( random() % 2000 ) );
+ }
+
const char *const CHANNEL_NAMES[ LogicThread::CENSUS_COUNT ] =
{
"drawable", "modelcondition", "audio", "ingameui", "controlbar", "tacticalview", "radar",
@@ -183,6 +206,7 @@ namespace
break;
s_tickPending = FALSE;
}
+ jitter();
const LogicClock::time_point t0 = LogicClock::now();
std::exception_ptr error;
@@ -238,6 +262,29 @@ void LogicThread::noteCensus( Channel channel )
++s_census[ channel ];
}
+//-------------------------------------------------------------------------------------------------
+void LogicThread::noteWindow( WindowRead read )
+{
+ s_windowReads[ read ].fetch_add( 1, std::memory_order_relaxed );
+}
+
+//-------------------------------------------------------------------------------------------------
+void LogicThread::OverlapWindow::open( void )
+{
+ m_open = TRUE;
+ ++s_windows;
+ g_windowOpen.store( 1, std::memory_order_relaxed );
+}
+
+//-------------------------------------------------------------------------------------------------
+void LogicThread::OverlapWindow::close( void )
+{
+ if( !m_open )
+ return;
+ m_open = FALSE;
+ g_windowOpen.store( 0, std::memory_order_relaxed );
+}
+
//-------------------------------------------------------------------------------------------------
void LogicThread::init( void )
{
@@ -246,6 +293,7 @@ void LogicThread::init( void )
return;
s_enabled = TRUE;
+ s_mode = atoi( value );
#if defined(_WIN32)
// there is no getter: setting returns the one before, which goes straight back
s_seTranslator = _set_se_translator( NULL );
@@ -304,6 +352,7 @@ void LogicThread::runTick( void )
tickMS = s_tickMS;
}
const LogicClock::time_point t1 = LogicClock::now();
+ jitter();
// The inline tick left this thread's FPU in setFPMode's state; keep the main thread as it was at 0.
setFPMode();
@@ -452,4 +501,13 @@ void LogicThread::report( void )
for( Int i = 0; i < CENSUS_COUNT; ++i )
used += snprintf( line + used, sizeof(line) - used, "%s%s %lld", i ? " | " : "", CHANNEL_NAMES[ i ], (long long)s_census[ i ] );
DEBUG_LOG(( "HEADLESS LOGICTHREAD CENSUS: %s\n", line ));
+ used = 0;
+ for( Int i = 0; i < WINDOW_COUNT; ++i )
+ used += snprintf( line + used, sizeof(line) - used, " | %s %lld", WINDOW_NAMES[ i ], (long long)s_windowReads[ i ].load() );
+ DEBUG_LOG(( "HEADLESS LOGICTHREAD WINDOW: %lld windows%s\n", (long long)s_windows, line ));
+
+ // hazard 13: the pools' one lock, and the dynamic allocator's in front of global new
+ DEBUG_LOG(( "HEADLESS LOGICTHREAD LOCKS: memory pool %llu contended enters, dma %llu\n",
+ TheMemoryPoolCriticalSection ? TheMemoryPoolCriticalSection->getContendedCount() : 0ull,
+ TheDmaCriticalSection ? TheDmaCriticalSection->getContendedCount() : 0ull ));
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp
index 26f2487eb..ddf01df40 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp
@@ -2216,6 +2216,7 @@ Coord3D TerrainLogic::findFarthestEdgePoint( const Coord3D *farthestFrom ) const
//-------------------------------------------------------------------------------------------------
Bool TerrainLogic::isUnderwater( Real x, Real y, Real *waterZ, Real *terrainZ )
{
+ LOGIC_WINDOW_READ( WINDOW_TERRAIN );
// get the water handle at this location
const WaterHandle *waterHandle = getWaterHandle( x, y );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
index cd91fe428..255b992ad 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
@@ -1746,6 +1746,7 @@ void PartitionData::friend_setShroudednessPrevious(Int playerIndex, ObjectShroud
//-----------------------------------------------------------------------------
ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex)
{
+ LOGIC_WINDOW_READ( WINDOW_SHROUD );
// sanity
DEBUG_ASSERTCRASH( playerIndex >= 0 && playerIndex < MAX_PLAYER_COUNT,
("PartitionData::getShroudedStatus - Invalid player index '%d'\n", playerIndex) );
@@ -3262,6 +3263,7 @@ void PartitionManager::refreshShroudForLocalPlayer()
//-----------------------------------------------------------------------------
CellShroudStatus PartitionManager::getShroudStatusForPlayer(Int playerIndex, Int x, Int y) const
{
+ LOGIC_WINDOW_READ( WINDOW_PARTITION );
if( playerIndex < 0 )
return CELLSHROUD_SHROUDED;// Safety. There are no Negative players, but PlayerIndex is typedef'd to Int, not UnsignedInt
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index a71cfaba7..4fed8ef6d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -5063,6 +5063,7 @@ void GameLogic::update( void )
// ------------------------------------------------------------------------------------------------
Object *GameLogic::getFirstObject( void )
{
+ LOGIC_WINDOW_READ( WINDOW_OBJECT_LIST );
return m_objList;
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
index bf768528c..6cd038a98 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
@@ -2519,6 +2519,9 @@ AGAIN:
#ifdef DEBUG_LOGGING
Int64 tOverlapStart = 0; // the part a logic thread could run beside, TheOverlapWindowMS
#endif
+ // the same span, marked for LOGIC-THREAD.md phase 3's count of logic reads made inside it;
+ // closed below after End_Render, or here at the end of the pass when a continue skips that
+ LogicThread::OverlapWindow overlapWindow;
{
if(TheGlobalData->m_loadScreenRender != TRUE)
@@ -2566,6 +2569,7 @@ AGAIN:
TheParticleUpdateMS = w3dElapsedMS( tParticleStart, tParticleEnd );
tOverlapStart = tParticleEnd;
#endif
+ overlapWindow.open();
// R1: after the particles read the logic bones (Lorenzen's note above), before anything renders.
smoothMotionApply();
@@ -2814,6 +2818,7 @@ AGAIN:
if (tOverlapStart)
TheOverlapWindowMS += w3dElapsedMS( tOverlapStart, Clock_Ticks() );
#endif
+ overlapWindow.close();
if (TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript() || TheGameLogic->isGamePaused())
{
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp
index 8682b13c2..536301d6a 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp
@@ -28,6 +28,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "Common/GameMemory.h"
+#include "Common/LogicThread.h"
#include "W3DDevice/GameClient/HeightMap.h"
#include "W3DDevice/GameLogic/W3DTerrainLogic.h"
#include "W3DDevice/GameClient/WorldHeightMap.h"
@@ -279,6 +280,7 @@ Bool W3DTerrainLogic::isClearLineOfSight(const Coord3D& pos, const Coord3D& posO
//-------------------------------------------------------------------------------------------------
Real W3DTerrainLogic::getGroundHeight( Real x, Real y, Coord3D* normal ) const
{
+ LOGIC_WINDOW_READ( WINDOW_TERRAIN );
#define USE_THE_TERRAIN_OBJECT
#ifdef USE_THE_TERRAIN_OBJECT
if (TheTerrainRenderObject)
@@ -304,6 +306,7 @@ Real W3DTerrainLogic::getGroundHeight( Real x, Real y, Coord3D* normal ) const
//-------------------------------------------------------------------------------------------------
Real W3DTerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, Coord3D* normal, Bool clip ) const
{
+ LOGIC_WINDOW_READ( WINDOW_TERRAIN );
#ifdef USE_THE_TERRAIN_OBJECT
if (!TheTerrainRenderObject)