View Single Post
  #39  
Old 10-19-2009, 11:42 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default

As per KLS' suggestion, I should use new instead of malloc(), so I am going to. I should also free memory :P

Code:
void Client::DoTributeUpdate() {
	
	const Item_Struct* myitem = database.GetItem(1001);
	Item_Struct* item = new Item_Struct;
	memcpy(item, myitem, sizeof(Item_Struct));

	if(GetLevel() >= 76 && this->GetClientVersion() == EQClientSoF)
	{
		item->HP += (CalcBaseHP() - 5);
		item->Mana += (CalcMaxMana() - 5);
		item->Endur += (this->max_end - 5);
	}


	const Item_Struct* item2 = item;
	ItemInst* myinst = database.CreateBaseItem(item2);
	SendFakeItem(400, myinst, ItemPacketTributeItem);
	delete item;
        delete myinst;
	return;
			
}

Last edited by Secrets; 10-19-2009 at 11:47 PM.. Reason: forgot myinst cleanup
Reply With Quote