Update object variable when concatenating strings

dev-buzzingcars
melex750 2017-05-25 02:09:44 -04:00
parent 30210d0de7
commit 15b8cf7f78
1 changed files with 11 additions and 2 deletions

View File

@ -405,9 +405,20 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
// creates a variable for the result
CBotVar* result = CBotVar::Create("", TypeRes);
// get left and right operands
CBotVar* left = pStk1->GetVar();
CBotVar* right = pStk2->GetVar();
// creates a variable to perform the calculation in the appropriate type
if ( TypeRes != CBotTypString ) // keep string conversion
{
TypeRes = std::max(type1.GetType(), type2.GetType());
}
else
{
left->Update(nullptr);
right->Update(nullptr);
}
if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) )
{
@ -422,8 +433,6 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
CBotError err = CBotNoErr;
// is a operation according to request
CBotVar* left = pStk1->GetVar();
CBotVar* right = pStk2->GetVar();
switch (GetTokenType())
{