Q_INT8 itemTop = ( item.z + item.height );
Q_INT32 itemTop = ( item.z + item.height );
bool mayWalk( P_CHAR pChar, Coord_cl& pos ){	// Go trough the array top-to-bottom and check	// If we find a tile to walk on	vector<stBlockItem> blockList = getBlockingItems( pChar, pos );	bool found = false;	Q_UINT32 i;	bool priviledged = false;	Q_INT32 oldz = pos.z;	P_PLAYER player = dynamic_cast<P_PLAYER>( pChar );	priviledged = player && player->isGM();	for ( i = 0; i < blockList.size(); ++i )	{		stBlockItem item = blockList[i];		Q_INT8 itemTop = ( item.z + item.height );		// If we found something to step on and the next tile		// below would block us, use the good one instead		if (found && (itemTop > pos.z - P_M_MAX_Z_BLOCKS || !item.walkable)) {			break;		}		// If we encounter any object with itemTop <= pos.z which is NOT walkable		// Then we can as well just return false as while falling we would be		// blocked by that object		if ( !item.walkable && !priviledged && itemTop < pos.z )			return false;		if ( item.walkable || priviledged ) {			// If the top of the item is within our max-climb reach			// then the first check passed. in addition we need to			// check if the "bottom" of the item is reachable			// I would say 2 is a good "reach" value for the bottom			// of any item			if ( itemTop < pos.z + P_M_MAX_Z_CLIMB && itemTop >= pos.z - P_M_MAX_Z_FALL ) {				// We already found something to step on above.				// See if it's easier to step down.				if (found && abs(oldz - pos.z) < abs(oldz - itemTop)) {					break;				}				pos.z = itemTop;				found = true;				if (item.height > 1) {					break;				}				// break; - We can't break here anymore since we have to check if the ground would be easier				// to step on			// Climbing maptiles is 5 tiles easier			} else if ( item.maptile && itemTop < pos.z + P_M_MAX_Z_CLIMB + 5 && itemTop >= pos.z - P_M_MAX_Z_FALL ) {				// We already found something to step on above.				// See if it's easier to step down.				if (found && abs(oldz - pos.z) < abs(oldz - itemTop)) {					break;				}				pos.z = itemTop;				found = true;				break;			} else if ( itemTop < pos.z ) {				// We already found something to step on above.				// See if it's easier to step down.				if (found && abs(oldz - pos.z) < abs(oldz - itemTop)) {					break;				}				pos.z = itemTop;				found = true;				break;			}		}	}	if ( priviledged )	{		return true;	}	// If we're still at the same position	// We didn't find anything to step on	if ( !found )		return false;	// Another loop *IS* needed here (at least that's what i think)	for ( i = 0; i < blockList.size(); ++i )	{		// So we know about the new Z position we are moving to		// Lets check if there is enough space ABOVE that position (at least 15 z units)		// If there is ANY impassable object between pos.z and pos.z + 15 we can't walk here		stBlockItem item = blockList[i];		Q_INT8 itemTop = ( item.z + item.height );		// If the item is below what we step on, ignore it		if (itemTop <= pos.z) {			continue;		}		// Does the top of the item looms into our space		// Like before 15 is the assumed height of ourself		// Use the new position here.		if ( ( itemTop > pos.z ) && ( itemTop < pos.z + P_M_MAX_Z_BLOCKS ) )			return false;		// Or the bottom ?		// note: the following test was commented out.  by putting the code back in,		// npcs stop wandering through the walls of multis.  I am curious if this code		// has other (negative) affects besides that.		 if ( ( item.z > oldz ) && ( item.z < oldz + P_M_MAX_Z_BLOCKS / 2 ) )			return false;		// Or does it spread the whole range ?		if ( ( item.z <= oldz ) && ( itemTop >= oldz + P_M_MAX_Z_BLOCKS / 2 ) )			return false;	}	// All Checks passed	return true;}