Skip to content

Commit

Permalink
BiomeIdentifier: Added const to reasonable functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
madmaxoft committed Aug 24, 2019
1 parent 829bfa7 commit 6af32ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions biomeidentifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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<BiomeInfo*> &list = *itr;
const QList<BiomeInfo*> &list = *itr;
// search backwards for priority sorting to work
for (int i = list.length() - 1; i >= 0; i--)
if (list[i]->enabled)
Expand Down
8 changes: 4 additions & 4 deletions biomeidentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6af32ad

Please sign in to comment.