mirror of
https://github.com/vcmi/vcmi.git
synced 2025-10-08 23:22:25 +02:00
ui support
This commit is contained in:
@@ -153,10 +153,6 @@ void AdventureMapShortcuts::worldViewScale4x()
|
||||
|
||||
void AdventureMapShortcuts::switchMapLevel()
|
||||
{
|
||||
int maxLevels = GAME->interface()->cb->getMapSize().z;
|
||||
if (maxLevels < 2) // TODO: multilevel support
|
||||
return;
|
||||
|
||||
owner.hotkeySwitchMapLevel();
|
||||
}
|
||||
|
||||
|
@@ -116,8 +116,9 @@ void MapView::onMapLevelSwitched()
|
||||
{
|
||||
if(GAME->interface()->cb->getMapSize().z > 1)
|
||||
{
|
||||
if(model->getLevel() == 0)
|
||||
controller->setViewCenter(model->getMapViewCenter(), 1);
|
||||
int newLevel = model->getLevel() + 1;
|
||||
if(newLevel < GAME->interface()->cb->getMapSize().z)
|
||||
controller->setViewCenter(model->getMapViewCenter(), newLevel);
|
||||
else
|
||||
controller->setViewCenter(model->getMapViewCenter(), 0);
|
||||
}
|
||||
|
@@ -93,18 +93,15 @@ void PassabilityLayer::update()
|
||||
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
||||
pixmap->fill(Qt::transparent);
|
||||
|
||||
if(scene->level == 0 || map->mapLevels == 2) // TODO: multilevel support
|
||||
QPainter painter(pixmap.get());
|
||||
for(int j = 0; j < map->height; ++j)
|
||||
{
|
||||
QPainter painter(pixmap.get());
|
||||
for(int j = 0; j < map->height; ++j)
|
||||
for(int i = 0; i < map->width; ++i)
|
||||
{
|
||||
for(int i = 0; i < map->width; ++i)
|
||||
auto tl = map->getTile(int3(i, j, scene->level));
|
||||
if(tl.blocked() || tl.visitable())
|
||||
{
|
||||
auto tl = map->getTile(int3(i, j, scene->level));
|
||||
if(tl.blocked() || tl.visitable())
|
||||
{
|
||||
painter.fillRect(i * 32, j * 32, 31, 31, tl.visitable() ? QColor(200, 200, 0, 64) : QColor(255, 0, 0, 64));
|
||||
}
|
||||
painter.fillRect(i * 32, j * 32, 31, 31, tl.visitable() ? QColor(200, 200, 0, 64) : QColor(255, 0, 0, 64));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,24 +118,21 @@ void ObjectPickerLayer::highlight(std::function<bool(const CGObjectInstance *)>
|
||||
if(!map)
|
||||
return;
|
||||
|
||||
if(scene->level == 0 || map->mapLevels == 2) // TODO: multilevel support
|
||||
for(int j = 0; j < map->height; ++j)
|
||||
{
|
||||
for(int j = 0; j < map->height; ++j)
|
||||
for(int i = 0; i < map->width; ++i)
|
||||
{
|
||||
for(int i = 0; i < map->width; ++i)
|
||||
{
|
||||
auto tl = map->getTile(int3(i, j, scene->level));
|
||||
ObjectInstanceID objID = tl.topVisitableObj();
|
||||
if(!objID.hasValue() && !tl.blockingObjects.empty())
|
||||
objID = tl.blockingObjects.front();
|
||||
auto tl = map->getTile(int3(i, j, scene->level));
|
||||
ObjectInstanceID objID = tl.topVisitableObj();
|
||||
if(!objID.hasValue() && !tl.blockingObjects.empty())
|
||||
objID = tl.blockingObjects.front();
|
||||
|
||||
if (objID.hasValue())
|
||||
{
|
||||
const CGObjectInstance * obj = map->getObject(objID);
|
||||
|
||||
if(obj && predicate(obj))
|
||||
possibleObjects.insert(obj);
|
||||
}
|
||||
if (objID.hasValue())
|
||||
{
|
||||
const CGObjectInstance * obj = map->getObject(objID);
|
||||
|
||||
if(obj && predicate(obj))
|
||||
possibleObjects.insert(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user