bind g_map.getSpectators

master
Eduardo Bart 12 years ago
parent 2a62159a61
commit 20390d6684

@ -21,7 +21,7 @@ local function onUseWithMouseRelease(self, mousePosition, mouseButton)
if mouseButton == MouseLeftButton then
local clickedWidget = Game.gameUi:recursiveGetChildByPos(mousePosition)
if clickedWidget then
if clickedWidget:getClassName() == 'Tile' then
if clickedWidget:getClassName() == 'UIMap' then
local tile = clickedWidget:getTile(mousePosition)
if tile then
Game.useWith(Game.selectedThing, tile:getTopMultiUseThing())

@ -306,6 +306,8 @@ std::vector<CreaturePtr> Map::getSpectatorsInRangeEx(const Position& centerPos,
maxZRange = Otc::MAX_Z;
}
//TODO: get creatures from other floors corretly
for(int iz=-minZRange; iz<=maxZRange; ++iz) {
for(int iy=-minYRange; iy<=maxYRange; ++iy) {
for(int ix=-minXRange; ix<=maxXRange; ++ix) {

@ -197,7 +197,6 @@ void MapView::updateVisibleTilesCache(int start)
// cache visible tiles in draw order
// draw from last floor (the lower) to first floor (the higher)
for(int iz = m_cachedLastVisibleFloor; iz >= m_cachedFirstVisibleFloor && !stop; --iz) {
//TODO: cleanup this code
if(m_viewRange <= FAR_VIEW) {
// draw tiles like linus pauling's rule order
const int numDiagonals = m_drawDimension.width() + m_drawDimension.height() - 1;
@ -245,6 +244,7 @@ void MapView::updateVisibleTilesCache(int start)
int fillHeight = (quadTopLeft.x >= 0) ? quadHeight-1 : quadHeight;
if(quadTopLeft.y >= 0) {
for(int qx=0;qx<fillWidth;++qx) {
//TODO: remvoe this repeated code
// only start really looking tiles in the desired start
if(count < start) {
count++;
@ -332,7 +332,6 @@ void MapView::updateVisibleTilesCache(int start)
// schedule next update continuation
m_updateTilesCacheEvent = g_dispatcher.addEvent(std::bind(&MapView::updateVisibleTilesCache, asMapView(), count));
}
if(start == 0)
m_cachedFloorVisibleCreatures = g_map.getSpectators(cameraPosition, false);
}
@ -448,7 +447,7 @@ int MapView::getFirstVisibleFloor()
Position cameraPosition = getCameraPosition();
// avoid rendering multile floors on far views
// avoid rendering multifloors in far views
if(m_viewRange >= FAR_VIEW)
return cameraPosition.z;
@ -495,7 +494,7 @@ int MapView::getLastVisibleFloor()
{
Position cameraPosition = getCameraPosition();
// avoid rendering multile floors on far views
// avoid rendering multifloors in far views
if(m_viewRange >= FAR_VIEW)
return cameraPosition.z;

@ -73,6 +73,7 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassStaticFunction("g_map", "getCentralPosition", std::bind(&Map::getCentralPosition, &g_map));
g_lua.bindClassStaticFunction("g_map", "getCreatureById", std::bind(&Map::getCreatureById, &g_map, _1));
g_lua.bindClassStaticFunction("g_map", "removeCreatureById", std::bind(&Map::removeCreatureById, &g_map, _1));
g_lua.bindClassStaticFunction("g_map", "getSpectators", std::bind(&Map::getSpectators, &g_map, _1, _2));
g_lua.bindGlobalFunction("getOufitColor", Outfit::getColor);

Loading…
Cancel
Save