From 5962d2e832caafea1aa338b471e26571dc7cf193 Mon Sep 17 00:00:00 2001 From: "M. Sz" Date: Sun, 28 Mar 2021 17:19:08 +0200 Subject: [PATCH] d2dat: add New method for DATPalette --- d2common/d2fileformats/d2dat/dat_palette.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/d2common/d2fileformats/d2dat/dat_palette.go b/d2common/d2fileformats/d2dat/dat_palette.go index ee669a79..c03e7ea0 100644 --- a/d2common/d2fileformats/d2dat/dat_palette.go +++ b/d2common/d2fileformats/d2dat/dat_palette.go @@ -15,6 +15,15 @@ type DATPalette struct { colors [numColors]d2interface.Color } +func New() *DATPalette { + result := &DATPalette{} + for i := range result.colors { + result.colors[i] = &DATColor{} + } + + return result +} + // NumColors returns the number of colors in the palette func (p *DATPalette) NumColors() int { return len(p.colors)