//--------------------------------------------------------------
//				CChangeCreatureHPImp ::callback()  
//--------------------------------------------------------------
void CChangeCreatureHPImp::callback(const string &, NLNET::TServiceId sid)
{
	H_AUTO(CChangeCreatureHPImp);

	uint16 size = (uint16)Entities.size();
	if (Entities.size() != DeltaHp.size() )
	{
		nlwarning("Entities.size() != DeltaHp.size()");

		size = (uint16)min(Entities.size(),DeltaHp.size());
	}
	
	// for each creature, change HP
	for ( uint i = 0; i < size; ++i )
	{
		CCreature * c = CreatureManager.getCreature( Entities[i] );
		if ( c )
		{
			if( c->currentHp()+DeltaHp[i] > c->maxHp() )
			{
				// clamp hp
				c->changeCurrentHp( c->maxHp() - c->currentHp() );
			}
			else
			{
				c->changeCurrentHp( DeltaHp[i] );
			}
		}
	}
}
//--------------------------------------------------------------
//				CCreatureCompleteHealImp ::callback()  
//--------------------------------------------------------------
void CCreatureCompleteHealImp::callback(const string &, NLNET::TServiceId sid)
{
	H_AUTO(CCreatureCompleteHealImp);
	
	// for each creature, restore full HP
	for ( uint i = 0; i < Entities.size(); ++i )
	{
		CCreature * c = CreatureManager.getCreature( Entities[i] );
		if ( c )
		{
			c->changeCurrentHp( c->maxHp() - c->currentHp() );
		}
	}
}