]> git.tdb.fi Git - libs/game.git/commitdiff
Fix errors revealed by gcc 13
authorMikko Rasa <tdb@tdb.fi>
Sat, 30 Dec 2023 11:00:49 +0000 (13:00 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 30 Dec 2023 11:03:15 +0000 (13:03 +0200)
source/game/messages.h
source/game/reflection.h
source/game/remotecall.h

index 7e91919579d72d9d12335f63a1eb46801eb74eb4..c576ae6c6f0e612ac2eef24aed76f7e44ae61bc6 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_GAME_MESSAGES_H_
 #define MSP_GAME_MESSAGES_H_
 
+#include <cstdint>
 #include <vector>
 #include <msp/geometry/quaternion.h>
 #include <msp/linal/vector.h>
index 16f2508b9f479829435e1aeec17d75ff6ec0af93..49d4ee22802f783201cbd2cd835d2d48d5c3b9ae 100644 (file)
@@ -146,6 +146,7 @@ inline std::vector<ClassBase *> Reflector::find_classes_if(F &&pred) const
 
 
 template<typename T, typename B>
+       requires std::is_base_of_v<B, T>
 inline bool Polymorphism<T, B>::is_instance_of(const void *obj, const PolymorphismBase &other) const
 {
        if(const RootedPolymorphism<B> *rooted = dynamic_cast<const RootedPolymorphism<B> *>(&other))
index 730f533e7672fe5af846956f745dc82d26a02bdf..35cfe88ac8035562e421fa8453f7a317d5d479f2 100644 (file)
@@ -81,6 +81,7 @@ void ReplicatedCall<P>::receive(const P &packet)
 
 
 template<typename P, typename E>
+       requires std::is_base_of_v<Entity, E>
 ReplicatedEntityCall<P, E>::ReplicatedEntityCall(Replicator *r, Function f):
        replicator(r),
        func(std::move(f))
@@ -90,6 +91,7 @@ ReplicatedEntityCall<P, E>::ReplicatedEntityCall(Replicator *r, Function f):
 }
 
 template<typename P, typename E>
+       requires std::is_base_of_v<Entity, E>
 void ReplicatedEntityCall<P, E>::operator()(Handle<Entity> entity, P &packet)
 {
        if(replicator)
@@ -101,6 +103,7 @@ void ReplicatedEntityCall<P, E>::operator()(Handle<Entity> entity, P &packet)
 }
 
 template<typename P, typename E>
+       requires std::is_base_of_v<Entity, E>
 void ReplicatedEntityCall<P, E>::operator()(unsigned target, Handle<Entity> entity, P &packet)
 {
        if(replicator)
@@ -111,6 +114,7 @@ void ReplicatedEntityCall<P, E>::operator()(unsigned target, Handle<Entity> enti
 }
 
 template<typename P, typename E>
+       requires std::is_base_of_v<Entity, E>
 void ReplicatedEntityCall<P, E>::prepare(Handle<Entity> entity, P &packet)
 {
        Handle<Zygote> zygote = entity->get_component<Zygote>();
@@ -125,6 +129,7 @@ void ReplicatedEntityCall<P, E>::prepare(Handle<Entity> entity, P &packet)
 }
 
 template<typename P, typename E>
+       requires std::is_base_of_v<Entity, E>
 void ReplicatedEntityCall<P, E>::receive(const P &packet)
 {
        Handle<Entity> entity = replicator->find_entity(packet.entity_id);