Skip to content

Commit 328bebe

Browse files
Fix event parsing by setting flags to zero before loading. (#3363)
1 parent 94e4f3d commit 328bebe

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

code/mission/missionparse.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5065,6 +5065,9 @@ void parse_event(mission * /*pm*/)
50655065
}
50665066
}
50675067

5068+
// Need to set this to zero so that we don't accidentally reuse old data.
5069+
event->flags = 0;
5070+
50685071
if (optional_string("+Event Flags:")) {
50695072
parse_string_flag_list(&event->flags, Mission_event_flags, Num_mission_event_flags);
50705073
}

code/parse/parselo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,6 +2790,9 @@ size_t stuff_token_list(T *listp, size_t list_max, F stuff_one_token, const char
27902790
return i;
27912791
}
27922792

2793+
// If this data is going to be parsed multiple times (like for mission load), then the dest variable
2794+
// needs to be set to zero in between parses, otherwise we keep bad data.
2795+
// For tbm files, it must not be reset.
27932796
void parse_string_flag_list(int *dest, flag_def_list defs[], size_t defs_size)
27942797
{
27952798
Assert(dest!=NULL); //wtf?

0 commit comments

Comments
 (0)