Jump to content

Little problem c++


Go to solution Solved by VegaS™,

Recommended Posts

Hi, I need check MySQL -> item -> window type from 50264 vnum item.

Examp:

 

char_item.cpp UseItemEx in CASE 50264:

if (XXX == window_type)
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("bla_bla_bla"));
	return false;
}

window_type = mysql -> item -> in 'window' column

 

I try this;

TItemPos Cell;
BYTE window_type = Cell.window_type;
if (MALL == window_type)
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("bla_bla_bla"));
	return false;
}

but didn't work.

 

Pls help me?

Sorry for my bad english.

Edited by blaxis
Link to comment
Share on other sites

  • Forum Moderator
  • Solution
2 hours ago, blaxis said:
TItemPos Cell;
BYTE window_type = Cell.window_type;
if (MALL == window_type)
{
	[...]
}

 

It won't work because you just initialized the structure with the default values from the constructor, which means window_type will be always INVENTORY

You already have the GetWindow function inside of CItem class, you can use it like this:

if (MALL == item->GetWindow())
{
	[...]
}

Or if you really want to use TItemPos and the functions from it, you must initialize it properly:

const TItemPos Cell(item->GetWindow(), item->GetCell());
Edited by VegaS™
  • Metin2 Dev 1
  • Good 2
Link to comment
Share on other sites

49 minutes ago, VegaS™ said:

Yapıyı yapıcıdan gelen varsayılan değerlerle başlattığınız için çalışmaz , bu da window_type her zaman ENVANTER olacağı anlamına gelir

CItem sınıfının içinde GetWindow işlevine  zaten sahipsiniz  , bunu şu şekilde kullanabilirsiniz:

 

	

Ya da TItemPos'u ve onun fonksiyonlarını gerçekten kullanmak istiyorsanız, onu düzgün bir şekilde başlatmanız gerekir:

  

Thank you very much!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

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.