1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Completely remove IGameCallback class

- CClient now inherits directly from CPrivilegedInfoCallback, like
IGameCallback did before. However CClient no longer needs dummy
implementation of IGameEventCallback
- CGObjectInstance hierarchy now uses CPrivilegedInfoCallback for
callback. Actual events can only be emitted in calls that receive
IGameEventCallback pointer, e.g. heroVisit
- CGameHandler now inherits directly from both CPrivilegedInfoCallback
and IGameEventCallback as it did before via IGameCallback
This commit is contained in:
Ivan Savenko
2025-05-13 15:24:45 +03:00
parent f7d08a7288
commit 716da918f8
109 changed files with 854 additions and 933 deletions

View File

@@ -11,7 +11,7 @@
VCMI_LIB_NAMESPACE_BEGIN
class IGameCallback;
class CPrivilegedInfoCallback;
class Serializeable;
class GameCallbackHolder;
class BinaryDeserializer;
@@ -21,7 +21,7 @@ class GameCallbackHolder;
template <typename T, typename Enable = void>
struct ClassObjectCreator
{
static T *invoke(IGameCallback *cb)
static T *invoke(CPrivilegedInfoCallback *cb)
{
static_assert(!std::is_base_of_v<GameCallbackHolder, T>, "Cannot call new upon map objects!");
static_assert(!std::is_abstract_v<T>, "Cannot call new upon abstract classes!");
@@ -32,7 +32,7 @@ struct ClassObjectCreator
template<typename T>
struct ClassObjectCreator<T, typename std::enable_if_t<std::is_base_of_v<GameCallbackHolder, T>>>
{
static T *invoke(IGameCallback *cb)
static T *invoke(CPrivilegedInfoCallback *cb)
{
static_assert(!std::is_abstract_v<T>, "Cannot call new upon abstract classes!");
return new T(cb);
@@ -42,8 +42,8 @@ struct ClassObjectCreator<T, typename std::enable_if_t<std::is_base_of_v<GameCal
class ISerializerReflection
{
public:
virtual Serializeable * createPtr(BinaryDeserializer &ar, IGameCallback * cb) const =0;
virtual void loadPtr(BinaryDeserializer &ar, IGameCallback * cb, Serializeable * data) const =0;
virtual Serializeable * createPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb) const =0;
virtual void loadPtr(BinaryDeserializer &ar, CPrivilegedInfoCallback * cb, Serializeable * data) const =0;
virtual void savePtr(BinarySerializer &ar, const Serializeable *data) const =0;
virtual ~ISerializerReflection() = default;
};