Skip to content
Open
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
9 changes: 7 additions & 2 deletions code/tag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ void TagClass::Delete_All(void)
/// <param name="global">The global flag that just changed.</param>
void TagClass::Timer_Global_Reset(int global)
{
Trigger->Reset_Global_Linked_Timed_Events(global);
// A tag outlives a destroyed trigger with no link to take its place.
if (Trigger != nullptr) {
Trigger->Reset_Global_Linked_Timed_Events(global);
}
}


Expand All @@ -357,7 +360,9 @@ void TagClass::Timer_Global_Reset(int global)
/// <param name="local">The local variable that just changed.</param>
void TagClass::Timer_Local_Reset(int local)
{
Trigger->Reset_Local_Linked_Timed_Events(local);
if (Trigger != nullptr) {
Trigger->Reset_Local_Linked_Timed_Events(local);
}
}


Expand Down
12 changes: 12 additions & 0 deletions manual/changes/tag-timer-reset-without-trigger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Survive a variable change while a tag has lost its trigger
category: fix
release: 0.2.0
targets:
- type: system
id: trigger-springing
effect: changed
credit: [gibbo101]
---

A tag whose trigger has been destroyed keeps a null trigger when the destroyed one had no linked trigger to take its place. A trigger action that set a local or global variable then restarted every tag's timed events through that null trigger and crashed the game. The reset now skips a tag without a trigger, so the action completes and the other tags' timers restart as before.