Skip to content
Permalink
Browse files

Fix editor save generating unusable levels without sprites.

The argument inversion mistake causing the problem was introduced with
the removal of the package manager. fs::relative() takes the arguments
the other way round than fs_relative(). fs_relative() should be
removed to reduce this confusion...
  • Loading branch information
Quintus committed Aug 7, 2019
1 parent e93813a commit a481165eef417411bf5c01ca18605315f803f04e
Showing with 5 additions and 5 deletions.
  1. +1 −1 tsc/src/level/level.cpp
  2. +1 −1 tsc/src/level/level_background.cpp
  3. +2 −2 tsc/src/objects/sprite.cpp
  4. +1 −1 tsc/src/video/animation.cpp
@@ -959,7 +959,7 @@ bool cLevel::Joy_Button_Up(unsigned int button)

fs::path cLevel::Get_Music_Filename() const
{
return fs::relative(pResource_Manager->Get_Game_Music_Directory(), m_musicfile);
return fs::relative(m_musicfile, pResource_Manager->Get_Game_Music_Directory());
}

void cLevel::Set_Music(fs::path filename)
@@ -205,7 +205,7 @@ void cBackground::Set_Image(const fs::path& img_file_1)

// Make the path relative to pixmaps/ if it isn’t yet
if (m_image_1_filename.is_absolute())
m_image_1_filename = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_image_1_filename);
m_image_1_filename = fs::relative(m_image_1_filename, pResource_Manager->Get_Game_Pixmaps_Directory());

Clear_Images();
Add_Image_Set("main", m_image_1_filename);
@@ -516,7 +516,7 @@ xmlpp::Element* cSprite::Save_To_XML_Node(xmlpp::Element* p_element)
// Only save the relative part of the filename -- otherwise the
// generated levels wouldn’t be portable.
if (img_filename.is_absolute())
img_filename = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), img_filename);
img_filename = fs::relative(img_filename, pResource_Manager->Get_Game_Pixmaps_Directory());

Add_Property(p_node, "image", img_filename.generic_string());

@@ -1453,7 +1453,7 @@ void cSprite::Editor_Activate(void)

p_editor->Add_Config_Widget(UTF8_("Image"), UTF8_("Image filename"), editbox);

fs::path rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_start_image->Get_Path());
fs::path rel = fs::relative(m_start_image->Get_Path(), pResource_Manager->Get_Game_Pixmaps_Directory());
editbox->setText(path_to_utf8(rel));
editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cSprite::Editor_Image_Text_Changed, this));

@@ -1157,7 +1157,7 @@ void cParticle_Emitter::Set_Image_Filename(const fs::path& filename)
// remember the filename for saving
m_image_filename = filename;
if (filename.is_absolute())
m_image_filename = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), filename);
m_image_filename = fs::relative(filename, pResource_Manager->Get_Game_Pixmaps_Directory());

// set new image
Set_Image(pVideo->Get_Surface(m_image_filename, 0));

0 comments on commit a481165

Please sign in to comment.
You can’t perform that action at this time.