From e089effea43951fd8d97a9b0d0bc658ef0bf3b4d Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 17 May 2025 19:52:32 -0500 Subject: [PATCH] fancy file previews don't load custom graphics (for now) --- src/fileio/fileio_party.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/fileio/fileio_party.cpp b/src/fileio/fileio_party.cpp index d946ad05..f22a83fd 100644 --- a/src/fileio/fileio_party.cpp +++ b/src/fileio/fileio_party.cpp @@ -363,16 +363,20 @@ bool load_party_v2(fs::path file_to_load, cUniverse& real_univ, cCustomGraphics& } } - if(partyIn.hasFile("save/export.png")) { - std::istream& fin = partyIn.getFile("save/export.png"); - sf::Image party_sheet; - StdInputStream stream(fin); - if(party_sheet.loadFromStream(stream)) { - sf::Texture sheet; - sheet.create(party_sheet.getSize().x, party_sheet.getSize().y); - sheet.update(party_sheet); - spec_scen_g.party_sheet.reset(new sf::Texture(sheet)); - } else if(!preview) showWarning("There was an error loading the party custom graphics."); + // Note: if we make custom graphics allowed on PCs, the file picker preview will have to load each party's + // export.png and we will need to pass the cCustomGraphics object on the cPict + if(!preview){ + if(partyIn.hasFile("save/export.png")) { + std::istream& fin = partyIn.getFile("save/export.png"); + sf::Image party_sheet; + StdInputStream stream(fin); + if(party_sheet.loadFromStream(stream)) { + sf::Texture sheet; + sheet.create(party_sheet.getSize().x, party_sheet.getSize().y); + sheet.update(party_sheet); + graphics.party_sheet.reset(new sf::Texture(sheet)); + } else if(!preview) showWarning("There was an error loading the party custom graphics."); + } } if(!univ.party.scen_name.empty()) {