Calling updatePageTitle() from within onUpdateActionButtons()

Game development with Board Game Arena Studio
Post Reply
User avatar
SardaukarWI
Posts: 28
Joined: 15 December 2020, 14:54

Calling updatePageTitle() from within onUpdateActionButtons()

Post by SardaukarWI »

I'm currently trying to call updatePageTitle() from within onUpdateActionButtons(). But it appears that calling this function causes onUpdateActionButtons() to be called again. So I get into an infinite loop and that results in a stack overflow. Now before I go and set a flag to simply ignore this second call, I wanted to ask if there was a better way to handle this?

The game I'm working on has many unique cards that players will need to react to and what they need to do is different for each card. Instead of having dozens of different states on the server, I am having a single state for "cardPlayed" which passes down which card was played as an arg. Then the client can put up a unique "descriptionmyturn" message instructing the player what they need to do to respond to it. onUpdateActionButtons() is called for each active player in this mutipleactivestate, so this seems to be the appropriate place to set the title message.

Thanks for your feedback.
User avatar
RavingWanderer
Posts: 83
Joined: 12 May 2020, 16:08

Re: Calling updatePageTitle() from within onUpdateActionButtons()

Post by RavingWanderer »

I ended up using a flag to prevent this.
User avatar
SardaukarWI
Posts: 28
Joined: 15 December 2020, 14:54

Re: Calling updatePageTitle() from within onUpdateActionButtons()

Post by SardaukarWI »

That's what I ended up doing as well. I was hoping there was something I was missing or was undocumented.
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: Calling updatePageTitle() from within onUpdateActionButtons()

Post by Benoit314 »

You could also do a client state transition with a different title.
It would call onUpdateActionButtons() again, but on the client state.
It would be my way to go if you interface changes slightly depending on the different titles (different actions buttons or things you can select).
Post Reply

Return to “Developers”