1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Replaced some usages of void * with more clear CPack *

This commit is contained in:
Ivan Savenko 2024-02-12 12:53:10 +02:00
parent b796ed8626
commit 392c360f88
5 changed files with 18 additions and 18 deletions

View File

@ -59,8 +59,8 @@ template<typename T> class CApplyOnCL;
class CBaseForCLApply
{
public:
virtual void applyOnClAfter(CClient * cl, void * pack) const =0;
virtual void applyOnClBefore(CClient * cl, void * pack) const =0;
virtual void applyOnClAfter(CClient * cl, CPack * pack) const =0;
virtual void applyOnClBefore(CClient * cl, CPack * pack) const =0;
virtual ~CBaseForCLApply(){}
template<typename U> static CBaseForCLApply * getApplier(const U * t = nullptr)
@ -72,13 +72,13 @@ public:
template<typename T> class CApplyOnCL : public CBaseForCLApply
{
public:
void applyOnClAfter(CClient * cl, void * pack) const override
void applyOnClAfter(CClient * cl, CPack * pack) const override
{
T * ptr = static_cast<T *>(pack);
ApplyClientNetPackVisitor visitor(*cl, *cl->gameState());
ptr->visit(visitor);
}
void applyOnClBefore(CClient * cl, void * pack) const override
void applyOnClBefore(CClient * cl, CPack * pack) const override
{
T * ptr = static_cast<T *>(pack);
ApplyFirstClientNetPackVisitor visitor(*cl, *cl->gameState());
@ -89,12 +89,12 @@ public:
template<> class CApplyOnCL<CPack>: public CBaseForCLApply
{
public:
void applyOnClAfter(CClient * cl, void * pack) const override
void applyOnClAfter(CClient * cl, CPack * pack) const override
{
logGlobal->error("Cannot apply on CL plain CPack!");
assert(0);
}
void applyOnClBefore(CClient * cl, void * pack) const override
void applyOnClBefore(CClient * cl, CPack * pack) const override
{
logGlobal->error("Cannot apply on CL plain CPack!");
assert(0);

View File

@ -59,7 +59,7 @@ template <typename T> class CApplyOnGS;
class CBaseForGSApply
{
public:
virtual void applyOnGS(CGameState *gs, void *pack) const =0;
virtual void applyOnGS(CGameState *gs, CPack * pack) const =0;
virtual ~CBaseForGSApply() = default;
template<typename U> static CBaseForGSApply *getApplier(const U * t=nullptr)
{
@ -70,7 +70,7 @@ public:
template <typename T> class CApplyOnGS : public CBaseForGSApply
{
public:
void applyOnGS(CGameState *gs, void *pack) const override
void applyOnGS(CGameState *gs, CPack * pack) const override
{
T *ptr = static_cast<T*>(pack);

View File

@ -315,7 +315,7 @@ public:
void ptrAllocated(const T *ptr, ui32 pid)
{
if(smartPointerSerialization && pid != 0xffffffff)
loadedPointers[pid] = (void*)ptr; //add loaded pointer to our lookup map; cast is to avoid errors with const T* pt
loadedPointers[pid] = static_cast<void*>(ptr); //add loaded pointer to our lookup map; cast is to avoid errors with const T* pt
}
template<typename Base, typename Derived> void registerType(const Base * b = nullptr, const Derived * d = nullptr)

View File

@ -82,7 +82,7 @@ template <typename T> class CApplyOnGH;
class CBaseForGHApply
{
public:
virtual bool applyOnGH(CGameHandler * gh, CGameState * gs, void * pack) const =0;
virtual bool applyOnGH(CGameHandler * gh, CGameState * gs, CPack * pack) const =0;
virtual ~CBaseForGHApply(){}
template<typename U> static CBaseForGHApply *getApplier(const U * t=nullptr)
{
@ -93,7 +93,7 @@ public:
template <typename T> class CApplyOnGH : public CBaseForGHApply
{
public:
bool applyOnGH(CGameHandler * gh, CGameState * gs, void * pack) const override
bool applyOnGH(CGameHandler * gh, CGameState * gs, CPack * pack) const override
{
T *ptr = static_cast<T*>(pack);
try
@ -116,7 +116,7 @@ template <>
class CApplyOnGH<CPack> : public CBaseForGHApply
{
public:
bool applyOnGH(CGameHandler * gh, CGameState * gs, void * pack) const override
bool applyOnGH(CGameHandler * gh, CGameState * gs, CPack * pack) const override
{
logGlobal->error("Cannot apply on GH plain CPack!");
assert(0);

View File

@ -31,8 +31,8 @@ template<typename T> class CApplyOnServer;
class CBaseForServerApply
{
public:
virtual bool applyOnServerBefore(CVCMIServer * srv, void * pack) const =0;
virtual void applyOnServerAfter(CVCMIServer * srv, void * pack) const =0;
virtual bool applyOnServerBefore(CVCMIServer * srv, CPack * pack) const =0;
virtual void applyOnServerAfter(CVCMIServer * srv, CPack * pack) const =0;
virtual ~CBaseForServerApply() {}
template<typename U> static CBaseForServerApply * getApplier(const U * t = nullptr)
{
@ -43,7 +43,7 @@ public:
template <typename T> class CApplyOnServer : public CBaseForServerApply
{
public:
bool applyOnServerBefore(CVCMIServer * srv, void * pack) const override
bool applyOnServerBefore(CVCMIServer * srv, CPack * pack) const override
{
T * ptr = static_cast<T *>(pack);
ClientPermissionsCheckerNetPackVisitor checker(*srv);
@ -59,7 +59,7 @@ public:
return false;
}
void applyOnServerAfter(CVCMIServer * srv, void * pack) const override
void applyOnServerAfter(CVCMIServer * srv, CPack * pack) const override
{
T * ptr = static_cast<T *>(pack);
ApplyOnServerAfterAnnounceNetPackVisitor applier(*srv);
@ -71,13 +71,13 @@ template <>
class CApplyOnServer<CPack> : public CBaseForServerApply
{
public:
bool applyOnServerBefore(CVCMIServer * srv, void * pack) const override
bool applyOnServerBefore(CVCMIServer * srv, CPack * pack) const override
{
logGlobal->error("Cannot apply plain CPack!");
assert(0);
return false;
}
void applyOnServerAfter(CVCMIServer * srv, void * pack) const override
void applyOnServerAfter(CVCMIServer * srv, CPack * pack) const override
{
logGlobal->error("Cannot apply plain CPack!");
assert(0);