Jump to content
×
×
  • Create New...
  • 0

Game.core problem


meneleos

Question

hi. i have a problem

I can not find the cause of the error

(gdb) bt
#0  DESC::Packet (this=0xb, c_pvData=0x290ef000, iSize=60) at desc.cpp:436
#1  0x0806f5f9 in COfflineShop::Broadcast (this=0x2a2429c0, data=0x290ef000,
    bytes=60) at offline_shop.cpp:982
#2  0x08070288 in COfflineShop::BroadcastUpdateItem (this=0x2a2429c0,
    bPos=11 '\v', dwPID=73286, bDestroy=true) at offline_shop.cpp:865
#3  0x08071a2a in COfflineShop::Buy (this=0x2a2429c0, ch=0x4eb01000,
    bPos=<value optimized out>) at offline_shop.cpp:701
#4  0x0806c80a in COfflineShopManager::Buy (this=0xffffaed8, ch=0x4eb01000,
    pos=11 '\v') at offlineshop_manager.cpp:585
#5  0x0815ec61 in CInputMain::OfflineShop (this=0x465a6d1c, ch=0x4eb01000,
    data=0x58f0f000 "8\001\001\vR\236\016", uiBytes=3) at input_main.cpp:1513
#6  0x08164cc1 in CInputMain::Analyze (this=0x465a6d1c, d=0x465a6c80,
    bHeader=<value optimized out>, c_pData=0x58f0f000 "8\001\001\vR\236\016")
    at input_main.cpp:3780
#7  0x0815077b in CInputProcessor::Process (this=0x465a6d1c,
    lpDesc=0x465a6c80, c_pvOrig=0x58f0f000, iBytes=5,
    [email protected]) at input.cpp:99
#8  0x08118993 in DESC::ProcessInput (this=0x465a6c80) at desc.cpp:314
#9  0x082728e4 in io_loop (fdw=0x291347a0) at main.cpp:930
#10 0x082732c0 in idle () at main.cpp:812
#11 0x082747f7 in main (argc=1, argv=0xffffde50) at main.cpp:476

(gdb) bt full
#0  DESC::Packet (this=0xb, c_pvData=0x290ef000, iSize=60) at desc.cpp:436
No locals.
#1  0x0806f5f9 in COfflineShop::Broadcast (this=0x2a2429c0, data=0x290ef000,
    bytes=60) at offline_shop.cpp:982
        it = {<std::tr1::__detail::_Hashtable_iterator_base<std::pair<CHARACTER* const, bool>,false>> = {_M_cur_node = 0x38bbc170,
    _M_cur_bucket = 0x436a73c4}, <No data fields>}
#2  0x08070288 in COfflineShop::BroadcastUpdateItem (this=0x2a2429c0,
    bPos=11 '\v', dwPID=73286, bDestroy=true) at offline_shop.cpp:865
        pack = {header = 47 '/', size = 60, subheader = 2 '\002'}
        pack2 = {pos = 11 '\v', item = {vnum = 0, price = 0, count = 0 '\0', display_pos = 0 '\0', alSockets = {0, 0, 0, 0},
    aAttr = {{bType = 0 '\0', sValue = 0}, {bType = 0 '\0', sValue = 0}, {
        bType = 0 '\0', sValue = 0}, {bType = 0 '\0', sValue = 0}, {
        bType = 0 '\0', sValue = 0}, {bType = 0 '\0', sValue = 0}, {
        bType = 0 '\0', sValue = 0}}}}
        buf = {buf = 0x291a59c0, forceDelete = false}
#3  0x08071a2a in COfflineShop::Buy (this=0x2a2429c0, ch=0x4eb01000,
    bPos=<value optimized out>) at offline_shop.cpp:701
        tch = 0x4a6db000
        saticiadi = "Nick\0008?▒U<?▒UO8\212(\v\000\000\000\231}7A"
        szQuery = "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtyp---Type <return> to continue, or q <return> to quit---
e3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,att"...
        pMsg = {_M_ptr = 0x53d31b80}
        row = <value optimized out>
        dwPrice = 14000000
        dwItemVnum = 50300
        bCount = 14 '\016'
        alSockets = {1, 0, 0, 0}
        aAttr = {{bType = 0 '\0', sValue = 0}, {bType = 0 '\0', sValue = 0}, {
    bType = 0 '\0', sValue = 0}, {bType = 0 '\0', sValue = 0}, {
    bType = 0 '\0', sValue = 0}, {bType = 0 '\0', sValue = 0}, {
    bType = 0 '\0', sValue = 0}}
        itemvnum = 0
        ofbnk = "SELECT yang FROM player.offlinebanka WHERE id=73286\000\000\001\000\000\000\000\000\002\000\005\000\000\000▒,D\b\001\000\000\000\001\000\000\000\002\000\000\000P\232▒▒\001\000\000\000\200▒$Xh\001\000\000\200▒$X\005\000\000\000\021\000\000\000▒\232▒▒▒\213\021\b▒G\023)Z\000\000\000\200▒$X\002\000\000\000\001\000\000\000▒\232▒▒3\233▒▒\\>>\b\002\000\000\000\000\001"...
        llYang = 14000000

