knightxd
Member
im trying to compile trunk 3676 tfs 0.4.. i tryed to add mock's function onmoveitem..
this one: onmoveitem
when i was using it on 0.3.6 pl 1 it returns me no error, but now, when i tryed to add it on 0.4 it replyes me a lot of errors, first they were 8, then i changed the 3 LuaScriptInterface to LuaInterface here:
and i get then some few other errors, after that, i changed
to this one
and now i'm just getting 3 errors.. this ones..
i think the problem is here
but i dunno how to fix that, anyone can help me? thanks
this one: onmoveitem
when i was using it on 0.3.6 pl 1 it returns me no error, but now, when i tryed to add it on 0.4 it replyes me a lot of errors, first they were 8, then i changed the 3 LuaScriptInterface to LuaInterface here:
Code:
uint32_t CreatureEvent::executeMoveItem(Creature* actor, Item* item, const Position& frompos, const Position& pos)
{
//onMoveItem(moveItem, frompos, position, cid)
if(m_interface->reserveEnv())
{
ScriptEnviroment* env = m_interface->getEnv();
if(m_scripted == EVENT_SCRIPT_BUFFER)
{
env->setRealPos(pos);
std::stringstream scriptstream;
env->streamThing(scriptstream, "moveItem", item, env->addThing(item));
env->streamPosition(scriptstream, "position", frompos, 0);
env->streamPosition(scriptstream, "position", pos, 0);
scriptstream << "local cid = " << env->addThing(actor) << std::endl;
scriptstream << m_scriptData;
bool result = true;
if(m_interface->loadBuffer(scriptstream.str()))
{
lua_State* L = m_interface->getState();
result = m_interface->getGlobalBool(L, "_result", true);
}
m_interface->releaseEnv();
return result;
}
else
{
#ifdef __DEBUG_LUASCRIPTS__
char desc[35];
sprintf(desc, "%s", player->getName().c_str());
env->setEventDesc(desc);
#endif
env->setScriptId(m_scriptId, m_interface);
env->setRealPos(pos);
lua_State* L = m_interface->getState();
m_interface->pushFunction(m_scriptId);
LuaScriptInterface::pushThing(L, item, env->addThing(item));
LuaScriptInterface::pushPosition(L, frompos, 0);
LuaScriptInterface::pushPosition(L, pos, 0);
lua_pushnumber(L, env->addThing(actor));
bool result = m_interface->callFunction(4);
m_interface->releaseEnv();
return result;
}
}
else
{
std::cout << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl;
return 0;
}
}
and i get then some few other errors, after that, i changed
Code:
uint32_t CreatureEvents::executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos)
{
// fire global event if is registered
for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it)
{
if(it->second->getEventType() == CREATURE_EVENT_MOVEITEM){
if(!it->second->executeMoveItem(actor,item,frompos,pos))
return 0;
}
}
return 1;
}
to this one
Code:
uint32_t CreatureEvents::executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos)
{
// fire global event if is registered
CreatureEventList moveItem = actor->getCreatureEvents(CREATURE_EVENT_MOVEITEM);
for(CreatureEventList::iterator it = moveItem.begin(); it != moveItem.end(); ++it)
if(!(*it)->executeMoveItem(actor,item,frompos,pos))
return 0;
}
and now i'm just getting 3 errors.. this ones..
Code:
In member function 'uint32_t CreatureEvents::executeMoveItems(Creature*, Item*, const Position&, const Position&)':
116 C:\Users\Julio\Desktop\trunk.r3676\creatureevent.cpp conversion from 'CreatureEventList' to non-scalar type 'std::vector<CreatureEvent*, std::allocator<CreatureEvent*> >' requested
116 C:\Users\Julio\Desktop\trunk.r3676\creatureevent.cpp *** [obj//creatureevent.o] Error 1
i think the problem is here
Code:
CreatureEventList moveItem = actor->getCreatureEvents(CREATURE_EVENT_MOVEITEM);
but i dunno how to fix that, anyone can help me? thanks