Skip to content

Commit 9b9108d

Browse files
authored
fix order of events in instance_create_depth (#470)
1 parent 22b92c8 commit 9b9108d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/runner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ Instance* Runner_createInstanceWithDepth(Runner* runner, GMLReal x, GMLReal y, i
24422442
if (isObjectDisabled(runner, objectIndex)) return nullptr;
24432443
Instance* inst = createAndInitInstance(runner, runner->nextInstanceId++, objectIndex, x, y);
24442444
inst->depth = depth;
2445-
dispatchInstanceCreationEvents(runner, inst);
2445+
Runner_executeEvent(runner, inst, EVENT_PRECREATE, 0);
24462446
return inst;
24472447
}
24482448

src/vm_builtins.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8420,6 +8420,9 @@ static RValue builtin_instance_create_depth(VMContext* ctx, RValue* args, int32_
84208420
copyBasisStructVars(ctx, inst, basisInst);
84218421
}
84228422

8423+
Runner_executeEvent(runner, inst, EVENT_CREATE, 0);
8424+
inst->createEventFired = true;
8425+
84238426
if (callerInst != nullptr && ctx->creatorVarID >= 0) {
84248427
Instance_setSelfVar(inst, ctx->creatorVarID, RValue_makeReal((GMLReal) callerInst->instanceId));
84258428
}

0 commit comments

Comments
 (0)