From 79302a7a58d86492e7bc94802a3fcd92c375ba22 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 11 Sep 2023 01:31:51 +0200 Subject: [PATCH] Fix warnings --- src/common/rendering/hwrenderer/data/hw_levelmesh.h | 2 +- src/rendering/hwrenderer/doom_levelmesh.cpp | 4 ++-- src/rendering/hwrenderer/doom_levelmesh.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/rendering/hwrenderer/data/hw_levelmesh.h b/src/common/rendering/hwrenderer/data/hw_levelmesh.h index f8836df0d..3cbcaa4ac 100644 --- a/src/common/rendering/hwrenderer/data/hw_levelmesh.h +++ b/src/common/rendering/hwrenderer/data/hw_levelmesh.h @@ -187,7 +187,7 @@ public: std::unique_ptr Collision; virtual LevelMeshSurface* GetSurface(int index) { return nullptr; } - virtual unsigned GetSurfaceIndex(const LevelMeshSurface* surface) const { return unsigned(-1); } + virtual unsigned int GetSurfaceIndex(const LevelMeshSurface* surface) const { return 0xffffffff; } virtual int GetSurfaceCount() { return 0; } virtual void UpdateLightLists() { } diff --git a/src/rendering/hwrenderer/doom_levelmesh.cpp b/src/rendering/hwrenderer/doom_levelmesh.cpp index 41a8ebb0c..7644a150e 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.cpp +++ b/src/rendering/hwrenderer/doom_levelmesh.cpp @@ -283,7 +283,7 @@ void DoomLevelMesh::CreateLightList() meshlight.Origin = { (float)pos.X, (float)pos.Y, (float)pos.Z }; meshlight.RelativeOrigin = meshlight.Origin; meshlight.Radius = (float)light->GetRadius(); - meshlight.Intensity = light->target->Alpha; + meshlight.Intensity = (float)light->target->Alpha; if (light->IsSpot()) { meshlight.InnerAngleCos = (float)light->pSpotInnerAngle->Cos(); @@ -320,7 +320,7 @@ void DoomLevelMesh::CreateLightList() std::set touchedPortals; touchedPortals.insert(Portals[0]); - for (int i = 0, count = Lights.size(); i < count; ++i) // The array expands as the lights are duplicated/propagated + for (int i = 0, count = (int)Lights.size(); i < count; ++i) // The array expands as the lights are duplicated/propagated { PropagateLight(Lights[i].get(), touchedPortals, 0); } diff --git a/src/rendering/hwrenderer/doom_levelmesh.h b/src/rendering/hwrenderer/doom_levelmesh.h index cf2314ffc..bfca86fdd 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.h +++ b/src/rendering/hwrenderer/doom_levelmesh.h @@ -40,7 +40,7 @@ public: void UpdateLightLists() override; LevelMeshSurface* GetSurface(int index) override { return &Surfaces[index]; } - unsigned GetSurfaceIndex(const LevelMeshSurface* surface) const { return std::distance(reinterpret_cast(&Surfaces[0]), reinterpret_cast(surface)); } + unsigned int GetSurfaceIndex(const LevelMeshSurface* surface) const override { return (unsigned int)(ptrdiff_t)(static_cast(surface) - Surfaces.Data()); } int GetSurfaceCount() override { return Surfaces.Size(); }