• 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!

Fix/Patch Fixing playerAcceptTrade crash

Obito

0x1337
Joined
Feb 17, 2011
Messages
350
Solutions
8
Reaction score
145
Location
Egypt
Hi, after debugging the Evolutions XML sources finally I found the bug that accused crashing the most 810 servers and I guess it is caused
by executing this function even when the trade hasn't been successful too many times so I decided to add an if statement to allow and disallow trade before executing. Note: (these codes are compatible only with this source Evolutions XML SVN 0.6.0)
Rich (BB code):
*****************************************************
Error report - Mon Apr 04 14:34:35 2022

Compiler info - GNU 7.5.0 MinGW
Compilation Date - Mon Apr 04 14:34:35 2022

Name: Evolutions-XML.exe
Memory load: 53
Total phys: 2097151 K available phys: 2097151 K
Start time: 4-4-2022  12:34:5
Kernel time: 0:0:0.390
User time: 0:0:3.421
Threads: 6

Exception: 0xc0000005 at eip = 0x452d9d(Game::playerAcceptTrade(unsigned int) - 0x4526e2)
eax = 0
ebx = 0x1c581c28 -> 0x66c040
ecx = 0x4c6e048 -> 0x43
edx = 0x4c6e048 -> 0x43
esi = 0x1c581c2c -> 0x10001f52
edi = 0x76377da0 -> 0x8b55ff8b
ebp = 0xfe9fda4 -> 0xfe9fdc4
esp = 0xfe9fc9c -> 0x5b40330
efl = 0x10212

