fix(editor): resol ruta via Resource::Helper per guardar amb CWD arbitrari
This commit is contained in:
1 parent
f30bb1fb0f
commit
01145464ed
2 files changed
+15
-9
No files matched your search
@@ -32,18 +32,18 @@ geometry:
|
||||
data:
|
||||
- [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
- [ 1,230,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,231, 1]
|
||||
- [ 1,202,292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,200, 1]
|
||||
- [ 1,202, 32, 32, 2, 32, 32, 34, 34, 32, 32, 2, 32, 32, 32, 32, 34, 32, 32,200, 1]
|
||||
- [ 1,202,292,260,292,292,260,292,292,260,292,292,260,292,260,292,292,260,260,200, 1]
|
||||
- [ 1,202, 32, 32, 2, 32, 65, 34, 34, 32, 65, 2, 32, 32, 65, 32, 34, 32, 32,200, 1]
|
||||
- [ 1,202, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 34, 2, 2, 2, 32,200, 1]
|
||||
- [ 1,202, 32, 32, 32, 33, 33, 32, 32, 32, 32, 32, 2, 32, 32, 32, 34, 32, 32,200, 1]
|
||||
- [ 1,202, 32, 2, 2, 2, 32, 2, 2, 2, 2, 2, 2, 2, 32, 2, 2, 2, 32,200, 1]
|
||||
- [ 1,202, 32, 32, 33, 33, 32, 32, 32, 32, 32, 2, 32, 32, 34, 32, 32, 32, 32,200, 1]
|
||||
- [ 1,202, 65, 32, 32, 33, 33, 32, 32, 32, 32, 32, 2, 32, 32, 32, 34, 32, 65,200, 1]
|
||||
- [ 1,202, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32,200, 1]
|
||||
- [ 1,202, 32, 32, 32, 32, 33, 33, 32, 32, 32, 32, 2, 32, 32, 32, 32, 32, 32,200, 1]
|
||||
- [ 1,202, 65, 32, 33, 33, 32, 32, 32, 32, 32, 32, 32, 32, 34, 32, 32, 32, 65,200, 1]
|
||||
- [ 1,202, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32,200, 1]
|
||||
- [ 1,202, 32, 32, 32, 2, 34, 32, 32, 32, 32, 2, 32, 33, 32, 32, 34, 32, 32,200, 1]
|
||||
- [ 1,202, 65, 32, 32, 32, 33, 33, 32, 32, 32, 32, 2, 32,181, 32, 32, 32, 65,200, 1]
|
||||
- [ 1,202, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32,200, 1]
|
||||
- [ 1,202, 32, 32, 34, 34, 32, 32, 2, 32, 32, 32, 34, 33, 32, 32, 32, 32, 32,200, 1]
|
||||
- [ 1,202, 65, 32, 33, 2, 34, 32, 32, 32, 32, 32, 32, 33, 32, 32, 34, 32, 65,200, 1]
|
||||
- [ 1,202, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32, 2, 2, 2, 32,200, 1]
|
||||
- [ 1,202, 32, 32, 34, 34, 65, 32, 2, 32, 65, 32, 34, 33, 65, 32, 32, 32, 32,200, 1]
|
||||
- [ 1,262,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,263, 1]
|
||||
|
||||
# Spawns d'entitats per a aquest nivell. Es llegeixen des de
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "core/rendering/screen.hpp"
|
||||
#include "core/rendering/surface.hpp"
|
||||
#include "core/resources/resource_cache.hpp"
|
||||
#include "core/resources/resource_helper.hpp"
|
||||
#include "core/system/event_buffer.hpp"
|
||||
#include "game/map/tilemap.hpp"
|
||||
#include "utils/defaults.hpp"
|
||||
@@ -75,7 +76,12 @@ void Editor::exit(Tilemap& tilemap) {
|
||||
if (!active_) { return; }
|
||||
active_ = false;
|
||||
picker_open_ = false;
|
||||
const bool SAVED = tilemap.save(Defaults::Editor::SAVE_PATH);
|
||||
// Resolem la ruta via Resource::Helper perquè en Debug el root de
|
||||
// dades és AEE_SOURCE_DIR (ruta absoluta al repo), no el CWD. Sense
|
||||
// això, el writer obriria `data/maps/pyramid.yaml` relatiu al CWD
|
||||
// i fallaria sempre excepte si el binari es llança des del repo root.
|
||||
const auto ABS_PATH = Resource::Helper::resolve(Defaults::Editor::SAVE_PATH);
|
||||
const bool SAVED = tilemap.save(ABS_PATH);
|
||||
Notification::notify(Locale::get().text(SAVED ? "input.editor_off" : "input.editor_save_error"));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user