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 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();
#[allow(unused_mut)]
@ -230,23 +227,6 @@ impl Game {
}
}
// ----------------- tiles --------------------
let tile_vector = search_dir_recursively(&tile_directory, ".png")?;
let mut tile_map = HashMap::new();
for file in &tile_vector {
let s = file.full_path();
let path = Path::new(s.as_str());
if let Some(name) = path.file_stem() {
if let Some(name_str) = name.to_str() {
let string = name_str.to_string();
tile_map.insert(string.clone(), file.clone());
}
}
}
let game = {
engine_create_info.gui_info.resource_directory = {
let mut path = AssetPath::from(settings.data_path.as_str());
@ -258,6 +238,26 @@ impl Game {
let engine = Engine::new(engine_create_info.clone())?;
// ----------------- tiles --------------------
let tile_vector = search_dir_recursively(
engine.settings().tiles_directory().full_path().as_str(),
".png",
)?;
let mut tile_map = HashMap::new();
for file in &tile_vector {
let s = file.full_path();
let path = Path::new(s.as_str());
if let Some(name) = path.file_stem() {
if let Some(name_str) = name.to_str() {
let string = name_str.to_string();
tile_map.insert(string.clone(), file.clone());
}
}
}
let item_system = Promise::new({
let engine = engine.clone();
let item_settings = item_settings.clone();