fix compiler warnings (GCC + Clang)

This commit is contained in:
MihailRis
2025-03-20 22:04:29 +03:00
parent 6c3d2d0907
commit 3d22de761f
50 changed files with 80 additions and 103 deletions
+2 -1
View File
@@ -145,7 +145,7 @@ static int get_axis(lua::State* L) {
}
auto z = lua::tointeger(L, 3);
glm::ivec3 defAxis;
glm::ivec3 defAxis {};
defAxis[n] = 1;
auto vox = blocks_agent::get(*level->chunks, x, y, z);
@@ -562,6 +562,7 @@ static int set_field(
return lua::pushinteger(L,
dataStruct.setUnicode(dst, value.asString(), field));
}
[[fallthrough]];
case data::FieldType::I8:
case data::FieldType::I16:
case data::FieldType::I32:
@@ -13,7 +13,6 @@
using namespace scripting;
static int l_save_fragment(lua::State* L) {
const auto& paths = engine->getPaths();
auto fragment = lua::touserdata<lua::LuaVoxelFragment>(L, 1);
auto file = lua::require_string(L, 2);
auto map = fragment->getFragment()->serialize();
@@ -55,13 +54,11 @@ static int l_get_generators(lua::State* L) {
lua::createtable(L, 0, 0);
int i = 1;
for (const auto& pack : packs) {
auto pairs = ContentLoader::scanContent(pack, ContentType::GENERATOR);
for (const auto& [name, caption] : pairs) {
lua::pushstring(L, caption);
lua::setfield(L, name);
i++;
}
}
return 1;
+1 -1
View File
@@ -783,7 +783,7 @@ static int l_gui_escape_markup(lua::State* L) {
auto lang = lua::require_string(L, 1);
std::string text = lua::require_string(L, 2);
if (std::strcmp(lang, "md") == 0) {
text = std::move(markdown::escape<char>(text));
text = markdown::escape<char>(text);
}
return lua::pushstring(L, text);
}
@@ -227,7 +227,6 @@ static int l_has_data(lua::State* L, ItemStack& stack) {
static int l_set_data(lua::State* L, ItemStack& stack) {
auto key = lua::require_string(L, 3);
auto value = lua::tovalue(L, 4);
auto& fields = stack.getFields();
stack.setField(key, std::move(value));
return 0;
}
+1 -1
View File
@@ -235,7 +235,7 @@ static int l_pack_assemble(lua::State* L) {
auto manager = engine->createPacksManager(worldFolder);
manager.scan();
try {
ids = std::move(manager.assemble(ids));
ids = manager.assemble(ids);
} catch (const contentpack_error& err) {
throw std::runtime_error(
std::string(err.what()) + " [" + err.getPackId() + "]"
@@ -59,7 +59,6 @@ static int l_get_origin(lua::State* L) {
static int l_set_origin(lua::State* L) {
u64id_t id = lua::touinteger(L, 1);
if (auto emitter = renderer->particles->getEmitter(id)) {
EmitterOrigin origin;
if (lua::istable(L, 2)) {
emitter->setOrigin(lua::tovec3(L, 2));
} else {
+1 -3
View File
@@ -149,9 +149,7 @@ static int l_get_chunk_data(lua::State* L) {
static void integrate_chunk_client(Chunk& chunk) {
int x = chunk.x;
int z = chunk.z;
auto chunksController = controller->getChunksController();
Lighting& lighting = *chunksController->lighting;
chunk.flags.loadedLights = false;
chunk.flags.lighted = false;
chunk.lightmap.clear();
@@ -50,7 +50,6 @@ const float* LuaHeightmap::getValues() const {
}
static int l_dump(lua::State* L) {
const auto& paths = scripting::engine->getPaths();
if (auto heightmap = touserdata<LuaHeightmap>(L, 1)) {
io::path file = require_string(L, 2);
uint w = heightmap->getWidth();