From d2d319f773f0d6e90ab703d461676eeb402bdc04 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Sat, 8 Mar 2025 01:31:49 -0700 Subject: [PATCH 1/2] Add missing include for `` to `Control.h` --- libControls/Control.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libControls/Control.h b/libControls/Control.h index c1ce1136d..0a0f47509 100644 --- a/libControls/Control.h +++ b/libControls/Control.h @@ -4,6 +4,8 @@ #include #include +#include + namespace NAS2D { From 06ba34115a0c3985da09a43db828ca15bf16f2c3 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Sat, 8 Mar 2025 01:34:34 -0700 Subject: [PATCH 2/2] Update NAS2D submodule for `stringFrom` update Updated `stringFrom` can now convert `Point` and `Vector` to strings. The `std::string` conversion operator is removed from `Point` and `Vector`. --- appOPHD/States/MapViewState.cpp | 15 ++++++++------- appOPHD/UI/Reports/MineReport.cpp | 3 ++- appOPHD/UI/TileInspector.cpp | 4 +++- nas2d-core | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/appOPHD/States/MapViewState.cpp b/appOPHD/States/MapViewState.cpp index 907dd5596..14a03cd16 100644 --- a/appOPHD/States/MapViewState.cpp +++ b/appOPHD/States/MapViewState.cpp @@ -28,6 +28,7 @@ #include +#include #include #include #include @@ -139,7 +140,7 @@ namespace { notificationArea.push({ "Aging Robot", - "Robot '" + robot->name() + "' at location " + std::string{position.xy} + " is approaching its maximum age.", + "Robot '" + robot->name() + "' at location " + NAS2D::stringFrom(position.xy) + " is approaching its maximum age.", position, NotificationArea::NotificationType::Warning}); } @@ -147,7 +148,7 @@ namespace { notificationArea.push({ "Aging Robot", - "Robot '" + robot->name() + "' at location " + std::string{position.xy} + " will fail in a few turns. Replace immediately.", + "Robot '" + robot->name() + "' at location " + NAS2D::stringFrom(position.xy) + " will fail in a few turns. Replace immediately.", position, NotificationArea::NotificationType::Critical}); } @@ -1111,7 +1112,7 @@ void MapViewState::placeRobodigger(Tile& tile) const auto position = tile.xy(); mNotificationArea.push({ "Mine destroyed", - "Digger destroyed a Mine at " + std::string{position} + ".", + "Digger destroyed a Mine at " + NAS2D::stringFrom(position) + ".", tile.xyz(), NotificationArea::NotificationType::Information}); mTileMap->removeMineLocation(position); @@ -1293,14 +1294,14 @@ void MapViewState::updateRobots() { mNotificationArea.push({ "Robot Self-Destructed", - robot->name() + " at location " + std::string{position.xy} + " self destructed.", + robot->name() + " at location " + NAS2D::stringFrom(position.xy) + " self destructed.", position, NotificationArea::NotificationType::Critical }); } else if (robot->type() != Robot::Type::Miner) { - const auto text = "Your " + robot->name() + " at location " + std::string{position.xy} + " has broken down. It will not be able to complete its task and will be removed from your inventory."; + const auto text = "Your " + robot->name() + " at location " + NAS2D::stringFrom(position.xy) + " has broken down. It will not be able to complete its task and will be removed from your inventory."; mNotificationArea.push({"Robot Broke Down", text, position, NotificationArea::NotificationType::Critical}); robot->abortTask(*tile); } @@ -1323,7 +1324,7 @@ void MapViewState::updateRobots() mNotificationArea.push({ "Robot Task Completed", - robot->name() + " completed its task at " + std::string{tile->xy()} + ".", + robot->name() + " completed its task at " + NAS2D::stringFrom(tile->xy()) + ".", tile->xyz(), NotificationArea::NotificationType::Success }); @@ -1338,7 +1339,7 @@ void MapViewState::updateRobots() mNotificationArea.push({ "Robot Task Canceled", - robot->name() + " canceled its task at " + std::string{tile->xy()} + ".", + robot->name() + " canceled its task at " + NAS2D::stringFrom(tile->xy()) + ".", tile->xyz(), NotificationArea::NotificationType::Information }); diff --git a/appOPHD/UI/Reports/MineReport.cpp b/appOPHD/UI/Reports/MineReport.cpp index fd490a670..694a4827b 100644 --- a/appOPHD/UI/Reports/MineReport.cpp +++ b/appOPHD/UI/Reports/MineReport.cpp @@ -21,6 +21,7 @@ #include +#include #include #include @@ -38,7 +39,7 @@ namespace { const auto& structureManager = NAS2D::Utility::get(); const auto& surfaceLocation = structureManager.tileFromStructure(&structure).xy(); - return structure.name() + " at " + std::string{surfaceLocation}; + return structure.name() + " at " + NAS2D::stringFrom(surfaceLocation); } } diff --git a/appOPHD/UI/TileInspector.cpp b/appOPHD/UI/TileInspector.cpp index 2b5f4dd69..e5dcec84c 100644 --- a/appOPHD/UI/TileInspector.cpp +++ b/appOPHD/UI/TileInspector.cpp @@ -8,6 +8,8 @@ #include +#include + #include #include @@ -60,7 +62,7 @@ void TileInspector::update() auto position = mRect.position + NAS2D::Vector{5, 25}; const auto tilePosition = mTile->xy(); - drawLabelAndValue(position, "Location: ", std::string{tilePosition}); + drawLabelAndValue(position, "Location: ", NAS2D::stringFrom(tilePosition)); position.y += lineSpacing; drawLabelAndValue(position, "Terrain: ", terrainTypeStringTable.at(mTile->index())); diff --git a/nas2d-core b/nas2d-core index 8a291877e..0a5d78e7b 160000 --- a/nas2d-core +++ b/nas2d-core @@ -1 +1 @@ -Subproject commit 8a291877e5e68ff39b3e0275bec2cb8ed7824d77 +Subproject commit 0a5d78e7b67d6dedf01cc0b2f94d120124eababf