int j, k, m1t, m2t, value,serial,serhash,ci;
int k, m1t, m2t, value,serial,ci;
void sendshopinfo(int s, int c, P_ITEM pi){	unsigned char m1[6096];	unsigned char m2[6096];	char itemname[256];	char cFoundItems=0;	memset(m1,0,6096);	memset(m2,0,6096);	memset(itemname,0,256);	int j, k, m1t, m2t, value,serial,serhash,ci;               	m1[0]=0x3C; // Container content message	m1[1]=0;// Size of message	m1[2]=0;// Size of message	m1[3]=0;//  Count of items	m1[4]=0;// Count of items	m2[0]=0x74;// Buy window details message	m2[1]=0;// Size of message	m2[2]=8;// Size of message	LongToCharPtr(pi->serial,m2+3); //Container serial number	m2[7]=0; // Count of items;	m1t=5;	m2t=8;	serial=pi->serial;	vector<SERIAL> vecContainer = contsp.getData(serial);	for (ci = 0; ci < vecContainer.size(); ci++)	{		P_ITEM pi_j = FindItemBySerial(vecContainer[ci]);		if (pi_j != NULL)			if ((pi_j->contserial==serial) &&				(m2[7]!=255) && (pi_j->amount!=0) ) // 255 items max per shop container			{				if (m2t>6000 || m1t>6000) break;				LongToCharPtr(pi_j->serial,m1+m1t+0);//Item serial number				ShortToCharPtr(pi_j->id(),m1+m1t+4);				m1[m1t+6]=0;			//Always zero				m1[m1t+7]=pi_j->amount>>8;//Amount for sale				m1[m1t+8]=pi_j->amount%256;//Amount for sale				m1[m1t+9]=pi_j->pos.x>>8; //Item x position				m1[m1t+10]=pi_j->pos.x%256;//Item x position				m1[m1t+11]=pi_j->pos.y>>8;//Item y position				m1[m1t+12]=pi_j->pos.y%256;//Item y position				LongToCharPtr(pi->serial,m1+m1t+13); //Container serial number				m1[m1t+17]=pi_j->color1;//Item color				m1[m1t+18]=pi_j->color2;//Item color				m1[4]++; // Increase item count.				m1t=m1t+19;				value=pi_j->value;				value=calcValue(pi_j, value);				if (SrvParms->trade_system==1) value=calcGoodValue(c, pi_j, value, 0); // by Magius(CHE)				m2[m2t+0]=value>>24;// Item value/price				m2[m2t+1]=value>>16;//Item value/price				m2[m2t+2]=value>>8; // Item value/price				m2[m2t+3]=value%256; // Item value/price				m2[m2t+4]=pi_j->getName(itemname); // Item name length				for(k=0;k<m2[m2t+4];k++)				{				  	m2[m2t+5+k]=itemname[k];				}				m2t=m2t+(m2[m2t+4])+5;				m2[7]++;				cFoundItems=1; //we found items so send message							}	}	m1[1]=m1t>>8;	m1[2]=m1t%256;	m2[1]=m2t>>8;	m2[2]=m2t%256;	if (cFoundItems==1)	{		Xsend(s, m1, m1t);		Xsend(s, m2, m2t);	}}