forked from teamnwah/openmw-tes3coop
Fixed types in all GetInterface functions
Move lib_t type to Scripts/Types.hpp
This commit is contained in:
parent
e513c3676d
commit
74c103ddc1
9 changed files with 23 additions and 16 deletions
|
@ -9,9 +9,9 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
void *LangLua::GetInterface()
|
||||
lib_t LangLua::GetInterface()
|
||||
{
|
||||
return lua;
|
||||
return reinterpret_cast<lib_t>(lua);
|
||||
}
|
||||
|
||||
LangLua::LangLua(lua_State *lua)
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
using IndicesFor = build_indices<N>;
|
||||
|
||||
public:
|
||||
virtual void *GetInterface() override;
|
||||
virtual lib_t GetInterface() override;
|
||||
template<std::size_t... Indices>
|
||||
static LuaFuctionData* functions(indices<Indices...>);
|
||||
lua_State *lua;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
using namespace std;
|
||||
|
||||
template<typename R>
|
||||
bool SetScript(SystemInterface<>::lib_t lib, const char *name, R value)
|
||||
bool SetScript(lib_t lib, const char *name, R value)
|
||||
{
|
||||
SystemInterface<R *> result(lib, name);
|
||||
|
||||
|
@ -85,7 +85,7 @@ boost::any LangNative::Call(const char *name, const char *argl, const std::vecto
|
|||
}
|
||||
|
||||
|
||||
void *LangNative::GetInterface()
|
||||
lib_t LangNative::GetInterface()
|
||||
{
|
||||
return lib;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
class LangNative : public Language
|
||||
{
|
||||
SystemInterface<>::lib_t lib;
|
||||
lib_t lib;
|
||||
public:
|
||||
virtual void *GetInterface() override;
|
||||
virtual lib_t GetInterface() override;
|
||||
LangNative();
|
||||
~LangNative();
|
||||
virtual void LoadProgram(const char *filename) override;
|
||||
|
|
|
@ -434,9 +434,9 @@ inline AMX_NATIVE_INFO *LangPAWN::functions(indices<Indices...>)
|
|||
}
|
||||
|
||||
|
||||
void *LangPAWN::GetInterface()
|
||||
lib_t LangPAWN::GetInterface()
|
||||
{
|
||||
return amx;
|
||||
return reinterpret_cast<lib_t>(amx);
|
||||
}
|
||||
|
||||
LangPAWN::LangPAWN()
|
||||
|
|
|
@ -21,7 +21,7 @@ private:
|
|||
using IndicesFor = build_indices<N>;
|
||||
|
||||
public:
|
||||
virtual void *GetInterface() override;
|
||||
virtual lib_t GetInterface() override;
|
||||
template<std::size_t... Indices>
|
||||
static AMX_NATIVE_INFO* functions(indices<Indices...>);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual boost::any Call(const char* name, const char* argl, int buf, ...) = 0;
|
||||
virtual boost::any Call(const char* name, const char* argl, const std::vector<boost::any>& args) = 0;
|
||||
|
||||
virtual void * GetInterface() = 0;
|
||||
virtual lib_t GetInterface() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -11,14 +11,11 @@
|
|||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
template<typename R = void*>
|
||||
struct SystemInterface
|
||||
{
|
||||
#ifdef _WIN32
|
||||
typedef HMODULE lib_t;
|
||||
#else
|
||||
typedef void* lib_t;
|
||||
#endif
|
||||
|
||||
union
|
||||
{
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
#include <RakNetTypes.h>
|
||||
#include <Utils.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef HMODULE lib_t;
|
||||
#else
|
||||
typedef void* lib_t;
|
||||
#endif
|
||||
|
||||
template<typename T> struct sizeof_void { enum { value = sizeof(T) }; };
|
||||
template<> struct sizeof_void<void> { enum { value = 0 }; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue