aboutsummaryrefslogtreecommitdiff
path: root/src/client/sky.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-04-05 13:38:31 +0200
committerGitHub <noreply@github.com>2021-04-05 13:38:31 +0200
commitf0bad0e2badbb7d4777aac7de1b50239bca4010a (patch)
tree4c3115a42ac86e9a64d9e5f088fe187022885779 /src/client/sky.cpp
parent3e1904fa8c4aae3448d58b7e60545a4fdd8234f3 (diff)
downloadminetest-f0bad0e2badbb7d4777aac7de1b50239bca4010a.tar.gz
minetest-f0bad0e2badbb7d4777aac7de1b50239bca4010a.tar.bz2
minetest-f0bad0e2badbb7d4777aac7de1b50239bca4010a.zip
Reserve vectors before pushing and other code quality changes (#11161)
Diffstat (limited to 'src/client/sky.cpp')
-rw-r--r--src/client/sky.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/client/sky.cpp b/src/client/sky.cpp
index caf695e7a..44c8f1574 100644
--- a/src/client/sky.cpp
+++ b/src/client/sky.cpp
@@ -82,13 +82,13 @@ Sky::Sky(s32 id, ITextureSource *tsrc, IShaderSource *ssrc) :
// Ensures that sun and moon textures and tonemaps are correct.
setSkyDefaults();
m_sun_texture = tsrc->isKnownSourceImage(m_sun_params.texture) ?
- tsrc->getTextureForMesh(m_sun_params.texture) : NULL;
+ tsrc->getTextureForMesh(m_sun_params.texture) : nullptr;
m_moon_texture = tsrc->isKnownSourceImage(m_moon_params.texture) ?
- tsrc->getTextureForMesh(m_moon_params.texture) : NULL;
+ tsrc->getTextureForMesh(m_moon_params.texture) : nullptr;
m_sun_tonemap = tsrc->isKnownSourceImage(m_sun_params.tonemap) ?
- tsrc->getTexture(m_sun_params.tonemap) : NULL;
+ tsrc->getTexture(m_sun_params.tonemap) : nullptr;
m_moon_tonemap = tsrc->isKnownSourceImage(m_moon_params.tonemap) ?
- tsrc->getTexture(m_moon_params.tonemap) : NULL;
+ tsrc->getTexture(m_moon_params.tonemap) : nullptr;
if (m_sun_texture) {
m_materials[3] = baseMaterial();
@@ -744,14 +744,14 @@ void Sky::place_sky_body(
}
}
-void Sky::setSunTexture(std::string sun_texture,
- std::string sun_tonemap, ITextureSource *tsrc)
+void Sky::setSunTexture(const std::string &sun_texture,
+ const std::string &sun_tonemap, ITextureSource *tsrc)
{
// Ignore matching textures (with modifiers) entirely,
// but lets at least update the tonemap before hand.
m_sun_params.tonemap = sun_tonemap;
m_sun_tonemap = tsrc->isKnownSourceImage(m_sun_params.tonemap) ?
- tsrc->getTexture(m_sun_params.tonemap) : NULL;
+ tsrc->getTexture(m_sun_params.tonemap) : nullptr;
m_materials[3].Lighting = !!m_sun_tonemap;
if (m_sun_params.texture == sun_texture)
@@ -780,7 +780,7 @@ void Sky::setSunTexture(std::string sun_texture,
}
}
-void Sky::setSunriseTexture(std::string sunglow_texture,
+void Sky::setSunriseTexture(const std::string &sunglow_texture,
ITextureSource* tsrc)
{
// Ignore matching textures (with modifiers) entirely.
@@ -792,14 +792,14 @@ void Sky::setSunriseTexture(std::string sunglow_texture,
);
}
-void Sky::setMoonTexture(std::string moon_texture,
- std::string moon_tonemap, ITextureSource *tsrc)
+void Sky::setMoonTexture(const std::string &moon_texture,
+ const std::string &moon_tonemap, ITextureSource *tsrc)
{
// Ignore matching textures (with modifiers) entirely,
// but lets at least update the tonemap before hand.
m_moon_params.tonemap = moon_tonemap;
m_moon_tonemap = tsrc->isKnownSourceImage(m_moon_params.tonemap) ?
- tsrc->getTexture(m_moon_params.tonemap) : NULL;
+ tsrc->getTexture(m_moon_params.tonemap) : nullptr;
m_materials[4].Lighting = !!m_moon_tonemap;
if (m_moon_params.texture == moon_texture)
@@ -893,7 +893,7 @@ void Sky::setSkyColors(const SkyColor &sky_color)
}
void Sky::setHorizonTint(video::SColor sun_tint, video::SColor moon_tint,
- std::string use_sun_tint)
+ const std::string &use_sun_tint)
{
// Change sun and moon tinting:
m_sky_params.fog_sun_tint = sun_tint;
@@ -907,7 +907,7 @@ void Sky::setHorizonTint(video::SColor sun_tint, video::SColor moon_tint,
m_default_tint = true;
}
-void Sky::addTextureToSkybox(std::string texture, int material_id,
+void Sky::addTextureToSkybox(const std::string &texture, int material_id,
ITextureSource *tsrc)
{
// Sanity check for more than six textures.