[colobot] 126/145: Fix using compound-assignment with an array

Didier Raboud odyx at moszumanska.debian.org
Mon Jul 11 12:56:24 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 66984a4bb3a0c3249322b85184f8d3c17953fb59
Author: melex750 <melex750 at users.noreply.github.com>
Date:   Fri Jun 24 17:00:41 2016 -0400

    Fix using compound-assignment with an array
    
    ...that was initialized in the definition
---
 src/CBot/CBotInstr/CBotDefArray.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/CBot/CBotInstr/CBotDefArray.cpp b/src/CBot/CBotInstr/CBotDefArray.cpp
index 473fdc8..c1995d9 100644
--- a/src/CBot/CBotInstr/CBotDefArray.cpp
+++ b/src/CBot/CBotInstr/CBotDefArray.cpp
@@ -121,6 +121,15 @@ CBotInstr* CBotDefArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResul
                     }
                 }
             }
+
+            if (pStk->IsOk()) while (true)       // mark initialized
+            {
+                var = var->GetItem(0, true);
+                if (var == nullptr) break;
+                if (var->GetType() == CBotTypArrayPointer) continue;
+                if (var->GetType() <= CBotTypString) var->SetInit(CBotVar::InitType::DEF);
+                break;
+            }
         }
 
         if (pStk->IsOk()) return pStack->Return(inst, pStk);

-- 
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