summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/activity.h2
-rw-r--r--game/network/rail.cpp2
-rw-r--r--game/terrain.cpp15
-rw-r--r--game/vehicles/railVehicleClass.cpp1
4 files changed, 14 insertions, 6 deletions
diff --git a/game/activity.h b/game/activity.h
index b5fc168..44f8d6f 100644
--- a/game/activity.h
+++ b/game/activity.h
@@ -23,7 +23,9 @@ template<typename T>
concept ActivityConcept = std::is_base_of_v<Activity, T>;
template<ActivityConcept AC> class Can {
public:
+ Can() = default;
virtual ~Can() = default;
+ DEFAULT_MOVE_COPY(Can);
virtual void doActivity(AC *, TickDuration) = 0;
};
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index 46f11d6..d7f95a8 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -3,10 +3,12 @@
#include <GL/glew.h>
#include <array>
#include <collection.hpp>
+#include <cstddef>
#include <game/network/link.h>
#include <game/network/network.impl.h> // IWYU pragma: keep
#include <gfx/models/vertex.hpp>
#include <glm/gtx/transform.hpp>
+#include <initializer_list>
#include <maths.h>
#include <stdexcept>
#include <utility>
diff --git a/game/terrain.cpp b/game/terrain.cpp
index 79b845d..4c902ef 100644
--- a/game/terrain.cpp
+++ b/game/terrain.cpp
@@ -1,6 +1,7 @@
#include "terrain.h"
#include "gfx/models/texture.h"
#include <cache.h>
+#include <cstddef>
#include <gfx/gl/shader.h>
#include <gfx/image.h>
#include <gfx/models/mesh.h>
@@ -23,10 +24,11 @@ Terrain::Terrain() : grass {Texture::cachedTexture.get("grass.png")}, water {Tex
vertices.resize(verticesCount, {{}, {}, {}});
// Initial coordinates
- for (auto y = 0; y < size; y += 1) {
- for (auto x = 0; x < size; x += 1) {
- auto & vertex = vertices[static_cast<std::size_t>(x + (y * size))];
- vertex.pos = {resolution * (x - offset), resolution * (y - offset), -1.5};
+ for (auto y = 0U; y < size; y += 1) {
+ for (auto x = 0U; x < size; x += 1) {
+ auto & vertex = vertices[x + (y * size)];
+ vertex.pos
+ = {resolution * (static_cast<int>(x) - offset), resolution * (static_cast<int>(y) - offset), -1.5};
vertex.normal = up;
vertex.texCoord = {x, y};
}
@@ -49,7 +51,8 @@ Terrain::Terrain() : grass {Texture::cachedTexture.get("grass.png")}, water {Tex
const glm::ivec2 distsqrd {dist.x * dist.x, dist.y * dist.y};
const auto out {rdiv(sq(x - hpos.x), sq(hsize.x)) + rdiv(sq(y - hpos.y), sq(hsize.y))};
if (out <= 1.0F) {
- auto & vertex = vertices[static_cast<std::size_t>(x + (y * size))];
+ auto & vertex
+ = vertices[static_cast<std::size_t>(x) + (static_cast<std::size_t>(y) * size)];
const auto m {1.F / (7.F * out - 8.F) + 1.F};
vertex.pos.z += height * m;
}
@@ -75,7 +78,7 @@ Terrain::Terrain(const std::string & fileName) :
for (auto y = 0U; y < map.height; y += 1) {
for (auto x = 0U; x < map.width; x += 1) {
vertices.emplace_back(glm::vec3 {resolution * (x - (map.width / 2)), resolution * (y - (map.height / 2)),
- (map.data[x + (y * map.width)] * 0.1F) - 1.5F},
+ (static_cast<float>(map.data[x + (y * map.width)]) * 0.1F) - 1.5F},
glm::vec2 {(x % 2) / 2.01, (y % 2) / 2.01}, up);
}
}
diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp
index 406f2d8..8fd504f 100644
--- a/game/vehicles/railVehicleClass.cpp
+++ b/game/vehicles/railVehicleClass.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
#include <array>
#include <cache.h>
+#include <cstddef>
#include <filesystem>
#include <glm/glm.hpp>
#include <iterator>