---Stack Trace---
From: 0xfe9fc9c to: 0xfea0000
0xfe9fc9c | 0x5b40330 -> 0x668b34
0xfe9fca0 | 0x16
0xfe9fca4 | 0xfe9fd3c -> 0x642804c
0xfe9fca8 | 0x3a309f0 -> 0x6686ac
0xfe9fcac | 0
0xfe9fcb0 | 0x1
0xfe9fcb4 | 0x12f0000 -> 0x3b3872c8
0xfe9fcb8 | 0x1c581c24 -> 0
0xfe9fcbc | 0x6cff858 -> 0x3a30a0c
0xfe9fcc0 | 0x6cff858 -> 0x3a30a0c
0xfe9fcc4 | 0xfe9fcf4 -> 0x12f0000
0xfe9fcc8 | 0x635b61 -> 0x8bf84589
0xfe9fccc | 0x64
0xfe9fcd0 | 0
0xfe9fcd4 | 0x1c4d6170 -> 0x1280138
0xfe9fcd8 | 0x124
0xfe9fcdc | 0x5b40434 -> 0x668d18
0xfe9fce0 | 0x1208e9cc -> 0x668d18
0xfe9fce4 | 0x3a309f0 -> 0x6686ac
0xfe9fce8 | 0x3a30a0c -> 0x66875c
0xfe9fcec | 0x1c581c38 -> 0x4526e2
0xfe9fcf0 | 0x1c4d6160 -> 0x1202298
0xfe9fcf4 | 0x12f0000 -> 0x3b3872c8
0xfe9fcf8 | 0xfe9fe38 -> 0x87f94c
0xfe9fcfc | 0x2
0xfe9fd00 | 0x772e7b86 -> 0xe58b5e5f
0xfe9fd04 | 0
0xfe9fd08 | 0
0xfe9fd0c | 0
0xfe9fd10 | 0x5468b0 -> 0x8de58955
0xfe9fd14 | 0x644d3c -> 0x401ffff
0xfe9fd18 | 0xfe9fd8c -> 0x4ef098
0xfe9fd1c | 0x452d18 -> 0x8b186d8d
0xfe9fd1c  Game::playerAcceptTrade(unsigned int)(0x4526e2)
0xfe9fd20 | 0xfe9fc9c -> 0x5b40330
0xfe9fd24 | 0
0xfe9fd28 | 0x1c581c38 -> 0x4526e2
0xfe9fd2c | 0x642804c -> 0x64617254
0xfe9fd30 | 0x76377da0 -> 0x8b55ff8b
0xfe9fd34 | 0x4ef098 -> 0x57e58955
0xfe9fd34  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9fd38 | 0x1c581c24 -> 0
0xfe9fd3c | 0x642804c -> 0x64617254
0xfe9fd40 | 0x19b0b52c -> 0x30000440
0xfe9fd80 | 0
0xfe9fd84 | 0x1208e8c8 -> 0x668b34
0xfe9fd88 | 0x5b40330 -> 0x668b34
0xfe9fd8c | 0x4ef098 -> 0x57e58955
0xfe9fd8c  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9fd90 | 0x7639fe4d -> 0xccccc3c9
0xfe9fd94 | 0xd34b972 -> 0
0xfe9fd98 | 0x1c581c28 -> 0x66c040
0xfe9fd9c | 0x1c581c2c -> 0x10001f52
0xfe9fda0 | 0x76377da0 -> 0x8b55ff8b
0xfe9fda4 | 0xfe9fdc4 -> 0xfe9fde4 \\\\\\ stack frame //////
0xfe9fda8 | 0x5af69c -> 0xc9c0b60f <-- ret
0xfe9fdac | 0x66c040 -> 0
0xfe9fdb0 | 0x10001f52 -> 0xbe840f
0xfe9fdb4 | 0xfe9fdc4 -> 0xfe9fde4
0xfe9fdb8 | 0x5af185 -> 0x5590c3c9
0xfe9fdbc | 0x1c581c28 -> 0x66c040
0xfe9fdc0 | 0x4526e2 -> 0x57e58955
0xfe9fdc0  Game::playerAcceptTrade(unsigned int)(0x4526e2)
0xfe9fdc4 | 0xfe9fde4 -> 0xfe9fe04 \\\\\\ stack frame //////
0xfe9fdc8 | 0x566a64 -> 0x83c0b60f <-- ret
0xfe9fdcc | 0x1c581c20 -> 0x4526e2
0xfe9fdd0 | 0x66c040 -> 0
0xfe9fdd4 | 0x10001f52 -> 0xbe840f
0xfe9fdd8 | 0xfe9fe24 -> 0xfe9fe34
0xfe9fddc | 0x548d138 -> 0
0xfe9fde0 | 0x4ef098 -> 0x57e58955
0xfe9fde0  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9fde4 | 0xfe9fe04 -> 0xfe9fe14 \\\\\\ stack frame //////
0xfe9fde8 | 0x568c42 -> 0xc9c0b60f <-- ret
0xfe9fdec | 0x1c581c28 -> 0x66c040
0xfe9fdf0 | 0x76377d00 -> 0xccccebeb
0xfe9fdf4 | 0x1c581c20 -> 0x4526e2
0xfe9fdf8 | 0xfe9fe03 -> 0xe9fe140f
0xfe9fdfc | 0
0xfe9fe00 | 0xfe9fe70 -> 0x1c581c98
0xfe9fe04 | 0xfe9fe14 -> 0xfe9fe94 \\\\\\ stack frame //////
0xfe9fe08 | 0x58239f -> 0x9090c3c9 <-- ret
0xfe9fe0c | 0x1c581c20 -> 0x4526e2
0xfe9fe10 | 0x1c581c20 -> 0x4526e2
0xfe9fe14 | 0xfe9fe94 -> 0xfe9fea4 \\\\\\ stack frame //////
0xfe9fe18 | 0x5b1105 -> 0x89a4458d <-- ret
0xfe9fe1c | 0x1c581c20 -> 0x4526e2
0xfe9fe20 | 0xfffffffe
0xfe9fe24 | 0xfe9fe34 -> 0xfe9fe44
0xfe9fe28 | 0x547cc5 -> 0x9090c3c9
0xfe9fe2c | 0x1c581c98 -> 0x64c3c8
0xfe9fe30 | 0x24
0xfe9fe34 | 0xfe9fe44 -> 0xfe9fe64
0xfe9fe38 | 0x87f94c -> 0xfe9fa94
0xfe9fe70 | 0x1c581c98 -> 0x64c3c8
0xfe9fe74 | 0xf491dfa8
0xfe9fe78 | 0x17f
0xfe9fe7c | 0x624ae5db
0xfe9fe80 | 0xff880030
0xfe9fe84 | 0xfe90000
0xfe9fe88 | 0x548d138 -> 0
0xfe9fe8c | 0x4ef098 -> 0x57e58955
0xfe9fe8c  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9fe90 | 0x76377da0 -> 0x8b55ff8b
0xfe9fe94 | 0xfe9fea4 -> 0xfe9ff34 \\\\\\ stack frame //////
0xfe9fe98 | 0x56031d -> 0x5590c3c9 <-- ret
0xfe9fe9c | 0x1c581bf0 -> 0x57da10
0xfe9fea0 | 0x548d138 -> 0
0xfe9fea4 | 0xfe9ff34 -> 0xfe9ff6c \\\\\\ stack frame //////
0xfe9fea8 | 0x4ef1de -> 0x89d4458b <-- ret
0xfe9fea8  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9feac | 0x1c581bf0 -> 0x57da10
0xfe9feb0 | 0x64c3ac -> 0x773c6ac0
0xfe9feb4 | 0x548bfd0 -> 0x830c288
0xfe9feb8 | 0x1
0xfe9febc | 0x548d138 -> 0
0xfe9fec0 | 0x830c288 -> 0x1200830
0xfe9fec4 | 0x12f0000 -> 0x3b3872c8
0xfe9fec8 | 0
0xfe9fef8  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9ff10 | 0xfe9ff5c -> 0xfe9ffcc
0xfe9ff14 | 0x443986 -> 0x57e58955
0xfe9ff14  _SEHHandler(_EXCEPTION_RECORD*, void*, _CONTEXT*, void*)(0x443986)
0xfe9ff18 | 0x76377da0 -> 0x8b55ff8b
0xfe9ff1c | 0xecde0c6b
0xfe9ff20 | 0xfe9ff6c -> 0xfe9ff74
0xfe9ff24 | 0x76377ae2 -> 0x5ec68b5f
0xfe9ff28 | 0x548d138 -> 0
0xfe9ff2c | 0x4ef098 -> 0x57e58955
0xfe9ff2c  Dispatcher::dispatcherThread(void*)(0x4ef098)
0xfe9ff30 | 0x76377da0 -> 0x8b55ff8b
0xfe9ff34 | 0xfe9ff6c -> 0xfe9ff74 \\\\\\ stack frame //////
0xfe9ff38 | 0x76377d2d -> 0x2de859 <-- ret
0xfe9ff3c | 0
0xfe9ff40 | 0xc6b9ed18
0xfe9ff44 | 0x76377da0 -> 0x8b55ff8b
0xfe9ff48 | 0x76377da0 -> 0x8b55ff8b
0xfe9ff4c | 0x548d138 -> 0
0xfe9ff50 | 0xfe9ff40 -> 0xc6b9ed18
0xfe9ff54 | 0xfe9ff40 -> 0xc6b9ed18
0xfe9ff58 | 0xfe9ffcc -> 0xfe9ffe4
0xfe9ff5c | 0xfe9ffcc -> 0xfe9ffe4
0xfe9ff60 | 0x7636dcd0 -> 0x8b55ff8b
0xfe9ff64 | 0xbf6bd30c
0xfe9ff68 | 0
0xfe9ff6c | 0xfe9ff74 -> 0xfe9ff84 \\\\\\ stack frame //////
0xfe9ff70 | 0x76377e01 -> 0xcccccccc <-- ret
0xfe9ff74 | 0xfe9ff84 -> 0xfe9ffdc
0xfe9ff78 | 0x76146739 -> 0x2815ff50 <-- ret
0xfe9ff7c | 0x548d138 -> 0
0xfe9ff80 | 0x76146720 -> 0x8b55ff8b
0xfe9ff84 | 0xfe9ffdc -> 0xfe9ffec \\\\\\ stack frame //////
0xfe9ff88 | 0x77308e7f -> 0xb0e9 <-- ret
0xfe9ff8c | 0x548d138 -> 0
0xfe9ff90 | 0xecde0cbf
0xfe9ff94 | 0
0xfe9ff98 | 0
0xfe9ff9c | 0x548d138 -> 0
0xfe9ffa0 | 0
0xfe9ffa4 | 0
0xfe9ffa8 | 0
0xfe9ffb8 | 0
0xfe9ffbc | 0
0xfe9ffc0 | 0
0xfe9ffc4 | 0xfe9ff90 -> 0xecde0cbf
0xfe9ffc8 | 0
0xfe9ffcc | 0xfe9ffe4 -> 0xffffffff
0xfe9ffd0 | 0x7731d0b0 -> 0x8b55ff8b
0xfe9ffd4 | 0x940d1893
0xfe9ffd8 | 0
0xfe9ffdc | 0xfe9ffec -> 0 \\\\\\ stack frame //////
0xfe9ffe0 | 0x77308e4d -> 0xcccccccc <-- ret
0xfe9ffe4 | 0xffffffff
0xfe9ffe8 | 0x77338c84 -> 0x90909090
0xfe9ffec | 0 \\\\\\ stack frame //////
0xfe9fff0 | 0 <-- ret
0xfe9fff4 | 0x76377da0 -> 0x8b55ff8b
0xfe9fff8 | 0x548d138 -> 0
0xfe9fffc | 0
*****************************************************
1. Open game.cpp find this line
Code:
bool Game::playerAcceptTrade(Player* player)
in the same class exactly line 2162 replace it with this part
C++:
        if(!isSuccess)
        {
            std::string errorDescription;
            if(tradePartner->tradeItem)
            {
                errorDescription = getTradeErrorDescription(ret1, tradeItem1);
                tradePartner->sendTextMessage(MSG_EVENT_ADVANCE, errorDescription);
                tradeItem2->onTradeEvent(ON_TRADE_CANCEL, tradePartner);
            }
            if(player->tradeItem)
            {
                errorDescription = getTradeErrorDescription(ret2, tradeItem2);
                player->sendTextMessage(MSG_EVENT_ADVANCE, errorDescription);
                tradeItem1->onTradeEvent(ON_TRADE_CANCEL, player);
            }
        }

        player->setTradeState(TRADE_NONE);
        player->tradeItem = NULL;
        player->tradePartner = NULL;
        player->sendTradeClose();

        tradePartner->setTradeState(TRADE_NONE);
        tradePartner->tradeItem = NULL;
        tradePartner->tradePartner = NULL;
        tradePartner->sendTradeClose();

 
    }

}
then save and in the same file afterwards you posted the pervious class add this
C++:
std::string Game::getTradeErrorDescription(ReturnValue ret, Item* item)
{
    std::stringstream ss;
    if(ret == RET_NOTENOUGHCAPACITY){
        ss << "You do not have enough capacity to carry";
        if(item->isStackable() && item->getItemCount() > 1){
            ss << " these objects.";
        }
        else{
            ss << " this object." ;
        }
        ss << std::endl << " " << item->getWeightDescription();
    }
    else if(ret == RET_NOTENOUGHROOM || ret == RET_CONTAINERNOTENOUGHROOM){
        ss << "You do not have enough room to carry";
        if(item->isStackable() && item->getItemCount() > 1){
            ss << " these objects.";
        }
        else{
            ss << " this object.";
        }
    }
    else{
        ss << "Trade could not be completed.";
    }
    return ss.str().c_str();
}
--Edit--
Sorry guys I forgot to add the header code so we have a declaration scope with the function
Rich (BB code):
getTradeErrorDescription
and I forgot to call it in game.h file so, open game.h find
C++:
void startDecay(Item* item);
add this afterwards
C++:
std::string getTradeErrorDescription(ReturnValue ret, Item* item);
Rebuild and you're done,
You're welcome to post any ideas or a correction we all still learning and this thread is gonna be a togetherness for fixing any other bugs related to these sources.
P.S. decreasing the maxPacketsPerSecond that won't fix the problem.
PS. In my opinion, you could move to better/higher TFS to avoid these bugs because these sources are so ancient and outdated.
 
Last edited:
Thank you for remembering.
there is a lot of it, but slowly I have everything fixed.
 

Similar threads

Back
Top