Skip to content

Commit

Permalink
Fixed misleading indentation in script.c
Browse files Browse the repository at this point in the history
Fixes #2307

Thanks to @Akkarinage
  • Loading branch information
Lemongrass3110 committed Aug 6, 2017
1 parent 70c14fa commit 43949b8
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/map/script.c
Expand Up @@ -3461,20 +3461,34 @@ void pop_stack(struct script_state* st, int start, int end)
}
data->type = C_NOP;
}

// move the rest of the elements
if( stack->sp > end )
{
memmove(&stack->stack_data[start], &stack->stack_data[end], sizeof(stack->stack_data[0])*(stack->sp - end));
for( i = start + stack->sp - end; i < stack->sp; ++i )
stack->stack_data[i].type = C_NOP;
}

// adjust stack pointers
if( st->start > end ) st->start -= end - start;
else if( st->start > start ) st->start = start;
if( st->end > end ) st->end -= end - start;
else if( st->end > start ) st->end = start;
if( stack->defsp > end ) stack->defsp -= end - start;
else if( stack->defsp > start ) stack->defsp = start;
if( st->start > end ){
st->start -= end - start;
}else if( st->start > start ){
st->start = start;
}

if( st->end > end ){
st->end -= end - start;
}else if( st->end > start ){
st->end = start;
}

if( stack->defsp > end ){
stack->defsp -= end - start;
}else if( stack->defsp > start ){
stack->defsp = start;
}

stack->sp -= end - start;
}

Expand Down

0 comments on commit 43949b8

Please sign in to comment.