x = pi->id(); if (x==(db+0))
if( x == ( db + 0 ) )
void dooruse(UOXSOCKET s, P_ITEM pi){	int i, db, x;//, z;	char changed=0;	if (pi == NULL) return;	if (s != INVALID_UOXSOCKET && (iteminrange(s,pi,2)==0)) {sysmessage(s, "You cannot reach the handle from here"); return;}	for (i=0;i<DOORTYPES;i++)	{		db=doorbase[i];		x = pi->id();		if (x==(db+0))		{			pi->setId( pi->id() + 1 );			pi->pos.x--;			pi->pos.y++;			RefreshItem(pi);			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+1))		{			pi->setId( pi->id() - 1 );			pi->pos.x++;			pi->pos.y--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		} else if (x==(db+2))		{			pi->setId( pi->id() + 1 );			pi->pos.x++;			pi->pos.y++;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+3))		{			pi->setId( pi->id() - 1 );			pi->pos.x--;			pi->pos.y--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		} else if (x==(db+4))		{			pi->setId( pi->id() + 1 );			pi->pos.x--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+5))		{			pi->setId( pi->id() - 1 );			pi->pos.x++;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		} else if (x==(db+6))		{			pi->setId( pi->id() + 1 );			pi->pos.x++;			pi->pos.y--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+7))		{			pi->setId( pi->id() - 1 );			pi->pos.x--;			pi->pos.y++;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		} else if (x==(db+8))		{			pi->setId( pi->id() + 1 );			pi->pos.x++;			pi->pos.y++;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+9))		{			pi->setId( pi->id() - 1 );			pi->pos.x--;			pi->pos.y--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		} else if (x==(db+10))		{			pi->setId( pi->id() + 1 );			pi->pos.x++;			pi->pos.y--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+11))		{			pi->setId( pi->id() - 1 );			pi->pos.x--;			pi->pos.y++;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		}		else if (x==(db+12))		{			pi->setId( pi->id() + 1 );			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+13))		{			pi->setId( pi->id() - 1 );			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		} else if (x==(db+14))		{			pi->setId( pi->id() + 1 );			pi->pos.y--;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 0);			tempeffect2(0, pi, 13, 0, 0, 0);		} else if (x==(db+15))		{			pi->setId( pi->id() - 1 );			pi->pos.y++;			RefreshItem(pi);//AntiChrist			changed=1;			doorsfx(pi, x, 1);			pi->dooropen=0;		}	}		if (changed && s != INVALID_UOXSOCKET)	{		// house refreshment when a house owner or friend of a houe opens the house door		float ds=0;		P_CHAR pc_currchar = currchar[s];				cHouse* pHouse = dynamic_cast<cHouse*>(findmulti(pi->pos));		if (pHouse == NULL)			return;		if(!(pc_currchar->Owns(pHouse) || pHouse->isFriend(pc_currchar)))			return;		if (SrvParams->housedecay_secs()!=0)			ds = static_cast<float>((pHouse->time_unused)*100) / (SrvParams->housedecay_secs());		else			ds = -1;			if (ds >= 50) // sysmessage if decay status >=50%		{			sysmessage(s,"You refreshed the house");		}		pHouse->time_unused = 0;		pHouse->last_used = getNormalizedTime();	}	if (!changed && s != INVALID_UOXSOCKET)		sysmessage(s, "This doesnt seem to be a valid door type. Contact a GM.");}