git repos / saland

commit a88d12e3

Poul Sander · 2019-06-19 17:35
a88d12e38fa44f04ee2d95074856e25e9bbe30af patch · browse files
parent 74a8a2fc833b4d9c9489e52311d039b16776e943

Improved the "tiled" command. It now copies the textures before opening the map

Changed files

M src/saland/Game.cpp before
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index ab9d6bc..0b95b84 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp
@@ -507,6 +507,17 @@ void Game::Update() {
}
if (openTiled) {
openTiled = false;
+ for (const sago::tiled::TileSet& org_ts : data->gameRegion.world.tm.tileset) {
+ const sago::tiled::TileSet* ts = &org_ts;
+ while (ts->alternativeSource) {
+ ts = ts->alternativeSource;
+ }
+ std::string source_filename = ts->image.source.substr(3);
+ std::string dest_filename = std::string("worlds/")+ data->worldName + "/" + ts->image.source.substr(3);
+ std::cout << dest_filename << ":" << ts->image.source << "\n";
+ std::string imageFile = sago::GetFileContent(source_filename);
+ sago::WriteFileContent(dest_filename.c_str(), imageFile);
+ }
std::string filename = getPathToSaveFiles() + "/" + data->gameRegion.GetFilename();
std::string command = std::string("tiled \"")+filename+"\"";
std::system(command.c_str());