Hi to all,
I am coding a library for hooking some functions in game, its okay while i am not using aditional definitions on character class i mean ;
class iCHARACTER: public CHARACTER{
public:
int m_counterxxx;
public:
void ban(long len, const char* reason, const char* by);
};
#endif // __GAME_ICHARACTER_HPP
/////////////////////////////////////////////////iCHARACTER.hpp
namespace Hooks{
MoveHook::MoveHook():Hook::Hook() {
// default config
}
void MoveHook::hook(CInputMain* self, iCHARACTER* ch, const char * data) {
if (ch->m_counterxxx == 100)
ch->m_counterxxx = 0;
ch->m_counterxxx++;
instance()->detour->GetOriginalFunction()(self,ch,data);
}
}
//MoveHook.cpp
if i wont use ch->m_counterxxx pointer there isnt any problem but when i use it while i am playing its ok, but when i exit the game, game creates a core.
gdb :
#0 CItem::SetSkipSave (b=<optimized out>, this=<optimized out>) at item.h:141
#1 CHARACTER::ClearItem (this=0x5342f000) at char_item.cpp:532
#2 0x0807bb7c in CHARACTER::Destroy (this=0x5342f000) at char.cpp:509
#3 0x0807bbf6 in CHARACTER::~CHARACTER (this=0x5342f000,
__in_chrg=<optimized out>) at char.cpp:138
#4 0x080b49ae in CHARACTER_MANAGER::DestroyCharacter (this=0xbfbfd424,
ch=0x5342f000) at char_manager.cpp:169
#5 0x0807e292 in CHARACTER::Disconnect (this=0x5342f000,
c_pszReason=0x8395afb "DESC::~DESC") at char.cpp:1533
#6 0x0810c2c6 in DESC::Destroy (this=0x2b0c0e00) at desc.cpp:131
#7 0x081109af in DESC_MANAGER::DestroyDesc (this=0xbfbfe91c, d=0x2b0c0e00,
bEraseFromSet=false) at desc_manager.cpp:254
#8 0x081113d5 in DESC_MANAGER::DestroyClosed (this=0xbfbfe91c)
at desc_manager.cpp:283
#9 0x082716e3 in io_loop (fdw=0x29358760) at main.cpp:895
#10 0x08272271 in idle () at main.cpp:842
#11 0x08273aec in main (argc=1, argv=0x53420000) at main.cpp:507