summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-10-19 15:27:00 +0200
committerkrzys-h <krzys_h@interia.pl>2014-10-19 15:27:00 +0200
commitc001c46cb53b3aedc7cbb0670f1c475679cf3d3d (patch)
tree83bf9483108240251b7e511025ea405c91daff68 /src
parent9ea0b374082b651c9147e609aa4c8e2b8a83966a (diff)
downloadcolobot-c001c46cb53b3aedc7cbb0670f1c475679cf3d3d.tar.gz
colobot-c001c46cb53b3aedc7cbb0670f1c475679cf3d3d.tar.bz2
colobot-c001c46cb53b3aedc7cbb0670f1c475679cf3d3d.zip
Small fix to 72b4228abe583cd953491575cf42bae17ff5e9d2
Diffstat (limited to 'src')
-rw-r--r--src/CBot/CBotStack.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp
index 6e5e7d8..42d5617 100644
--- a/src/CBot/CBotStack.cpp
+++ b/src/CBot/CBotStack.cpp
@@ -790,7 +790,6 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end)
while (p->m_next != NULL)
{
-
if ( p->m_instr != NULL ) instr = p->m_instr;
if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr;
if ( p->m_next->m_prog != prog ) break ;
@@ -800,7 +799,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end)
}
if ( p->m_instr != NULL ) instr = p->m_instr;
- if ( p->m_bFunc == 1 ) funct = p->m_instr;
+ if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr;
if ( funct == NULL ) return;
@@ -829,16 +828,19 @@ CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level)
if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ;
else p = p->m_next;
}
+ // Now p is the highest element on the stack
// descends upon the elements of block
while ( p != NULL && !p->m_bBlock ) p = p->m_prev;
+ // Now p is on the beggining of the top block (with local variables)
while ( p != NULL && level++ < 0 )
{
p = p->m_prev;
while ( p != NULL && !p->m_bBlock ) p = p->m_prev;
}
+ // Now p is on the block "level"
if ( p == NULL ) return NULL;