fix errors on insertion to game, fix db creation of game

This commit is contained in:
lbenedar
2026-04-23 19:03:56 +03:00
parent f46ff8333e
commit 07025afefc
36 changed files with 1820 additions and 693 deletions

View File

@@ -20,27 +20,31 @@ type Light struct {
Color string `json:"color"`
}
func (l *Light) ToDB(dest *db.Light) bool {
func (l *Light) ToDB(dest **db.Light) bool {
if dest == nil {
return false
}
dest.Alpha = l.Alpha
dest.Angle = l.Angle
dest.Bright = l.Bright
dest.Coloration = l.Coloration
dest.Dim = l.Dim
dest.Attenuation = l.Attenuation
dest.Luminosity = l.Luminosity
dest.Saturation = l.Saturation
dest.Contrast = l.Contrast
dest.Shadows = l.Shadows
dest.Negative = l.Negative
dest.Priority = l.Priority
dest.Color = l.Color
light := &db.Light{
Alpha: l.Alpha,
Angle: l.Angle,
Bright: l.Bright,
Coloration: l.Coloration,
Dim: l.Dim,
Attenuation: l.Attenuation,
Luminosity: l.Luminosity,
Saturation: l.Saturation,
Contrast: l.Contrast,
Shadows: l.Shadows,
Negative: l.Negative,
Priority: l.Priority,
Color: l.Color,
}
l.LightAnimation.ToDB(&dest.LightAnimation)
l.LightDarkness.ToDB(&dest.LightDarkness)
l.LightAnimation.ToDB(&light.LightAnimation)
l.LightDarkness.ToDB(&light.LightDarkness)
*dest = light
return true
}