diff --git a/biomeidentifier.cpp b/biomeidentifier.cpp index 77c30aba..fddbf259 100644 --- a/biomeidentifier.cpp +++ b/biomeidentifier.cpp @@ -118,7 +118,7 @@ QColor BiomeInfo::mixColor( QColor colorizer, QColor blockcolor ) } -QColor BiomeInfo::getBiomeGrassColor( QColor blockcolor, int elevation ) +QColor BiomeInfo::getBiomeGrassColor( QColor blockcolor, int elevation ) const { QColor colorizer; // remove variants from ID @@ -148,7 +148,7 @@ QColor BiomeInfo::getBiomeGrassColor( QColor blockcolor, int elevation ) return mixColor( colorizer, blockcolor ); } -QColor BiomeInfo::getBiomeFoliageColor( QColor blockcolor, int elevation ) +QColor BiomeInfo::getBiomeFoliageColor( QColor blockcolor, int elevation ) const { QColor colorizer; // remove variants from ID @@ -167,7 +167,7 @@ QColor BiomeInfo::getBiomeFoliageColor( QColor blockcolor, int elevation ) return mixColor( colorizer, blockcolor ); } -QColor BiomeInfo::getBiomeWaterColor( QColor watercolor ) +QColor BiomeInfo::getBiomeWaterColor( QColor watercolor ) const { if (this->enabledwatermodifier) { // calculate modified color components @@ -201,13 +201,13 @@ BiomeIdentifier& BiomeIdentifier::Instance() { return singleton; } -BiomeInfo &BiomeIdentifier::getBiome(int biome) { +const BiomeInfo &BiomeIdentifier::getBiome(int biome) const { auto itr = biomes.find(biome); if (itr == biomes.end()) { return unknownBiome; } - QList &list = *itr; + const QList &list = *itr; // search backwards for priority sorting to work for (int i = list.length() - 1; i >= 0; i--) if (list[i]->enabled) diff --git a/biomeidentifier.h b/biomeidentifier.h index 9275a18a..c311ad81 100644 --- a/biomeidentifier.h +++ b/biomeidentifier.h @@ -13,9 +13,9 @@ class BiomeInfo { // public methods public: BiomeInfo(); - QColor getBiomeGrassColor ( QColor blockcolor, int elevation ); - QColor getBiomeFoliageColor( QColor blockcolor, int elevation ); - QColor getBiomeWaterColor( QColor watercolor ); + QColor getBiomeGrassColor ( QColor blockcolor, int elevation ) const; + QColor getBiomeFoliageColor( QColor blockcolor, int elevation ) const; + QColor getBiomeWaterColor( QColor watercolor ) const; // public members public: @@ -50,7 +50,7 @@ class BiomeIdentifier { int addDefinitions(JSONArray *, int pack = -1); void enableDefinitions(int id); void disableDefinitions(int id); - BiomeInfo &getBiome(int id); + const BiomeInfo &getBiome(int id) const; private: // singleton: prevent access to constructor and copyconstructor