HomeWildfire Games

Fix performance drop and memory leak on networked AI matches.

Description

Fix performance drop and memory leak on networked AI matches.

When playing a network game with at least one AI, and an AI dies, after a while there will be an increasing lag on the system, eventually freezing the screen for e.g. 4 seconds every 5 seconds.
It turned out that once the AI is dead, the savedEvents grew endlessly. Causing issues down the line (hashing).

That is now fixed by discarding savedEvents when the AI is defeated.

Patch by: @lairkers
Differential revision: https://code.wildfiregames.com/D5042
Comments by: @phosit, @wraitii