From 66984a4bb3a0c3249322b85184f8d3c17953fb59 Mon Sep 17 00:00:00 2001 From: melex750 Date: Fri, 24 Jun 2016 17:00:41 -0400 Subject: [PATCH] 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 473fdc8d..c1995d92 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);