mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-24 21:35:21 +02:00
Replace some raw pointers by unique_ptr (#16304)
This commit is contained in:
@@ -107,7 +107,7 @@ void ShadowRenderer::disable()
|
||||
void ShadowRenderer::preInit(IWritableShaderSource *shsrc)
|
||||
{
|
||||
if (g_settings->getBool("enable_dynamic_shadows")) {
|
||||
shsrc->addShaderUniformSetterFactory(new ShadowUniformSetterFactory());
|
||||
shsrc->addShaderUniformSetterFactory(std::make_unique<ShadowUniformSetterFactory>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ std::string ShadowRenderer::readShaderFile(const std::string &path)
|
||||
return prefix + content;
|
||||
}
|
||||
|
||||
ShadowRenderer *createShadowRenderer(IrrlichtDevice *device, Client *client)
|
||||
std::unique_ptr<ShadowRenderer> createShadowRenderer(IrrlichtDevice *device, Client *client)
|
||||
{
|
||||
if (!g_settings->getBool("enable_dynamic_shadows"))
|
||||
return nullptr;
|
||||
@@ -701,7 +701,7 @@ ShadowRenderer *createShadowRenderer(IrrlichtDevice *device, Client *client)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShadowRenderer *shadow_renderer = new ShadowRenderer(device, client);
|
||||
auto shadow_renderer = std::make_unique<ShadowRenderer>(device, client);
|
||||
shadow_renderer->initialize();
|
||||
return shadow_renderer;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <IrrlichtDevice.h>
|
||||
#include "client/shadows/dynamicshadows.h"
|
||||
#include <ISceneNode.h>
|
||||
@@ -165,4 +166,4 @@ private:
|
||||
* @param client Reference to the client context.
|
||||
* @return A new ShadowRenderer instance or nullptr if shadows are disabled or not supported.
|
||||
*/
|
||||
ShadowRenderer *createShadowRenderer(IrrlichtDevice *device, Client *client);
|
||||
std::unique_ptr<ShadowRenderer> createShadowRenderer(IrrlichtDevice *device, Client *client);
|
||||
|
||||
Reference in New Issue
Block a user