From 44e0a1932b9374bcb8a099a242bb99fef311f1ee Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 6 Apr 2020 22:38:36 +0200 Subject: Limit the number of iterations in the hovel code --- src/game/g_buildable.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 3ed1ce6..c82677e 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1347,6 +1347,7 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx vec3_t traceOrigin, origin, forward, angles; qboolean unlink; trace_t tr; + int i = 0; BG_FindBBoxForBuildable( BA_A_HOVEL, hovelMins, hovelMaxs ); BG_FindBBoxForClass( player->client->ps.stats[ STAT_PCLASS ], @@ -1373,6 +1374,9 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx origin[ 2 ] >= globalMins[ 2 ] && origin[ 2 ] <= globalMaxs[ 2 ] ) { VectorMA( origin, 2.0f, forward, origin ); + + if ( i++ > 500 ) // Just in case.. + break; } // Make sure the spot is actually reachable. -- cgit