summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-13 05:31:32 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-13 05:31:32 +0100
commitcbf13666d2db374f1564441b1f68371ac69cf096 (patch)
treea9bce22d12262ea98e74128f6fb10e04b1459579 /src
parent07a9588271d30c69353dbea840eddeb519c472c5 (diff)
zw
Diffstat (limited to 'src')
-rw-r--r--src/chunk.cpp2
-rw-r--r--src/chunk.hpp8
-rw-r--r--src/critter.hpp4
-rw-r--r--src/light.hpp2
-rw-r--r--src/object.hpp2
-rw-r--r--src/path-search.hpp2
-rw-r--r--src/scenery.hpp4
-rw-r--r--src/world.hpp3
8 files changed, 13 insertions, 14 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp
index eaeb06e1..ad24b92f 100644
--- a/src/chunk.cpp
+++ b/src/chunk.cpp
@@ -119,7 +119,7 @@ void chunk::mark_modified() noexcept
mark_passability_modified();
}
-chunk::chunk(struct world& w, chunk_coords_ ch) noexcept : _world{&w}, _coord{ch}
+chunk::chunk(class world& w, chunk_coords_ ch) noexcept : _world{&w}, _coord{ch}
{
}
diff --git a/src/chunk.hpp b/src/chunk.hpp
index 759ac324..ff0f589e 100644
--- a/src/chunk.hpp
+++ b/src/chunk.hpp
@@ -40,7 +40,7 @@ struct chunk final
{
friend struct tile_ref;
friend struct object;
- friend struct world;
+ friend class world;
tile_ref operator[](size_t idx) noexcept;
tile_proto operator[](size_t idx) const noexcept;
@@ -64,7 +64,7 @@ struct chunk final
bool empty(bool force = false) const noexcept;
- explicit chunk(struct world& w, chunk_coords_ ch) noexcept;
+ explicit chunk(class world& w, chunk_coords_ ch) noexcept;
~chunk() noexcept;
chunk(const chunk&) = delete;
chunk& operator=(const chunk&) = delete;
@@ -115,7 +115,7 @@ struct chunk final
void ensure_passability() noexcept;
RTree* rtree() noexcept;
- struct world& world() noexcept { return *_world; }
+ class world& world() noexcept { return *_world; }
[[nodiscard]] bool can_place_object(const object_proto& proto, local_coords pos);
@@ -147,7 +147,7 @@ private:
Pointer<ground_stuff> _ground;
Pointer<wall_stuff> _walls;
std::vector<std::shared_ptr<object>> _objects;
- struct world* _world;
+ class world* _world;
GL::Mesh ground_mesh{NoCreate}, wall_mesh{NoCreate}, scenery_mesh{NoCreate};
RTree _rtree;
chunk_coords_ _coord;
diff --git a/src/critter.hpp b/src/critter.hpp
index 724e2b28..29b29a84 100644
--- a/src/critter.hpp
+++ b/src/critter.hpp
@@ -7,7 +7,7 @@
namespace floormat {
class anim_atlas;
-struct world;
+class world;
struct critter_proto : object_proto
{
@@ -39,7 +39,7 @@ struct critter final : object
private:
int allocate_frame_time(float dt);
- friend struct world;
+ friend class world;
critter(object_id id, struct chunk& c, const critter_proto& proto);
};
diff --git a/src/light.hpp b/src/light.hpp
index b5c4469a..7fc429ea 100644
--- a/src/light.hpp
+++ b/src/light.hpp
@@ -39,7 +39,7 @@ struct light final : object
explicit operator light_proto() const;
- friend struct world;
+ friend class world;
};
template<> struct object_type_<struct light> : std::integral_constant<object_type, object_type::light> {};
diff --git a/src/object.hpp b/src/object.hpp
index 50512419..cfa406d6 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -13,7 +13,7 @@ namespace floormat {
template<typename T> struct object_type_;
class anim_atlas;
-struct world;
+class world;
struct chunk;
struct object_proto
diff --git a/src/path-search.hpp b/src/path-search.hpp
index 6391181b..8e56f4fd 100644
--- a/src/path-search.hpp
+++ b/src/path-search.hpp
@@ -17,7 +17,7 @@
namespace floormat {
-struct world;
+class world;
struct object;
struct chunk;
diff --git a/src/scenery.hpp b/src/scenery.hpp
index bd51db8c..61345ab6 100644
--- a/src/scenery.hpp
+++ b/src/scenery.hpp
@@ -11,7 +11,7 @@ namespace floormat {
struct chunk;
class anim_atlas;
-struct world;
+class world;
enum class scenery_type : unsigned char {
none, generic,
@@ -50,7 +50,7 @@ struct scenery final : object
explicit operator scenery_proto() const;
private:
- friend struct world;
+ friend class world;
scenery(object_id id, struct chunk& c, const scenery_proto& proto);
};
diff --git a/src/world.hpp b/src/world.hpp
index cdd1bf7f..bb1e1204 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -13,14 +13,13 @@ namespace floormat {
struct object;
template<typename T> struct object_type_;
-struct world final
+class world final
{
static constexpr object_id object_counter_init = 1024;
static constexpr size_t initial_capacity = 4096;
static constexpr float max_load_factor = .25;
static constexpr size_t initial_collect_every = 64;
-private:
struct chunk_tuple final {
static constexpr chunk_coords_ invalid_coords = { -1 << 15, -1 << 15, chunk_z_min };
chunk* c = nullptr;