[colobot] 12/74: Fix RestoreState for subclass instance vars

Didier Raboud odyx at moszumanska.debian.org
Mon Nov 7 07:50:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 397e3124246a67ddb9b7f16b1fecdda6abd3f3cd
Author: melex750 <melex750 at users.noreply.github.com>
Date:   Wed Aug 3 17:52:53 2016 -0400

    Fix RestoreState for subclass instance vars
---
 src/CBot/CBotStack.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp
index 27c648f..aa67264 100644
--- a/src/CBot/CBotStack.cpp
+++ b/src/CBot/CBotStack.cpp
@@ -19,6 +19,8 @@
 
 #include "CBot/CBotStack.h"
 
+#include "CBot/CBotClass.h"
+
 #include "CBot/CBotInstr/CBotFunction.h"
 
 #include "CBot/CBotVar/CBotVarPointer.h"
@@ -866,10 +868,11 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
                     if (isClass && p == nullptr) // set id for each item in this instance
                     {
                         CBotVar* pVars = pNew->GetItemList();
-                        long itemId = 1;
-                        while (pVars != nullptr)
+                        CBotVar* pv = pNew->GetClass()->GetVar();
+                        while (pVars != nullptr && pv != nullptr)
                         {
-                            pVars->m_ident = itemId++;
+                            pVars->m_ident = pv->m_ident;
+                            pv = pv->GetNext();
                             pVars = pVars->GetNext();
                         }
                     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list