diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2020-04-06 22:38:36 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2020-04-06 22:39:23 +0200 |
commit | 44e0a1932b9374bcb8a099a242bb99fef311f1ee (patch) | |
tree | 48e1d33925539d004e11eb47b5c73b33fcad5c75 | |
parent | 343897983cbce7488c63c1cbb50c3ebce3ed2252 (diff) |
Limit the number of iterations in the hovel code
-rw-r--r-- | src/game/g_buildable.c | 4 |
1 files changed, 4 insertions, 0 deletions
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. |