[IMPLEMENTED] Expose MapElevation function to JS for retrieving Z level

If Wishes were UOX Coders, we'd be done by now ;P Post your wishes/suggestions for UOX3 changes/improvements here.
Post Reply
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Expose MapElevation function to JS for retrieving Z level

Post by Xuri »

We currently have the following bit of code in mapstuff.cpp to retrieve the elevation of the map at some given coordinates:

Code: Select all

// return the elevation of MAP0.MUL at given coordinates, we'll assume since its land
// the height is inherently 0
SI08 CMulHandler::MapElevation( SI16 x, SI16 y, UI08 worldNumber )
{
	const map_st map = SeekMap( x, y, worldNumber );
	// make sure nothing can move into black areas
	if( 430 == map.id || 431 == map.id || 432 == map.id ||
		433 == map.id || 434 == map.id || 475 == map.id ||
		580 == map.id || 610 == map.id || 611 == map.id ||
		612 == map.id || 613 == map.id)
		return ILLEGAL_Z;
	return map.z;
}
As far as I can see we don't have this exposed to the JS engine, though it would be very handy if that was the case.
-= Ho Eyo He Hum =-
Post Reply