Page 1 of 1

set substructdatabyname

Posted: Mon Jun 26, 2017 6:25 am
by Ememjr
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

Re: set substructdatabyname

Posted: Mon Jun 26, 2017 3:47 pm
by Jabantiz
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()