Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ImguiMapEditor/Brushes/BrushRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class BrushRegistry {
void registerBorderTemplate(uint32_t id, BorderBlock border);
const BorderBlock *getBorderTemplate(uint32_t id) const;
const BorderItemMetadata *getBorderItemMetadata(uint16_t itemId) const;
size_t getBorderTemplateCount() const { return border_templates_.size(); }

/**
* Clear all brushes from the registry.
Expand Down
18 changes: 13 additions & 5 deletions ImguiMapEditor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/ext/stb
${Stb_INCLUDE_DIR}
)
)

add_executable(BrushSmoke
${BRUSH_SMOKE_SOURCES}
Expand Down Expand Up @@ -537,10 +536,6 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/clients_templates.json"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/data/clients_templates.json"
# Copy entire sample_data directory tree (includes tilesets/, creatures/, items/, etc.)
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/sample_data"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/data"
# Copy shaders
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/shaders"
Expand All @@ -552,6 +547,19 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMENT "Copying data files..."
)

# Copy version-specific data directory (guarded — only if it exists)
set(TME_DATA_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/../data")
if(EXISTS "${TME_DATA_SOURCE}")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${TME_DATA_SOURCE}"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/data"
COMMENT "Copying version data folders..."
)
else()
message(WARNING "Data directory not found at ${TME_DATA_SOURCE} — version-specific data will not be copied to build output")
endif()

# Installation
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
Expand Down
34 changes: 23 additions & 11 deletions ImguiMapEditor/Domain/ClientVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,33 @@ ClientVersion::ClientVersion(uint32_t index, uint32_t version, const std::string
}

std::filesystem::path ClientVersion::getItemMetadataPath() const {
// 1. User-provided path from preferences (explicit override)
if (!custom_items_db_path_.empty()) {
return custom_items_db_path_;
}
if (client_path_.empty()) {
return {};
}
switch (data_source_) {
case ItemDataSource::SRV:
return client_path_ / "items.srv";
case ItemDataSource::OTB:
return client_path_ / "items.otb";
case ItemDataSource::DAT:
default:
return {};

// 2. Default: data/[dataDirectory]/items.otb (or items.srv)
auto data_dir = resolveDataPath();
if (!data_dir.empty()) {
switch (data_source_) {
case ItemDataSource::SRV: {
auto srv = data_dir / "items.srv";
if (std::filesystem::exists(srv)) return srv;
break;
}
case ItemDataSource::OTB: {
auto otb = data_dir / "items.otb";
if (std::filesystem::exists(otb)) return otb;
break;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Good change. Removing the fallback to client_path_ for items.otb ensures that only the intended editor-specific metadata is used, preventing potential issues with incompatible OTB files found in client directories.

case ItemDataSource::DAT:
default:
break;
}
}

// 3. No fallback — client_path_ is not used for items.otb
return {};
Comment on lines +40 to +41

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve metadata filename on unresolved lookup.

Returning an empty path here drops filename context needed by downstream fallback code (e.g., checks that build .../data/<filename> from metadata_path.filename()). This can mask missing metadata and weaken validation behavior.

Suggested fix
-    // 3. No fallback — client_path_ is not used for items.otb
-    return {};
+    // 3. Preserve filename fallback for downstream resolution (./data/<filename>)
+    switch (data_source_) {
+    case ItemDataSource::SRV:
+        return std::filesystem::path("items.srv");
+    case ItemDataSource::OTB:
+        return std::filesystem::path("items.otb");
+    case ItemDataSource::DAT:
+    default:
+        return {};
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ImguiMapEditor/Domain/ClientVersion.cpp` around lines 48 - 49, The current
unresolved-lookup return of {} drops the metadata filename needed by downstream
fallback, so instead of returning an empty path in the failure branch, return a
path constructed from metadata_path.filename() (e.g.,
std::filesystem::path{metadata_path.filename()} or equivalent) so client_path_
filename context is preserved; update the return site in ClientVersion.cpp (the
branch that currently does "return {}") to return that filename-only path while
leaving parent components empty so downstream code can build
".../data/<filename>" properly.

}

bool ClientVersion::hasValidPaths() const {
Expand Down
39 changes: 38 additions & 1 deletion ImguiMapEditor/Domain/ClientVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,45 @@ class ClientVersion {
void setDefault(bool is_default) { is_default_ = is_default; }

// Data directory and description
// setDataDirectory normalizes paths like "data/1098" or absolute paths ending
// in "/data/<version>" to just the final segment (e.g., "1098").
// autoDetectDataDirectory() and MapLoadingService both depend on
// std::filesystem::current_path() to resolve data/[version]/ at runtime.
const std::string &getDataDirectory() const { return data_directory_; }
void setDataDirectory(const std::string &dir) { data_directory_ = dir; }
void setDataDirectory(const std::string &dir) {
// Normalize: reduce .../data/<version> to just <version>
std::filesystem::path p(dir);
if (p.has_parent_path() && p.parent_path().filename() == "data") {
data_directory_ = p.filename().string();
} else {
data_directory_ = dir;
}
}
Comment on lines +120 to +128

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check how setDataDirectory is called to understand expected input patterns

rg -nP 'setDataDirectory\(' -A2 -B2

Repository: Open-Tibia-Tools/tibia-imgui-map-editor

Length of output: 4373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the relevant implementation area in ClientVersion.h
echo "---- ClientVersion.h (around setDataDirectory) ----"
sed -n '90,170p' ImguiMapEditor/Domain/ClientVersion.h

# Find all mentions of autoDetectDataDirectory
echo "---- autoDetectDataDirectory references ----"
rg -n "autoDetectDataDirectory" ImguiMapEditor/Domain/ClientVersion.h ImguiMapEditor -S --hidden

# Show where getDataDirectory / dataDirectory property is used (brief)
echo "---- getDataDirectory usages ----"
rg -n "getDataDirectory\(" ImguiMapEditor -S --hidden

echo "---- dataDirectory property persistence ----"
sed -n '1,220p' ImguiMapEditor/Services/ClientVersionPersistence.cpp

Repository: Open-Tibia-Tools/tibia-imgui-map-editor

Length of output: 12395


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the UI/editor code that feeds into setDataDirectory(...)
echo "---- ClientPropertyEditor.cpp (setDataDirectory call sites) ----"
sed -n '200,520p' ImguiMapEditor/UI/Dialogs/ClientConfiguration/ClientPropertyEditor.cpp

# Find where eb.dataDir is declared/filled (best-effort search)
echo "---- Search for 'dataDir' in ClientPropertyEditor.cpp ----"
rg -n "dataDir" ImguiMapEditor/UI/Dialogs/ClientConfiguration/ClientPropertyEditor.cpp

# Inspect UI controller where data_dir_buf_ is set from cv.getDataDirectory()
echo "---- ClientConfigurationController.cpp (data_dir_buf_ usage) ----"
sed -n '300,430p' ImguiMapEditor/Presentation/Dialogs/ClientConfigurationController.cpp

# Inspect StartupController client_info.data_directory usage
echo "---- StartupController.cpp (client_info.data_directory) ----"
sed -n '260,470p' ImguiMapEditor/Controllers/StartupController.cpp

# Inspect MapLoadingService usage to understand expected format
echo "---- MapLoadingService.cpp (data_dir_for_resources/data_dir) ----"
sed -n '520,680p' ImguiMapEditor/Services/Map/MapLoadingService.cpp

Repository: Open-Tibia-Tools/tibia-imgui-map-editor

Length of output: 37469


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,120p' ImguiMapEditor/Services/ClientVersionRegistry.cpp

Repository: Open-Tibia-Tools/tibia-imgui-map-editor

Length of output: 3729


Fix setDataDirectory comment to match its actual normalization behavior

ImguiMapEditor/Domain/ClientVersion.h (setDataDirectory, ~116-124) strips to the last path segment whenever the immediate parent directory is literally named data—so it’s not “prefix-only” (it also handles absolute selections like .../data/<version>), which aligns with how the UI/help text feeds the value and how MapLoadingService expects dataDirectory (folder name like "<version>"). Update the inline comment to describe this .../data/<version> behavior; the proposed “prefix-only” restriction would break valid absolute-folder inputs.

Also, autoDetectDataDirectory() depends on std::filesystem::current_path() for locating data/<version>, so detection (and similarly MapLoadingService loading) will be sensitive to the app’s working directory.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ImguiMapEditor/Domain/ClientVersion.h` around lines 116 - 124, Update the
inline comment for setDataDirectory in ClientVersion.h to accurately describe
its normalization: it reduces paths of the form .../data/<version> (including
absolute paths) to just the final segment (assigning data_directory_), not only
stripping a literal leading "data/" prefix; mention that
autoDetectDataDirectory() uses std::filesystem::current_path() so detection and
MapLoadingService loading depend on the process working directory. Reference
setDataDirectory, autoDetectDataDirectory, data_directory_, and
MapLoadingService in the comment to make the behavior and dependency clear.


// Resolve the version-specific data directory to an absolute path.
// Returns empty path if data_directory_ is not set or doesn't exist.
// Handles both "1098" and "data/1098" formats.
std::filesystem::path resolveDataPath() const {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Relying on std::filesystem::current_path() for data folder resolution can be brittle if the application is launched from a different directory. It is generally safer to use the executable's directory or a configured base path.

if (data_directory_.empty()) return {};
auto candidate = std::filesystem::current_path() / "data" / data_directory_;
if (std::filesystem::exists(candidate)) return candidate;
// Try stripping "data/" prefix if present
std::filesystem::path dir_path(data_directory_);
if (dir_path.has_parent_path() && dir_path.parent_path().filename() == "data") {
auto stripped = std::filesystem::current_path() / "data" / dir_path.filename();
if (std::filesystem::exists(stripped)) return stripped;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 While this check handles the case where data_directory_ was manually set to a path containing "data/", the setDataDirectory() method already performs this normalization. It might be cleaner to ensure data_directory_ is always normalized upon assignment to avoid redundant checks during path resolution.

}
return {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 This secondary stripping logic seems redundant since setDataDirectory() already handles this normalization. Ensuring data_directory_ is always normalized upon assignment would allow simplifying this method to just checking the current_path() / "data" / data_directory_ candidate.

}

// Auto-detect data directory: checks if data/[version]/ exists
void autoDetectDataDirectory() {
auto candidate = std::filesystem::current_path() / "data" / std::to_string(version_);
if (std::filesystem::exists(candidate)) {
data_directory_ = std::to_string(version_);
}
}
Comment on lines +147 to +152

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

std::filesystem::current_path() is unreliable for directory detection.

current_path() depends on the process's working directory at launch, which varies by how the executable is invoked (CLI, double-click, debugger, etc.). If launched from a different directory, auto-detection will fail silently or detect the wrong path.

🔧 Use executable-relative or application base path instead
 void autoDetectDataDirectory() {
-  auto candidate = std::filesystem::current_path() / "data" / std::to_string(version_);
+  // Assuming a getApplicationBasePath() or similar exists that returns executable directory
+  auto candidate = getApplicationBasePath() / "data" / std::to_string(version_);
   if (std::filesystem::exists(candidate)) {
     data_directory_ = std::to_string(version_);
   }
 }

Alternatively, if the application already stores a base path elsewhere (e.g., in a configuration service), pass it as a parameter rather than relying on current_path().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ImguiMapEditor/Domain/ClientVersion.h` around lines 127 - 132,
autoDetectDataDirectory currently uses std::filesystem::current_path() which is
unreliable; change it to resolve a stable base path (either accept a base_path
parameter or compute the executable directory) before appending
"data"/std::to_string(version_). Specifically update the autoDetectDataDirectory
function (and callers) to take a std::filesystem::path base_path or use a
platform-safe method to get the executable path (e.g., read the running binary
path via platform APIs /proc/self/exe on Linux or GetModuleFileName on Windows)
then test std::filesystem::exists(base_path / "data" / std::to_string(version_))
and set data_directory_ accordingly instead of using current_path(); reference
the symbols autoDetectDataDirectory, data_directory_, and version_ when making
the change.


const std::string &getDescription() const { return description_; }
void setDescription(const std::string &desc) { description_ = desc; }

Expand Down
1 change: 0 additions & 1 deletion ImguiMapEditor/Domain/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Tile::~Tile() = default;
void Tile::setOpaqueData(std::unique_ptr<IO::InvalidZoneState> data) {
opaque_data_ = std::move(data);
}
}

void Tile::setGround(std::unique_ptr<Item> item) {
ground_ = std::move(item);
Expand Down
6 changes: 6 additions & 0 deletions ImguiMapEditor/Presentation/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
#include "UI/Dialogs/Properties/SpawnPropertiesDialog.h"
#include "UI/Map/MapContextMenu.h"
#include "UI/Map/MapPanel.h"
#include "UI/Panels/NewMapPanel.h"
#include "UI/Windows/IngameBoxWindow.h"
#include <functional>
#include <memory>
#include <optional>
#include <filesystem>

namespace MapEditor::Rendering {
class MapRenderer;
Expand Down Expand Up @@ -153,6 +155,10 @@ class MainWindow {
UI::ItemPropertiesDialog properties_dialog_;
UI::SpawnPropertiesDialog spawn_properties_dialog_;
UI::CreaturePropertiesDialog creature_properties_dialog_;

// Editor-state modal dialog callbacks
std::function<void(const UI::NewMapPanel::State&)> new_map_callback_;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 These callbacks are added to support the new modal dialogs, but the corresponding methods showNewMapDialog() and showOpenSecDialog() are declared in the header without definitions in MainWindow.cpp. This will lead to linker errors.

Additionally, MainWindow lacks a NewMapDialog member and the necessary render() call in renderEditor(), which are required for these dialogs to function.

std::function<void(const std::filesystem::path&, uint32_t)> open_sec_callback_;
};

} // namespace Presentation
Expand Down
12 changes: 12 additions & 0 deletions ImguiMapEditor/Services/ClientVersionRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ bool ClientVersionRegistry::loadDefaults(const ConfigService &config) {
setNextIndex(versions_.rbegin()->first);
}
spdlog::info("Loaded {} saved clients from: {}", versions_.size(), path.string());

// Auto-detect data directories for versions without one set
for (auto &[index, cv] : versions_) {
if (cv.getDataDirectory().empty()) {
cv.autoDetectDataDirectory();
if (!cv.getDataDirectory().empty()) {
spdlog::info("Auto-detected data directory for '{}': {}",
cv.getName(), cv.getDataDirectory());
}
}
}

return true;
}
}
Expand Down
75 changes: 52 additions & 23 deletions ImguiMapEditor/Services/Map/MapLoadingService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Services {

MapLoadingService::MapLoadingService(ClientVersionRegistry &version_registry,
ViewSettings &view_settings,
Brushes::BrushRegistry &brush_registry,
::MapEditor::Brushes::BrushRegistry &brush_registry,
TilesetService &tileset_service,
const OtbmSettings &otbm_settings)
: version_registry_(version_registry), view_settings_(view_settings),
Expand Down Expand Up @@ -567,11 +567,14 @@ bool MapLoadingService::loadClientData(
? pending_path
: pending_path.parent_path();

if (!tryLoadCreatures(map_dir, client_path)) {
// Resolve version data path once — used for creatures, items, tilesets, palettes
const std::filesystem::path version_data_path = version_info->resolveDataPath();

if (!tryLoadCreatures(map_dir, client_path, version_data_path)) {
spdlog::warn("No creature data loaded. Spawns may look incorrect.");
}

if (!tryLoadItems(map_dir, client_path)) {
if (!tryLoadItems(map_dir, client_path, version_data_path)) {
spdlog::warn("No items.xml loaded. Item names may be missing.");
}

Expand All @@ -595,21 +598,23 @@ bool MapLoadingService::loadClientData(
}
}

// Use injected TilesetService instead of creating locally
// Always use the application's data folder for tilesets and palettes,
// NOT the map directory - these are app resources, not per-map resources
std::filesystem::path app_data_path =
std::filesystem::current_path() / "data";

bool tilesets_loaded = tileset_service_.loadMaterials(app_data_path);
if (!tilesets_loaded) {
spdlog::warn("materials.xml could not be loaded. Falling back to direct tileset/palette loading.");
tilesets_loaded = tileset_service_.loadTilesets(app_data_path);
// Load tilesets, palettes, brushes from version data directory

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Using version_data_path here correctly points the editor to the version-specific assets, which is a major improvement for multi-version support.

if (version_data_path.empty()) {
spdlog::warn("Data directory '{}' not found. Skipping materials/tilesets/palettes loading.",
version_info->getDataDirectory());
} else {
spdlog::info("Loading materials from: {}", version_data_path.string());
bool tilesets_loaded = tileset_service_.loadMaterials(version_data_path);
if (!tilesets_loaded) {
spdlog::warn("No tilesets found. The palette will be empty.");
}
if (!tileset_service_.loadPalettes(app_data_path)) {
spdlog::warn("No palettes loaded. Ribbon palette buttons will be empty.");
spdlog::warn("materials.xml not found in '{}'. Falling back to direct loading.",
version_data_path.string());
tilesets_loaded = tileset_service_.loadTilesets(version_data_path);
if (!tilesets_loaded) {
spdlog::warn("No tilesets found in '{}'.", version_data_path.string());
}
if (!tileset_service_.loadPalettes(version_data_path)) {
spdlog::warn("No palettes found in '{}'.", version_data_path.string());
}
}
}

Expand Down Expand Up @@ -676,29 +681,53 @@ Domain::Position MapLoadingService::findCameraCenter() const {

bool MapLoadingService::tryLoadCreatures(
const std::filesystem::path &map_dir,
const std::filesystem::path &client_path) {
const std::filesystem::path &client_path,
const std::filesystem::path &version_data_path) {
const auto load = [this](const std::filesystem::path &path) {
return client_data_service_->loadCreatureData(path);
};

if (tryLoadResource("creatures.xml", map_dir, client_path, load)) {
return true;
}
return tryLoadResource(std::filesystem::path("creatures") / "creatures.xml",
map_dir, client_path, load);
if (tryLoadResource(std::filesystem::path("creatures") / "creatures.xml",
map_dir, client_path, load)) {
return true;
}
// Try version-specific data folder
if (!version_data_path.empty()) {
auto version_file = version_data_path / "creatures" / "creatures.xml";
if (std::filesystem::exists(version_file) && load(version_file)) {
spdlog::info("Loaded creatures.xml from version data folder");
return true;
}
}
return false;
}

bool MapLoadingService::tryLoadItems(const std::filesystem::path &map_dir,
const std::filesystem::path &client_path) {
const std::filesystem::path &client_path,
const std::filesystem::path &version_data_path) {
const auto load = [this](const std::filesystem::path &path) {
return client_data_service_->loadItemData(path);
};

if (tryLoadResource("items.xml", map_dir, client_path, load)) {
return true;
}
return tryLoadResource(std::filesystem::path("items") / "items.xml", map_dir,
client_path, load);
if (tryLoadResource(std::filesystem::path("items") / "items.xml", map_dir,
client_path, load)) {
return true;
}
// Try version-specific data folder
if (!version_data_path.empty()) {
auto version_file = version_data_path / "items" / "items.xml";
if (std::filesystem::exists(version_file) && load(version_file)) {
spdlog::info("Loaded items.xml from version data folder");
return true;
}
}
return false;
}

void MapLoadingService::loadWaypoints(const std::filesystem::path &otbm_path,
Expand Down
6 changes: 4 additions & 2 deletions ImguiMapEditor/Services/Map/MapLoadingService.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@ class MapLoadingService {
Services::ClientDataService &client_data);

bool tryLoadCreatures(const std::filesystem::path &map_dir,
const std::filesystem::path &client_path);
const std::filesystem::path &client_path,
const std::filesystem::path &version_data_path);
bool tryLoadItems(const std::filesystem::path &map_dir,
const std::filesystem::path &client_path);
const std::filesystem::path &client_path,
const std::filesystem::path &version_data_path);

void loadWaypoints(const std::filesystem::path &otbm_path,
Domain::ChunkedMap &map);
Expand Down
1 change: 1 addition & 0 deletions ImguiMapEditor/UI/Dialogs/EditTownsDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "EditTownsDialog.h"
#include "../../Utils/StringCopy.h"
#include "Application/MapTabManager.h"
#include "Application/EditorSession.h"
#include "Domain/MapInstance.h"
Expand Down
21 changes: 0 additions & 21 deletions ImguiMapEditor/UI/Dialogs/Properties/MapPropertiesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,6 @@ MapPropertiesDialog::Result MapPropertiesDialog::render() {
return result;
}

void MapPropertiesDialog::loadFromMap() {
if (!map_)
return;

// Description
::MapEditor::Utils::copyTruncate(description_buffer_, map_->getDescription());

// Dimensions
width_ = map_->getWidth();
height_ = map_->getHeight();

// Version info
const auto &version = map_->getVersion();
otbm_version_ = version.otbm_version;
client_version_ = version.client_version;

// External files
::MapEditor::Utils::copyTruncate(house_filename_, map_->getHouseFile());

::MapEditor::Utils::copyTruncate(spawn_filename_, map_->getSpawnFile());
}

void MapPropertiesDialog::applyToMap() {
if (!map_)
Expand Down
1 change: 1 addition & 0 deletions ImguiMapEditor/UI/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Prevent GLFW from including OpenGL headers (glad provides them)
#define GLFW_INCLUDE_NONE
#include "PreferencesDialog.h"
#include "../Utils/StringCopy.h"
#include "UI/Core/Theme.h"
#include "../ext/imhotkey/imHotKey.h"
#include "IO/HotkeyJsonReader.h"
Expand Down
Loading
Loading