aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-code.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/director/lingo/lingo-code.cpp')
-rw-r--r--engines/director/lingo/lingo-code.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index fa7642651f..ab42c0d3de 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -175,15 +175,20 @@ void Lingo::c_assign() {
if (d1.u.sym->type == STRING) // Free memory if needed
delete d1.u.sym->u.s;
- if (d2.type == INT)
+ if (d1.u.sym->type == POINT || d1.u.sym->type == RECT || d1.u.sym->type == ARRAY)
+ delete d1.u.sym->u.arr;
+
+ if (d2.type == INT) {
d1.u.sym->u.i = d2.u.i;
- else if (d2.type == FLOAT)
+ } else if (d2.type == FLOAT) {
d1.u.sym->u.f = d2.u.f;
- else if (d2.type == STRING)
+ } else if (d2.type == STRING) {
d1.u.sym->u.s = new Common::String(*d2.u.s);
- else if (d2.type == POINT)
- d1.u.sym->u.arr = d2.u.arr;
- else if (d2.type == SYMBOL)
+ delete d2.u.s;
+ } else if (d2.type == POINT) {
+ d1.u.sym->u.arr = new FloatArray(*d2.u.arr);
+ delete d2.u.arr;
+ } else if (d2.type == SYMBOL) {
d1.u.sym->u.i = d2.u.i;
else
error("c_assign: unhandled type: %s", d2.type2str());