Use ref in weather iterators

This commit is contained in:
Lwmte 2021-11-10 20:37:27 +03:00
parent e0e456c8db
commit f7545612c9
3 changed files with 4 additions and 8 deletions

View file

@ -17,7 +17,7 @@ namespace Environment
{
EnvironmentController Weather;
float WeatherParticle::Transparency()
float WeatherParticle::Transparency() const
{
float result = WEATHER_PARTICLES_TRANSPARENCY;
@ -210,10 +210,8 @@ namespace Environment
void EnvironmentController::UpdateWeather(GameScriptLevel* level)
{
for (int i = 0; i < Particles.size(); i++)
for (auto& p : Particles)
{
auto& p = Particles[i];
auto oldPos = p.Position;
if (!p.Stopped)

View file

@ -18,7 +18,6 @@ namespace Environment
constexpr auto WEATHER_PARTICLES_TRANSPARENCY = 0.8f;
constexpr auto WEATHER_PARTICLES_NEAR_DEATH_LIFE_VALUE = 16;
constexpr auto SKY_POSITION_LIMIT = 9728;
enum class WeatherType
@ -43,10 +42,9 @@ namespace Environment
bool Enabled;
bool Stopped;
float Transparency();
float Transparency() const;
};
class EnvironmentController
{
public:

View file

@ -417,7 +417,7 @@ namespace TEN::Renderer
void Renderer11::drawWeatherParticles(RenderView& view)
{
for (auto p : Weather.GetParticles())
for (auto& p : Weather.GetParticles())
{
if (!p.Enabled)
continue;