input_main.cpp 3780

        case HEADER_CG_OFFLINE_SHOP:
            if ((iExtraLen = OfflineShop(ch, c_pData, m_iBufferLeft)) < 0)
                return -1;
            break;
 

1503

    TPacketCGShop * p = (TPacketCGShop *) data;

    if (uiBytes < sizeof(TPacketCGShop))
        return -1;

    if (test_server)
        sys_log(0, "CInputMain::OfflineShop ==> SubHeader %d", p->subheader);

    const char * c_pData = data + sizeof(TPacketCGShop);
    uiBytes -= sizeof(TPacketCGShop);

    switch (p->subheader)
    {
        case SHOP_SUBHEADER_CG_END:
            sys_log(1, "INPUT: %s OFFLINE_SHOP: END", ch->GetName());
            COfflineShopManager::instance().StopShopping(ch);
            return 0;
        case SHOP_SUBHEADER_CG_BUY:
        {
            if (uiBytes < sizeof(BYTE) + sizeof(BYTE))
                return -1;

            BYTE bPos = *(c_pData + 1);
            sys_log(1, "INPUT: %s OFFLINE_SHOP: BUY %d", ch->GetName(), bPos);
            COfflineShopManager::instance().Buy(ch, bPos);
            return (sizeof(BYTE) + sizeof(BYTE));
        }
 

offlineshop_manager.cpp:585

    int ret = pkOfflineShop->Buy(ch, pos);
 

offline_shop.cpp:701
 

    BroadcastUpdateItem(bPos, pid, true);
 

offline_shop.cpp:865

void COfflineShop::BroadcastUpdateItem(BYTE bPos, DWORD dwPID, bool bDestroy)
{
    TPacketGCShop pack;
    TPacketGCShopUpdateItem pack2;

    TEMP_BUFFER buf;

    pack.header = HEADER_GC_OFFLINE_SHOP;
    pack.subheader = SHOP_SUBHEADER_GC_UPDATE_ITEM;
    pack.size = sizeof(pack) + sizeof(pack2);
    pack2.pos = bPos;

    if (bDestroy)
    {
        pack2.item.vnum = 0;
        pack2.item.count = 0;
        pack2.item.price = 0;
        memset(pack2.item.alSockets, 0, sizeof(pack2.item.alSockets));
        memset(pack2.item.aAttr, 0, sizeof(pack2.item.aAttr));
    }
    else
    {
        char szQuery[1024];
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 FROM offline_shop_item%s WHERE owner_id = %u and pos = %d", get_table_postfix(), dwPID, bPos);
        std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery(szQuery));
        MYSQL_ROW row;
        while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
        {
            str_to_number(pack2.item.count, row[1]);
            str_to_number(pack2.item.vnum, row[2]);
            str_to_number(pack2.item.price, row[3]);
            for (int i = 0, n = 4; i < ITEM_SOCKET_MAX_NUM; ++i, n++)
                str_to_number(pack2.item.alSockets, row[n]);

            for (int i = 0, iStartAttributeType = 8, iStartAttributeValue = 9; i < ITEM_ATTRIBUTE_MAX_NUM; ++i, iStartAttributeType += 2, iStartAttributeValue += 2)

            {
                str_to_number(pack2.item.aAttr.bType, row[iStartAttributeType]);
                str_to_number(pack2.item.aAttr.sValue, row[iStartAttributeValue]);

            }
        }
    }

    buf.write(&pack, sizeof(pack));
    buf.write(&pack2, sizeof(pack2));
    Broadcast(buf.read_peek(), buf.size());
}
 

 

 at offline_shop.cpp:982

void COfflineShop::Broadcast(const void * data, int bytes)
{

    for (GuestMapType::iterator it = m_map_guest.begin(); it != m_map_guest.end(); ++it)
    {
        LPCHARACTER ch = it->first;
        if (ch != NULL && ch->GetDesc())
        {
            ch->GetDesc()->Packet(data, bytes);            
        }
    }
}

 

Link to comment
  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

6 answers to this question

Recommended Posts

  • 0

new similar core

