• 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++ Crash on Debian 9 iomapotbm.cpp:411:32: error: cannot convert ‘bool’ to ‘Item*’ in return

legadoss

New Member
Joined
Jun 1, 2014
Messages
142
Reaction score
4
note: this not happen on debian 7/8

gdb log:
Switching to Thread 0x7ffff327b700 (LWP 1417)]
0x0000555555658547 in NpcScript::luaSelfGetPos(lua_State*) ()


C++:
int32_t NpcScript::luaSelfGetPos(lua_State *L){
    lua_pop(L,1);
    Npc* mynpc = getNpc(L);
    lua_pushnumber(L, mynpc->pos.x);
    lua_pushnumber(L, mynpc->pos.y);
    lua_pushnumber(L, mynpc->pos.z);
    return 3;
}
 
Last edited:
iomapotbm.cpp:411:32: error: cannot convert ‘bool’ to ‘Item*’ in return
return false;

C++:
Container* container;
if(container = dynamic_cast<Container*>(item)){
uint32_t type;
NODE item_node = f->getChildNode(node, type);
while(item_node){
if(type == OTBM_ITEM){
Item* item = unserializaItemNode(f, item_node);
if(item){
container->addItem(item);
}
else{
return false;
}
}
item_node = f->getNextNode(item_node, type);
}

how i can fix it?
 
iomapotbm.cpp:411:32: error: cannot convert ‘bool’ to ‘Item*’ in return
return false;

C++:
Container* container;
if(container = dynamic_cast<Container*>(item)){
uint32_t type;
NODE item_node = f->getChildNode(node, type);
while(item_node){
if(type == OTBM_ITEM){
Item* item = unserializaItemNode(f, item_node);
if(item){
container->addItem(item);
}
else{
return false;
}
}
item_node = f->getNextNode(item_node, type);
}

how i can fix it?
This may or not work depending on the compiler you use.
C++:
Container* container;
if(container = dynamic_cast<Container*>(item)){
    uint32_t type;
    NODE item_node = f->getChildNode(node, type);
    while(item_node){
        if(type == OTBM_ITEM){
            if(Item* item = unserializaItemNode(f, item_node)){
                container->addItem(item);
            } else {
                return false;
            }
        }
        item_node = f->getNextNode(item_node, type);
    }
 
Back
Top