Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions engine/src/dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ Exec_stat MCDispatch::handle(Handler_type htype, MCNameRef mess, MCParameter *pa

if ((stat == ES_NOT_HANDLED || stat == ES_PASS) && m_externals != nil)
{
// TODO[19681]: This can be removed when all engine messages are sent with
// target.
bool t_target_was_valid = MCtargetptr.IsValid();

Exec_stat oldstat = stat;
stat = m_externals -> Handle(this, htype, mess, params);

Expand All @@ -259,7 +263,7 @@ Exec_stat MCDispatch::handle(Handler_type htype, MCNameRef mess, MCParameter *pa

if (stat == ES_PASS || stat == ES_NOT_HANDLED)
{
if (!MCtargetptr.IsValid())
if (t_target_was_valid && !MCtargetptr.IsValid())
{
stat = ES_NORMAL;
t_has_passed = false;
Expand Down Expand Up @@ -292,12 +296,16 @@ Exec_stat MCDispatch::handle(Handler_type htype, MCNameRef mess, MCParameter *pa

if ((stat == ES_NOT_HANDLED || stat == ES_PASS))
{
// TODO[19681]: This can be removed when all engine messages are sent with
// target.
bool t_target_was_valid = MCtargetptr.IsValid();

extern Exec_stat MCEngineHandleLibraryMessage(MCNameRef name, MCParameter *params);
stat = MCEngineHandleLibraryMessage(mess, params);

if (stat == ES_PASS || stat == ES_NOT_HANDLED)
{
if (!MCtargetptr.IsValid())
if (t_target_was_valid && !MCtargetptr.IsValid())
{
stat = ES_NORMAL;
t_has_passed = false;
Expand Down
6 changes: 5 additions & 1 deletion engine/src/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,10 @@ Exec_stat MCObject::handleself(Handler_type p_handler_type, MCNameRef p_message,
Exec_stat t_stat;
t_stat = ES_NOT_HANDLED;

// TODO[19681]: This can be removed when all engine messages are sent with
// target.
bool t_target_was_valid = MCtargetptr.IsValid();

MCObjectExecutionLock self_lock(this);

// Make sure this object has its script compiled.
Expand Down Expand Up @@ -1140,7 +1144,7 @@ Exec_stat MCObject::handleself(Handler_type p_handler_type, MCNameRef p_message,

if (t_stat == ES_PASS || t_stat == ES_NOT_HANDLED)
{
if (!MCtargetptr.IsValid())
if (t_target_was_valid && !MCtargetptr.IsValid())
{
t_main_stat = ES_NORMAL;
}
Expand Down
6 changes: 5 additions & 1 deletion engine/src/stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,13 +1592,17 @@ Exec_stat MCStack::handle(Handler_type htype, MCNameRef message, MCParameter *pa

if (((passing_object != nil && stat == ES_PASS) || stat == ES_NOT_HANDLED) && m_externals != nil)
{
// TODO[19681]: This can be removed when all engine messages are sent with
// target.
bool t_target_was_valid = MCtargetptr.IsValid();

Exec_stat oldstat = stat;
stat = m_externals -> Handle(this, htype, message, params);
if (oldstat == ES_PASS && stat == ES_NOT_HANDLED)
stat = ES_PASS;
if (stat == ES_PASS || stat == ES_NOT_HANDLED)
{
if (!MCtargetptr.IsValid())
if (t_target_was_valid && !MCtargetptr.IsValid())
{
stat = ES_NORMAL;
}
Expand Down