(gdb) bt full
#0  DESC::Packet (this=0x10, c_pvData=0xffffa138, iSize=4) at desc.cpp:436
No locals.
#1  0x0806e00d in COfflineShop::Broadcast (this=0x5370c500, data=0xffffa138,
    bytes=4) at offline_shop.cpp:878
        ch = <value optimized out>
        it = {<std::tr1::__detail::_Hashtable_iterator_base<std::pair<CHARACTER* const, bool>,false>> = {_M_cur_node = 0x55f512a0,
    _M_cur_bucket = 0x53747738}, <No data fields>}
#2  0x0806e17a in COfflineShop::RemoveAllGuest (this=0x5370c500)
    at offline_shop.cpp:217
        pack = {header = 47 '/', size = 4, subheader = 1 '\001'}
#3  0x0806e25f in COfflineShop::Destroy (this=0x5370c500, npc=0x537de000)
    at offline_shop.cpp:229
No locals.
#4  0x0805c850 in COfflineShopManager::DestroyOfflineShop (this=0xffffaed8,
    ch=0x584b1000, dwVID=43617, bDestroyAll=true)
    at offlineshop_manager.cpp:196
        szName = "\b0¢ÿÿ\000\000\000\000\001\000\000\000N\000\000\000¹ríW?1\017"
        pMap = <value optimized out>
        offlineShop = {szName = 0x288bb1f8 "L\033\025", dwVID = 4294943236,
  dwRealOwner = 680130624}
        pMsg = {_M_ptr = 0x8427760}
---Type <return> to continue, or q <return> to quit---
        row = <value optimized out>
        lMapIndex = <value optimized out>
        bChannel = <value optimized out>
        npc = 0x537de000
        pkOfflineShop = 0x5370c500
#5  0x0816162a in CInputMain::OfflineShop (this=0x5829d21c, ch=0x584b1000,
    data=0x57522000 "8\bÚCreative35", uiBytes=1) at input_main.cpp:1257
        c_pData = 0x57522002 "ÚCreative35"
#6  0x081677e1 in CInputMain::Analyze (this=0x5829d21c, d=0x5829d180,
    bHeader=<value optimized out>, c_pData=0x57522000 "8\bÚCreative35")
    at input_main.cpp:3503
        ch = 0x584b1000
        iExtraLen = <value optimized out>
        __FUNCTION__ = "Analyze"
#7  0x0814f3eb in CInputProcessor::Process (this=0x5829d21c,
    lpDesc=0x5829d180, c_pvOrig=0x57522000, iBytes=3,
    r_iBytesProceed[email protected]) at input.cpp:103
        iExtraPacketSize = <value optimized out>
        bHeader = 56 '8'
        c_pszName = 0x548a422c "OfflineShop"
        c_pData = 0x57522000 "8\bÚCreative35"
        bLastHeader = <value optimized out>
        iLastPacketLen = 0
---Type <return> to continue, or q <return> to quit---
        iPacketLen = 3
        __FUNCTION__ = "Process"
#8  0x081178c3 in DESC::ProcessInput (this=0x5829d180) at desc.cpp:314
        iBytesProceed = 0
        bytes_read = 3
        __FUNCTION__ = "ProcessInput"
#9  0x082762f4 in io_loop (fdw=0x291347e0) at main.cpp:1005
        sock_buf_size = 0
        ret = 0
        iRet = <value optimized out>
        num_events = 100
        event_idx = 6
        __FUNCTION__ = "io_loop"
#10 0x08276d20 in idle () at main.cpp:882
        now = {tv_sec = 1475179193, tv_usec = 901085}
        passed_pulses = <value optimized out>
        t = 2405937
        pta = {tv_sec = 1475176788, tv_usec = 733317}
        process_time_count = 55048
#11 0x08278271 in main (argc=1, argv=0xffffde50) at main.cpp:540
        sectree_manager = {<singleton<SECTREE_MANAGER>> = {
    _vptr$singleton = 0x8435918, static ms_singleton = 0xffffab04},
  static current_sectree_version = 768, m_map_pkSectree = {_M_t = {
---Type <return> to continue, or q <return> to quit---

 

Link to comment
  • 0
1 minute ago, martysama0134 said:

if (desc)
    desc->Packet(blabla);

This is just an example. The rest is up to you.

    for (GuestMapType::iterator it = m_map_guest.begin(); it != m_map_guest.end(); ++it)
    {
        LPCHARACTER ch = NULL;
        ch = it->first;
        if (ch != NULL)
        {
            if (ch->GetDesc() != NULL)
            {
                ch->GetDesc()->Packet(data, bytes);            
            }            
        }
    }
not work :(

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.