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