xaya / libxayagame

MIT License
21 stars 19 forks source link

Introduce Random utility and Context for GameLogic callbacks #35

Closed domob1812 closed 5 years ago

domob1812 commented 5 years ago

Introduce a Context that provides data while GameLogic callbacks are running. In particular, it gives access to a new utility instance Random, which can be used to get random numbers seeded already based on the current block (or specially for the initial state).

This also changes the callbacks themselves to be protected and named GetInitialStateInternal, ProcessForwardInternal and ProcessBackwardsInternal. The non-Internal versions are now implemented in GameLogic directly and handle management of the context before calling through to the real callbacks.