How to detect a game has been closed

In my module which is highly automated I need to recreate main object that runs the game if the old game was closed and a new loaded or started. I would like to know how to detect a game was closed.

Without that the old object tries to work in a new environment, while it’s handles to various game pieces are of course invalid and this causes bugs.

Dominik,

I do not believe it is possible to do this using standard Vassal features.

You need to create a custom component that implements VASSAL.build.module.GameComponent and is initialised by

GameModule.getGameModule().getGameState().addGameComponent(this);

GameComponent.setup(boolean starting) is then called whenever a game loads or unloads.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks, I have did just that and it works.