Page 2 of 2
Re: How to detect game end
Posted: 16 February 2024, 21:00
by thoun
Tisaac wrote: ↑16 February 2024, 20:48
thoun wrote: ↑16 February 2024, 13:31
I use this in getAllDatas :
$isEndScore = intval($this->gamestate->state_id()) >= ST_END_SCORE;
Wouldnt that be dangereous if you use state with ids > 100 ?
Yes of course you'll need to adapt the code if your state numbers aren't ordered
Re: How to detect game end
Posted: 17 February 2024, 00:12
by AxeCrazy
My problem is not te detection of the endgame.(Yes, perhaps i should have created a new thread

)
That works as it should and also the scoring is displayed oke.
My problem is the final state of the board.
This is saved correctly before switching to endgame stae in the backend, but this state does not become available in the frontend.
So i cannot change the final state of the board.
When pressing F5 the final state is displayed correctly.
Was thinking about overriding the argendgame function, but this is not recommended.
And the board in the gamestate object is not modified at each state event.
Any ideas on how to get the final board state to the frontend?
Re: How to detect game end
Posted: 17 February 2024, 08:56
by Tisaac
AxeCrazy wrote: ↑17 February 2024, 00:12
My problem is not te detection of the endgame.(Yes, perhaps i should have created a new thread

)
That works as it should and also the scoring is displayed oke.
My problem is the final state of the board.
This is saved correctly before switching to endgame stae in the backend, but this state does not become available in the frontend.
So i cannot change the final state of the board.
When pressing F5 the final state is displayed correctly.
Was thinking about overriding the argendgame function, but this is not recommended.
And the board in the gamestate object is not modified at each state event.
Any ideas on how to get the final board state to the frontend?
Not sure to understand, why dont you send notification ?
Re: How to detect game end
Posted: 17 February 2024, 10:00
by AxeCrazy
Eureka!
Thats it.
As said, first game, so nothing is obvious.
Thanx a lot!