Fix tile query

This commit is contained in:
hodasemi 2024-08-25 12:03:07 +02:00
parent 634115aa3d
commit 223df31478

View file

@ -160,10 +160,7 @@ impl Game {
} }
let game_settings = settings.core_settings.game.clone(); let game_settings = settings.core_settings.game.clone();
let lua_scripts = settings.core_settings.lua_scripts.clone(); let lua_scripts = settings.core_settings.lua_scripts.clone();
let tile_directory = settings.core_settings.engine.tile_directory.full_path();
let map_info = settings.core_settings.map_info(); let map_info = settings.core_settings.map_info();
#[allow(unused_mut)] #[allow(unused_mut)]
@ -230,8 +227,22 @@ impl Game {
} }
} }
let game = {
engine_create_info.gui_info.resource_directory = {
let mut path = AssetPath::from(settings.data_path.as_str());
path.assume_prefix_free();
path
};
engine_create_info.resource_base_path = settings.data_path.clone();
let engine = Engine::new(engine_create_info.clone())?;
// ----------------- tiles -------------------- // ----------------- tiles --------------------
let tile_vector = search_dir_recursively(&tile_directory, ".png")?; let tile_vector = search_dir_recursively(
engine.settings().tiles_directory().full_path().as_str(),
".png",
)?;
let mut tile_map = HashMap::new(); let mut tile_map = HashMap::new();
for file in &tile_vector { for file in &tile_vector {
@ -247,17 +258,6 @@ impl Game {
} }
} }
let game = {
engine_create_info.gui_info.resource_directory = {
let mut path = AssetPath::from(settings.data_path.as_str());
path.assume_prefix_free();
path
};
engine_create_info.resource_base_path = settings.data_path.clone();
let engine = Engine::new(engine_create_info.clone())?;
let item_system = Promise::new({ let item_system = Promise::new({
let engine = engine.clone(); let engine = engine.clone();
let item_settings = item_settings.clone(); let item_settings = item_settings.clone();