getAnyPlant: use Maps::getPlantAtTile

Followup to #1882
develop
lethosor 2021-06-25 01:08:58 -04:00
parent 64f0efd7b2
commit 96dd249be0
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 2 additions and 8 deletions

@ -61,7 +61,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## API ## API
- Added ``dfhack.units.teleport(unit, pos)`` - Added ``dfhack.units.teleport(unit, pos)``
- Added ``dfhack.maps.getPlantAtTile(x, y, z)`` and ``dfhack.maps.getPlantAtTile(pos)`` - Added ``dfhack.maps.getPlantAtTile(x, y, z)`` and ``dfhack.maps.getPlantAtTile(pos)``, and updated ``dfhack.gui.getSelectedPlant()`` to use it
## Documentation ## Documentation
- Added more client library implementations to the `remote interface docs <remote-client-libs>` - Added more client library implementations to the `remote interface docs <remote-client-libs>`

@ -1325,13 +1325,7 @@ df::plant *Gui::getAnyPlant(df::viewscreen *top)
if (ui->main.mode == ui_sidebar_mode::LookAround) if (ui->main.mode == ui_sidebar_mode::LookAround)
{ {
for (df::plant *plant : world->plants.all) return Maps::getPlantAtTile(cursor->x, cursor->y, cursor->z);
{
if (plant->pos.x == cursor->x && plant->pos.y == cursor->y && plant->pos.z == cursor->z)
{
return plant;
}
}
} }
} }