triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.3k stars 387 forks source link

Fix "Can't remove more than" error due to save game purchase code. #12578

Closed asvitkine closed 2 months ago

asvitkine commented 2 months ago

This would happen for a joined player because end() wasn't being called on the delegate object.

Also some code cleanup.

Fixes: https://github.com/triplea-game/triplea/issues/12360

Notes to Reviewer

Cernelius commented 2 months ago

I don't know if it is related, but in "270BC Wars" I have triggers removing a huge amount of PUs just because it is not possible to have triggers removing all PUs of a player (so I just set a huge amount to be sure to remove them all). That would be a nice feature to have (a trigger removing all PUs of the attached), but I never made a request for it because the hack appeared to work well enough (and because feature requests are very rarely taken into consideration).

asvitkine commented 2 months ago

I don't know if it is related, but in "270BC Wars" I have triggers removing a huge amount of PUs just because it is not possible to have triggers removing all PUs of a player (so I just set a huge amount to be sure to remove them all). That would be a nice feature to have (a trigger removing all PUs of the attached), but I never made a request for it because the hack appeared to work well enough (and because feature requests are very rarely taken into consideration).

That's unrelated.