Hello!
Apologies if this has already been brought up somewhere, but I found a crash in the scriptstdstring addon when attempting to use a concatenated string as part of a nested conditional expression. I am using Angelscript for the AI in an RTS game, and I had this to let the script show a label for the units:
string s = "Status: " +
(
(m_actionState == AS_MOVETO) ? "moving" :
(m_actionState == AS_FIRE_AT_POINT) ? "firing at point" :
(m_actionState == AS_FIRE_AT_UNIT) ? "firing at unit" :
"idle"
)
+ "\n";
... and that worked fine, so I am assuming the problem is not with the nesting of conditional expressions per se.
Next I wanted to show the current speed of movement, so I changed the "moving" part to a concatenated string like this:
string s = "Status: " +
(
(m_actionState == AS_MOVETO) ? ("moving"+10) :
(m_actionState == AS_FIRE_AT_POINT) ? "firing at point" :
(m_actionState == AS_FIRE_AT_UNIT) ? "firing at unit" :
"idle"
)
+ "\n";
...and this caused a crash in the CopyConstructString function. It appears that the 'other' parameter being given to the function is not a string. Obviously the literal 10 is not the value I really want to use, but after some experimentation I narrowed the problem down to the presence of the concatenation operator. It also crashed with concatenation of two strings.
If the branch of the conditional with the concatenation was never used (eg. no units ever entered the AS_MOVETO state), the program would run ok but random garbage characters would show for the text, and a crash would subsequently occur when releasing the asIScriptEngine object.
This is trivial to work around and is not causing me any real problems, but it seems pretty odd so I thought I would report it anyway.