Tiny fix for movePixels

This commit is contained in:
Ahmed Samy 2013-12-12 02:46:20 +02:00
parent ece6507df2
commit b5c3b37b3c
2 changed files with 24 additions and 2 deletions

View File

@ -463,6 +463,7 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<Item>("getCount", &Item::getCount);
g_lua.bindClassMemberFunction<Item>("getSubType", &Item::getSubType);
g_lua.bindClassMemberFunction<Item>("getId", &Item::getId);
g_lua.bindClassMemberFunction<Item>("getServerId", &Item::getServerId);
g_lua.bindClassMemberFunction<Item>("getName", &Item::getName);
g_lua.bindClassMemberFunction<Item>("isStackable", &Item::isStackable);
g_lua.bindClassMemberFunction<Item>("isMarketable", &Item::isMarketable);

View File

@ -566,8 +566,29 @@ Position MapView::getPosition(const Point& point, const Size& mapSize)
void MapView::move(int x, int y)
{
m_moveOffset.x += x;
m_moveOffset.y += y;
if(m_moveOffset.x + x > 32) {
m_customCameraPosition.x += 1;
m_moveOffset.x = x;
requestVisibleTilesCacheUpdate();
} else if(m_moveOffset.x - x < -32) {
m_customCameraPosition.x -= 1;
m_moveOffset.x = x;
requestVisibleTilesCacheUpdate();
} else
m_moveOffset.x += x;
if(m_moveOffset.y + y > 32) {
m_customCameraPosition.y += 1;
m_moveOffset.y = y;
requestVisibleTilesCacheUpdate();
} else if(m_moveOffset.y - y < -32) {
m_customCameraPosition.y -= 1;
m_moveOffset.y = y;
requestVisibleTilesCacheUpdate();
} else
m_moveOffset.y += y;
g_logger.warning(stdext::format("move offset %d %d", m_moveOffset.x, m_moveOffset.y));
}
Rect MapView::calcFramebufferSource(const Size& destSize)