From 72b4228abe583cd953491575cf42bae17ff5e9d2 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 7 Oct 2014 22:28:32 +0200 Subject: Fixed CBot debugger (#325) --- src/CBot/CBotStack.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/CBot/CBotStack.cpp') diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index 1679e5e..84472ac 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -787,8 +787,9 @@ 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 ) funct = p->m_instr; + if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr; if ( p->m_next->m_prog != prog ) break ; if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ; @@ -807,7 +808,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end) t = instr->GetToken(); start = t->GetStart(); - end = t->GetEnd(); + end = t->GetEnd(); } CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level) -- cgit v1.2.3-1-g7c22 From 9fd6cf54492cedd7f6231a0b1d0655120cb1c4d7 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 14 Oct 2014 15:11:37 +0200 Subject: Changed all occurences of PPC in the code to TerranovaTeam --- src/CBot/CBotStack.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/CBot/CBotStack.cpp') diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index 84472ac..6e5e7d8 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ //Management of the stack -- cgit v1.2.3-1-g7c22 From c001c46cb53b3aedc7cbb0670f1c475679cf3d3d Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 19 Oct 2014 15:27:00 +0200 Subject: Small fix to 72b4228abe583cd953491575cf42bae17ff5e9d2 --- src/CBot/CBotStack.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/CBot/CBotStack.cpp') 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; -- cgit v1.2.3-1-g7c22