for (int i=0;i<contsp[pCont->serial%HASHMAX].max;i++) { int ci=contsp[pCont->serial%HASHMAX].pointer[i];
vector<SERIAL> vecContainer = contsp.getData(pCont->serial); for (int i=0;i<vecContainer.size();i++) { int ci=calcItemFromSer(vecContainer[i]);
void pack_item(P_CLIENT ps, PKGx08 *pp) // Item is put into container{	int nCont=-1, nItem=-1;	int j, z, serial, serhash;//	tile_st tile;	bool abort=false;	UOXSOCKET s=ps->GetSocket();	CHARACTER cc=ps->GetCurrChar();	P_CHAR pc_currchar = MAKE_CHARREF_LR(cc);		serial=pp->Tserial;	if(serial == INVALID_SERIAL) abort=true;	serhash=serial%HASHMAX;	nCont = calcItemFromSer( serial );		serial=pp->Iserial;	if(serial == INVALID_SERIAL) abort=true;	serhash=serial%HASHMAX;	nItem = calcItemFromSer( serial );		if (nCont==-1)	{		RefreshItem(nCont);//AntiChrist		return;	} 		if (nItem==-1) return; //LB	const P_ITEM pCont=MAKE_ITEMREF_LR(nCont);	// on error return  (This one could be const ! Duke)	const P_ITEM pItem=MAKE_ITEMREF_LR(nItem);	// on error return	pItem->flags.isBeeingDragged=false;	if (pItem->id1>=0x40) 	{ 	   abort=true; // LB crashfix that prevents moving multi objcts in BP's       sysmessage(s,"Hey, putting houses in your pack crashes your back and client!");	}	j=GetPackOwner(nCont);	if (j>-1)	if (chars[j].npcaitype==17 && chars[j].isNpc() && !pc_currchar->Owns(&chars[j]))	{	   abort=true;	   sysmessage(s,"This aint your vendor!");					}	if(abort)	{//AntiChrist to preview item disappearing		item_bounce6(ps,pItem);		return;	}	if (pCont->layer==0 && pCont->id() == 0x1E5E &&		pc_currchar->Wears(pCont))	{		// Trade window???		serial=calcserial(pCont->moreb1, pCont->moreb2, pCont->moreb3, pCont->moreb4);		if(serial == INVALID_SERIAL) return;		z = calcItemFromSer( serial );				if (z!=-1)			if ((items[z].morez || pCont->morez))			{				items[z].morez=0;				pCont->morez=0;				sendtradestatus(z, nCont);			}	}		//	//AntiChrist - Special Bank Stuff	//	//if morey==123  - gold only bank		//	if(SrvParms->usespecialbank)//only if special bank is activated	{		if(pCont->morey==123 && pCont->morex==1 && pCont->type==1)		{			if ( pItem->id() == 0x0EED )			{//if they're gold ok				goldsfx(s, 2);			} else			{//if they're not gold..bounce on ground				sysmessage(s,"You can only put golds in this bank box!");				pItem->SetContSerial(-1);				pItem->MoveTo(pc_currchar->pos.x,pc_currchar->pos.y,pc_currchar->pos.z);				RefreshItem(nItem);//AntiChrist				itemsfx(s,pItem->id());				return;			}		}	}		//testing UOP Blocking Tauriel 1-12-99	if (!pItem->isInWorld())	{		item_bounce6(ps,pItem);		return;	}		if (!pc_currchar->canPickUp(pItem))	{		Sndbounce5(s);		if (ps->IsDragging())		{			ps->ResetDragging();			item_bounce3(pItem);			if (pCont->id1>=0x40)				senditem(s, nCont);		}		return;	}	// - Trash container	if (pCont->type==87)	{		Items->DeleItem(nItem);		sysmessage(s, "As you let go of the item it disappears.");		return;	}	// - Spell Book	if (pCont->type==9)	{		if (!IsSpellScroll72(pItem->id()))		{			sysmessage(s, "You can only place spell scrolls in a spellbook!");			Sndbounce5(s);			if (ps->IsDragging())			{				ps->ResetDragging();				item_bounce3(pItem);			}			if (pCont->id1>=0x40)				senditem(s, nCont);			return;		}		z=packitem(cc);		if (z!=-1) // lb		{			if (!pc_currchar->Wears(pCont) &&				(!(pCont->contserial==items[z].serial)) && (!(pc_currchar->canSnoop())))			{				sysmessage(s, "You cannot place spells in other peoples spellbooks.");				item_bounce6(ps,pItem);				return;			}						if(pItem->name[0]=='#')				pItem->getName(temp2);			else				strcpy((char*)temp2,pItem->name);			for (int i=0;i<contsp[pCont->serial%HASHMAX].max;i++) // antichrist , bugfix for inscribing scrolls			{				int ci=contsp[pCont->serial%HASHMAX].pointer[i];				if (ci!=-1)				{					if(items[ci].name[0]=='#')						items[ci].getName(temp);					else						strcpy((char*)temp,items[ci].name);					if(!(strcmp((char*)temp,(char*)temp2)) || !(strcmp((char*)temp,"All-Spell Scroll")))					{						sysmessage(s,"You already have that spell!");						item_bounce6(ps,pItem);						return;					}				}			}		}	}		// player run vendors	if (!(pCont->pileable && pItem->pileable && pCont->id()==pItem->id()		|| (pCont->type!=1 && pCont->type!=9)))	{		j=GetPackOwner(nCont);		if (j>-1) // bugkilling, LB, was j=!-1, arghh, C !!!		{			if (chars[j].npcaitype==17 && chars[j].isNpc() && pc_currchar->Owns(&chars[j]))			{				pc_currchar->inputitem=nItem;				pc_currchar->inputmode=1;				sysmessage(s, "Set a price for this item.");			}		}		short xx=pp->TxLoc;		short yy=pp->TyLoc;		pCont->AddItem(pItem,xx,yy);				itemsfx(s, pItem->id());// see itemsfx() for details - Dupois Added Oct 09, 1998		statwindow(s,cc);	}	// end of player run vendors		else		// - Unlocked item spawner or unlockable item spawner		if (pCont->type==63 || pCont->type==65 || pCont->type==66)		{			pItem->SetContSerial(pp->Tserial);			// lb bugfix			pItem->pos.x=pp->TxLoc;			pItem->pos.y=pp->TyLoc;			pItem->pos.z=pp->TzLoc;						SndRemoveitem(pItem->serial);			RefreshItem(nItem);//AntiChrist			itemsfx(s, pItem->id());					}		else  // - Pileable			if (pCont->pileable && pItem->pileable && pCont->id()==pItem->id())			{						if ((pCont->amount+pItem->amount) > 65535)				{					pItem->amount -= (65535-pCont->amount);					Commands->DupeItem(s, nCont, pItem->amount);					pCont->amount = 65535;					Items->DeleItem(nItem);				}				else				{					pCont->amount=pCont->amount+pItem->amount;					itemsfx(s, pItem->id());					Items->DeleItem(nItem);				}				SndRemoveitem(pItem->serial);				RefreshItem(nCont);//AntiChrist			}			else			{				pItem->pos.x=pp->TxLoc;				pItem->pos.y=pp->TyLoc;				pItem->pos.z=pp->TzLoc;//				pItem->SetContSerial(-1);				pItem->SetContSerial(pp->Tserial);				// Tauriel add item to world mapcells				mapRegions->Add(pItem); //add this item to a map cell								SndRemoveitem(pItem->serial);				RefreshItem(nCont);//AntiChrist			}						// - Spell Book				if (pCont->type==9)				Magic->SpellBook(s,nCont); // LB, bugfix for showing(!) the wrong spell (clumsy) when a new spell is put into opened spellbook			if (pItem->glow>0) // LB's glowing items stuff			{				int p=GetPackOwner(nCont); 				pc_currchar->removeHalo(pItem); // if gm put glowing object in another pack, handle glowsp correctly !				//removefromptr(&glowsp[pc_currchar->serial%HASHMAX],nItem);				if (p!=-1) 				{					chars[p].addHalo(pItem);					chars[p].glowHalo(pItem);				}		   							}	}