From 99208e8f8aba695a6fb0e4ed9f5c51108dd539f4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 13 Jan 2016 00:29:08 +0300 Subject: Add support for hex colors in dye palettes from GIMP file. --- src/resources/db/palettedb.cpp | 7 +++---- src/resources/db/palettedb.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/resources/db') diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp index 4da058d2a..a3caf62dc 100644 --- a/src/resources/db/palettedb.cpp +++ b/src/resources/db/palettedb.cpp @@ -34,7 +34,6 @@ namespace { bool mLoaded = false; std::map mColors; - DyeColor mEmpty(0, 0, 0, 0); } void PaletteDB::load() @@ -113,11 +112,11 @@ void PaletteDB::unload() mColors.clear(); } -const DyeColor &PaletteDB::getColor(const std::string &name) +const DyeColor *PaletteDB::getColor(const std::string &name) { std::map::const_iterator it = mColors.find(name); if (it != mColors.end()) - return (*it).second; + return &(*it).second; else - return mEmpty; + return nullptr; } diff --git a/src/resources/db/palettedb.h b/src/resources/db/palettedb.h index 6043d14b7..349f863f5 100644 --- a/src/resources/db/palettedb.h +++ b/src/resources/db/palettedb.h @@ -32,7 +32,7 @@ namespace PaletteDB void load(); void unload(); void loadPalette(); - const DyeColor &getColor(const std::string &name); + const DyeColor *getColor(const std::string &name); } // namespace PaletteDB -- cgit v1.2.3-70-g09d2