Update object variable when concatenating strings
parent
30210d0de7
commit
15b8cf7f78
src/CBot/CBotInstr
|
@ -405,9 +405,20 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
|
||||||
// creates a variable for the result
|
// creates a variable for the result
|
||||||
CBotVar* result = CBotVar::Create("", TypeRes);
|
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
|
// creates a variable to perform the calculation in the appropriate type
|
||||||
if ( TypeRes != CBotTypString ) // keep string conversion
|
if ( TypeRes != CBotTypString ) // keep string conversion
|
||||||
|
{
|
||||||
TypeRes = std::max(type1.GetType(), type2.GetType());
|
TypeRes = std::max(type1.GetType(), type2.GetType());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
left->Update(nullptr);
|
||||||
|
right->Update(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) )
|
if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) )
|
||||||
{
|
{
|
||||||
|
@ -422,8 +433,6 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
|
||||||
|
|
||||||
CBotError err = CBotNoErr;
|
CBotError err = CBotNoErr;
|
||||||
// is a operation according to request
|
// is a operation according to request
|
||||||
CBotVar* left = pStk1->GetVar();
|
|
||||||
CBotVar* right = pStk2->GetVar();
|
|
||||||
|
|
||||||
switch (GetTokenType())
|
switch (GetTokenType())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue