set substructdatabyname

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

set substructdatabyname

Post by Ememjr » Mon Jun 26, 2017 6:25 am

in the below code with Whats wrong with me on it, cause a complile error (see below), but if a replace item->details with "hello", a string in quotes it compiles, i dont understand why since item->name is a string value

Code: Select all

item = master_item_list.GetItemByName(recipe->GetName());
	if (item) {
		
		packet->setSubstructDataByName("recipe_info", "product_icon", item->details.icon); //item->details.icon);
		packet->setSubstructDataByName("recipe_info", "product_name", item->name); //item->name //WHATS WRONG WITH ME
		packet->setSubstructDataByName("recipe_info", "product_qty", 1);
		packet->setSubstructDataByName("recipe_info", "product_item_id", item->details.item_id); //item->details.item_id);
		//packet->setSubstructDataByName("recipe_info", "product_item_crc", item->details.item_crc); //item->details.item_crc);
	}
errors here
errors.JPG
You do not have the required permissions to view the files attached to this post.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: set substructdatabyname

Post by Jabantiz » Mon Jun 26, 2017 3:47 pm

These functions probably want some form of char so passing a string won't work. "hello" works because it is treated as a char array. To pass a string as a char array use c_str(), so item->name.c_str()

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests