Page 1 of 1

getGameinfos not working

Posted: 21 May 2023, 20:23
by VinnieG
I created a new project and then copied my code from a working version (and changed all the names). Now I get the following error when trying to access the player_colors of gameinfos. Also, the items in material.inc.php are not valid.

Notice: Trying to access array offset on value of type null

In 'setupNewGame':

$gameinfos = self::getGameinfos();
$default_colors = $gameinfos['player_colors'];


I performed a 'reload game informations' and used CTRL+f5 but it didn't help.

Thanks!

Re: getGameinfos not working

Posted: 23 May 2023, 01:38
by NFranklin
self::getGameInfos(); should simply be returning the gameinfos array defined in your gameinfos.inc.php file so if the function isn't working correctly, the answer ought to be there.

Is 'player_colors' defined in that file and long enough for the number of players you have? (Though it should just reuse colors if length is an issue)

How exactly did you go about copying over code from your working project instance? The best way is to just use the provided source version control in the project management page to overwrite a newly created project with the working instance.
Version control.png
Version control.png (232.82 KiB) Viewed 305 times