if (pPlayer->Owns(p_pet) && p_pet->stablemaster_serial==0)
if (pPlayer->Owns(p_pet) && (p_pet->stablemaster_serial==INVALID_SERIAL))
bool StableSpeech(cChar* pMaster, const QString& comm, cChar* pPlayer, UOXSOCKET s){	if (pMaster->npc_type!=1)	// is it a stablemaster ?		return 0;    //if (!strstr( comm, "STABLE"))	// lets check if the keyword stable is in the commandstring, if not return !	if (!comm.contains("STABLE"))		return 0;      	/////////////////////////////////////////////////////////////////////	//// so far we have a stablemaster! lets see if the caller has a pet	//// if so check if the pets name is in the commandstring	//// if not return    ///////////////////////////////////////////////////////////////////		bool found = false;	P_CHAR p_pet = NULL;	cRegion::RegionIterator4Chars ri(pPlayer->pos);	for (ri.Begin(); !ri.atEnd(); ri++)	{		p_pet = ri.GetData();		if (pPlayer->dist(p_pet) <= 8)		{			if (pPlayer->Owns(p_pet) && p_pet->stablemaster_serial==0) //owner of the pet ? and not already stabled ?			{				//char pntmp[150];				//strcpy(pntmp, p_pet->name.c_str());				//strupr(pntmp);				QString pntmp = p_pet->name.c_str();				if (comm.contains(pntmp, false))				{					found=true;					break;				}			}		}	}	if (!found) 	{ 		npctalk(s,pMaster,"which pet?",0);		return 1;	} 	/////////////////////////////////////////////////////////////	/// now we have a pet and stablemaster -> time to STABLE :-)    ////////////////////////////////////////////////////////////	    // set stablesp && pets stablemaster serial		// remove it from screen!	int xx=p_pet->pos.x;	int yy=p_pet->pos.y;	short id=p_pet->id(); 	p_pet->setId(0); 	p_pet->pos.x=0;	p_pet->pos.y=0;	for (int ch=0; ch<now; ch++)	{			if (perm[ch]) impowncreate(ch, p_pet, 0); 	}	p_pet->setId(id); 	p_pet->war=false;	p_pet->attacker = INVALID_SERIAL;	pPlayer->war=false;	pPlayer->targ=INVALID_SERIAL;	p_pet->pos.x=xx;	p_pet->pos.y=yy;	mapRegions->Remove(p_pet);	p_pet->stablemaster_serial=pMaster->serial;	// set timer for fee calculation    p_pet->time_unused=0;	p_pet->timeused_last = getNormalizedTime();	stablesp.insert(pMaster->serial, p_pet->serial);	sprintf(temp,"Your pet is now stabled, say retrieve or claim %s to claim your pet",p_pet->name.c_str());	npctalk(s,pMaster,temp,0);	return 1;}