• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Error Compiling

MxSoft

Leave Tibia, Live Life.
Joined
Dec 22, 2009
Messages
1,804
Solutions
1
Reaction score
43
Location
Mexico
Hello everyone today im having an issue when i try to compile, im adding private war system to my server.
Error:
Code:
In file included from raids.h:26:0,
                 from item.h:29,
                 from tile.h:23,
                 from map.h:26,
                 from creature.h:28,
                 from player.h:23,
                 from luascript.cpp:26:
baseevents.h: In static member function 'static int32_t LuaInterface::luaSendToTalkaction(lua_State*)':
baseevents.h:45:25: error: 'virtual LuaInterface& BaseEvents::getInterface()' is protected
   virtual LuaInterface& getInterface() = 0;
                         ^
luascript.cpp:9322:56: error: within this context
  LuaInterface& interface = g_talkActions->getInterface();
                                                        ^
C++:
int32_t LuaInterface::luaSendToTalkaction(lua_State* L)
{
    LuaInterface& interface = g_talkActions->getInterface();
    if(interface.reserveEnv()){       
        int32_t target = popNumber(L);
        int32_t cid = popNumber(L);
       
        lua_State* state = interface.getState();
        lua_getglobal(state, "War");
        lua_getfield(state, -1, "morte");
        lua_pushnumber(state, cid);
        lua_pushnumber(state, target);

        lua_call(state, 2, 0);       
    }
   
    return 1;
}
How do i declare it friend function? If someone could help me please because im not so good in C++
 
Solution
NVM I found fix, i made public
virtual LuaInterface& getInterface() {return m_interface;}
LuaInterface m_interface;
on talkaction.h
NVM I found fix, i made public
virtual LuaInterface& getInterface() {return m_interface;}
LuaInterface m_interface;
on talkaction.h
 
Solution
Back
Top