From 20390d66843fc29d6eda9e3bea5f18b4a61d19db Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 1 Feb 2012 17:37:40 -0200 Subject: [PATCH] bind g_map.getSpectators --- modules/game/game.lua | 2 +- src/otclient/core/map.cpp | 2 ++ src/otclient/core/mapview.cpp | 7 +++---- src/otclient/luafunctions.cpp | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/game/game.lua b/modules/game/game.lua index ec2e088b..ca71dee7 100644 --- a/modules/game/game.lua +++ b/modules/game/game.lua @@ -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()) diff --git a/src/otclient/core/map.cpp b/src/otclient/core/map.cpp index b3839080..dbff3918 100644 --- a/src/otclient/core/map.cpp +++ b/src/otclient/core/map.cpp @@ -306,6 +306,8 @@ std::vector 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) { diff --git a/src/otclient/core/mapview.cpp b/src/otclient/core/mapview.cpp index 41da7ba0..af3688b0 100644 --- a/src/otclient/core/mapview.cpp +++ b/src/otclient/core/mapview.cpp @@ -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= 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; diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index a1c38f92..ba26b2e1 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -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);