diff --git a/tools/quake3/q3map2/visflow.c b/tools/quake3/q3map2/visflow.c index 6c48e2da..2c90f6c1 100644 --- a/tools/quake3/q3map2/visflow.c +++ b/tools/quake3/q3map2/visflow.c @@ -116,16 +116,15 @@ fixedWinding_t *AllocStackWinding( pstack_t *stack ){ void FreeStackWinding( fixedWinding_t *w, pstack_t *stack ){ int i; - i = w - stack->windings; - - if ( i < 0 || i > 2 ) { - return; // not from local - + for (i = 0; i < sizeof(stack->windings) / sizeof(stack->windings[0]); i++) { + if (w == &stack->windings[i]) { + if ( stack->freewindings[i] ) { + Error( "FreeStackWinding: already free" ); + } + stack->freewindings[i] = 1; + break; + } } - if ( stack->freewindings[i] ) { - Error( "FreeStackWinding: allready free" ); - } - stack->freewindings[i] = 1; } /*