diff --git a/docs/changelog.txt b/docs/changelog.txt index 8327fbc83..2ffee11d1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -61,7 +61,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## API - 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 - Added more client library implementations to the `remote interface docs ` diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 04225e111..6db89df64 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -1325,13 +1325,7 @@ df::plant *Gui::getAnyPlant(df::viewscreen *top) if (ui->main.mode == ui_sidebar_mode::LookAround) { - for (df::plant *plant : world->plants.all) - { - if (plant->pos.x == cursor->x && plant->pos.y == cursor->y && plant->pos.z == cursor->z) - { - return plant; - } - } + return Maps::getPlantAtTile(cursor->x, cursor->y, cursor->z); } }