diff --git a/src/CBot/CBotInstr/CBotInstrUtils.cpp b/src/CBot/CBotInstr/CBotInstrUtils.cpp index 05de1a47..bbe80b27 100644 --- a/src/CBot/CBotInstr/CBotInstrUtils.cpp +++ b/src/CBot/CBotInstr/CBotInstrUtils.cpp @@ -97,9 +97,9 @@ bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op) if (max == 99) return false; // result is void? // special case for strin concatenation - if (op == ID_ADD && max >= CBotTypString) return true; - if (op == ID_ASSADD && max >= CBotTypString) return true; - if (op == ID_ASS && t1 == CBotTypString) return true; + if (op == ID_ADD && t1 == CBotTypString) return true; + if (op == ID_ASSADD && t2 == CBotTypString) return true; + if (op == ID_ASS && t2 == CBotTypString) return true; if (max >= CBotTypBoolean) { diff --git a/src/CBot/CBotInstr/CBotInstrUtils.h b/src/CBot/CBotInstr/CBotInstrUtils.h index a609988d..b5302883 100644 --- a/src/CBot/CBotInstr/CBotInstrUtils.h +++ b/src/CBot/CBotInstr/CBotInstrUtils.h @@ -39,7 +39,13 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars); /*! * \brief TypeCompatible Check if two results are consistent to make an - * operation. + * operation. TypeCompatible is used in two ways: + * For non-assignment operations: see CBotTwoOpExpr::Compile + * TypeCompatible( leftType, rightType, opType ) + + * For assignment or compound assignment operations (it's reversed): + * see CBotReturn::Compile & CBotExpression::Compile + * TypeCompatible( valueType, varType, opType ) * \param type1 * \param type2 * \param op