From c984afdf47ef31511024c6b70bd4b4c4e64f56a6 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 8 Jul 2023 23:30:25 +0500 Subject: Fixed some errors detected by static analysis --- src/Plugin.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Plugin.cpp') diff --git a/src/Plugin.cpp b/src/Plugin.cpp index 7a3b716..22afb90 100644 --- a/src/Plugin.cpp +++ b/src/Plugin.cpp @@ -54,15 +54,15 @@ namespace PluginApi { LOG(INFO) << "Loaded plugin " << (!nativePlugin.displayName.empty() ? nativePlugin.displayName : nativePlugin.name); } - void LogWarning(std::string text) { + void LogWarning(const std::string& text) { LOG(WARNING) << text; } - void LogInfo(std::string text) { + void LogInfo(const std::string& text) { LOG(INFO) << text; } - void LogError(std::string text) { + void LogError(const std::string& text) { LOG(ERROR) << text; } @@ -70,7 +70,7 @@ namespace PluginApi { return ::GetGameState(); } - void RegisterBlock(BlockId blockId, bool collides, std::string blockstate, std::string variant) { + void RegisterBlock(BlockId blockId, bool collides, const std::string& blockstate, const std::string& variant) { RegisterStaticBlockInfo(blockId, BlockInfo{ collides, blockstate, @@ -78,18 +78,18 @@ namespace PluginApi { }); } - void RegisterLiquid(BlockId blockId, std::string flowTexture, std::string stillTexture) { + void RegisterLiquid(BlockId blockId, const std::string& flowTexture, const std::string& stillTexture) { RegisterStaticLiquidInfo(blockId, LiquidInfo{ flowTexture, stillTexture }); } - void RegisterDimension(int dimId, Dimension dim) { + void RegisterDimension(int dimId, const Dimension& dim) { RegisterNewDimension(dimId, dim); } - void ConnectToServer(std::string host, std::string username) { + void ConnectToServer(const std::string& host, const std::string& username) { size_t index = host.find_last_of(':'); unsigned short port; if (index == std::string::npos) @@ -231,8 +231,8 @@ void PluginSystem::Init() { "GetEntitiesList", &World::GetEntitiesList, "GetEntity",&World::GetEntityPtr, "Raycast", &World::Raycast, - "GetBlockLight", sol::resolve(&World::GetBlockLight), - "GetBlockSkyLight", sol::resolve(&World::GetBlockSkyLight), + "GetBlockLight", sol::resolve(&World::GetBlockLight), + "GetBlockSkyLight", sol::resolve(&World::GetBlockSkyLight), "GetBlockId", &World::GetBlockId, "SetBlockId", &World::SetBlockId); -- cgit v1.2.3