From 655cc6dea2042a0a49aa87de0be88ad189bf09cb Mon Sep 17 00:00:00 2001 From: James Packer Date: Tue, 17 Feb 2026 08:27:26 +0000 Subject: [PATCH] Show land object names in scenario editor. --- src/editor/GUI.cpp | 3 +++ src/editor/PositionDataStruct.hpp | 6 ++++-- src/editor/main.cpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/editor/GUI.cpp b/src/editor/GUI.cpp index 4ebba3f3d..f8f545298 100644 --- a/src/editor/GUI.cpp +++ b/src/editor/GUI.cpp @@ -521,7 +521,10 @@ void GUIMain::drawInformationOnMap(const irr::f32& time, const irr::s32& mapOffs irr::s32 relPosX = (it->X - ownShipPosX) / metresPerPx + mapOffsetX; irr::s32 relPosY = (it->Z - ownShipPosZ) / metresPerPx - mapOffsetZ; + irr::core::stringw label(it->name.c_str()); + device->getVideoDriver()->draw2DRectangle(irr::video::SColor(255, 128, 255, 128), irr::core::rect(screenCentreX - dotHalfWidth + relPosX, screenCentreY - dotHalfWidth - relPosY, screenCentreX + dotHalfWidth + relPosX, screenCentreY + dotHalfWidth - relPosY)); + guienv->getSkin()->getFont()->draw(label, irr::core::rect(screenCentreX + relPosX, screenCentreY - relPosY - 0.025 * height, screenCentreX + relPosX, screenCentreY - relPosY), irr::video::SColor(128, 0, 0, 0), true, true); } //Draw location of ships diff --git a/src/editor/PositionDataStruct.hpp b/src/editor/PositionDataStruct.hpp index 234ed5d2d..d5b2f1f3a 100644 --- a/src/editor/PositionDataStruct.hpp +++ b/src/editor/PositionDataStruct.hpp @@ -18,11 +18,13 @@ #define __POSITIONDATASTRUCT_HPP_INCLUDED__ #include "irrlicht.h" +#include -struct PositionData //To hold information about a position +struct PositionData //To hold information about a position (with optional name) { irr::f32 X, Z; - PositionData():X(0), Z(0){} + std::string name; + PositionData():X(0), Z(0), name(""){} }; #endif // __POSITIONDATASTRUCT_HPP_INCLUDED__ diff --git a/src/editor/main.cpp b/src/editor/main.cpp index a064a9b46..0bed85100 100644 --- a/src/editor/main.cpp +++ b/src/editor/main.cpp @@ -719,6 +719,7 @@ int main (int argc, char ** argv) //Get land object position thisLandObject.X = controller.longToX(IniFile::iniFileTof32(scenarioLandObjectFilename, IniFile::enumerate1("Long", currentLandObject))); thisLandObject.Z = controller.latToZ(IniFile::iniFileTof32(scenarioLandObjectFilename, IniFile::enumerate1("Lat", currentLandObject))); + thisLandObject.name = IniFile::iniFileToString(scenarioLandObjectFilename, IniFile::enumerate1("Type", currentLandObject)); landObjectsData.push_back(thisLandObject); }