PaintingMotive: fixed botched painting fix from 0ea3861d434b017055dfaac5c11e4c90f3779fac

I knew I should have used a singleton for this ...
This commit is contained in:
Dylan K. Taylor 2022-06-07 15:48:20 +01:00
parent 5fd685e07d
commit 1584768c80
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -30,6 +30,7 @@ class PaintingMotive{
protected static $motives = [];
public static function init() : void{
self::$initialized = true;
foreach([
new PaintingMotive(1, 1, "Alban"),
new PaintingMotive(1, 1, "Aztec"),
@ -67,10 +68,16 @@ class PaintingMotive{
}
public static function registerMotive(PaintingMotive $motive) : void{
if(!self::$initialized){
self::init();
}
self::$motives[$motive->getName()] = $motive;
}
public static function getMotiveByName(string $name) : ?PaintingMotive{
if(!self::$initialized){
self::init();
}
return self::$motives[$name] ?? null;
}