if (range == -1) {
if (range == 0) {
static PyObject* wpChar_canreach( wpChar* self, PyObject* args ) {	if (self->pChar->free)		Py_RETURN_FALSE;	P_PLAYER pPlayer = dynamic_cast<P_PLAYER>( self->pChar );	if ( pPlayer && pPlayer->isGM() )		Py_RETURN_TRUE;	PyObject *target;	int range;	int debug = 0;	if (!PyArg_ParseTuple(args, "Oi|i:char.canreach(target, range)", &target, &range, &debug)) {		return 0;	}	Coord_cl targetPos;	if (checkWpCoord(target)) {		if (range == -1) {			Py_RETURN_FALSE;		}		targetPos = getWpCoord(target).losMapPoint();	} else if (checkWpItem(target)) {		P_ITEM pItem = getWpItem(target);		P_CHAR pOutmost = pItem->getOutmostChar();		if (pOutmost == self->pChar) {			Py_RETURN_TRUE;		}		// Range -1 means that the item has to be on the char		if (range == -1 && pOutmost != self->pChar) {			Py_RETURN_FALSE;		}		targetPos = pItem->pos().losItemPoint(pItem->id());	} else if (checkWpChar(target)) {		if (range == -1) {			Py_RETURN_FALSE;		}		P_CHAR pChar = getWpChar(target);		targetPos = pChar->pos().losCharPoint(false);	} else if (target->ob_type == &wpTargetType) {		SERIAL object = ((wpTarget*)target)->object;		Coord_cl pos = ((wpTarget*)target)->pos;		unsigned short model = ((wpTarget*)target)->model;		P_ITEM pItem = dynamic_cast<P_ITEM>(World::instance()->findItem(object));		if (pItem) {			pItem = pItem->getOutmostItem();			if (pItem->container() && pItem->container()->isChar()) {				if (range == -1) {					Py_RETURN_TRUE;				}				targetPos = pItem->container()->pos().losCharPoint();			} else {				if (range == -1) {					Py_RETURN_FALSE;				}				targetPos = pItem->pos().losItemPoint(pItem->id());			}		} else {			if (range == -1) {				Py_RETURN_FALSE;			}			P_CHAR pChar = dynamic_cast<P_CHAR>(World::instance()->findChar(object));			if (pChar) {				targetPos = pChar->pos().losCharPoint();			} else {				if (model != 0) {					targetPos = pos.losItemPoint(model);				} else {					targetPos = pos.losMapPoint();				}			}		}	} else {		PyErr_SetString(PyExc_TypeError, "Unknown target type for char.canreach()");		return 0;	}	// Now that we have the target position, measure the distance.	Coord_cl pos = self->pChar->pos().losCharPoint(true);	if (pos.map != targetPos.map) {		Py_RETURN_FALSE;	}	if ( (int)pos.distance(targetPos) > range ) {		Py_RETURN_FALSE;	}	if (!pos.lineOfSight(targetPos, debug != 0)) {		Py_RETURN_FALSE;	}	Py_RETURN_TRUE;}