Expose the shared pointer instead of the raw pointer in the resource manager and rewrite the custom sheets list to use a vector instead of manual memory management

In particular, this should fix a segmentation fault in the sound system caused by the resource manager pulling a resource that's in use.
This commit is contained in:
2020-01-26 15:10:57 -05:00
parent 2d1ee24473
commit 14e2597108
17 changed files with 142 additions and 139 deletions

View File

@@ -1089,7 +1089,7 @@ void save_scenario(bool rename) {
if(spec_scen_g.is_old) {
spec_scen_g.convert_sheets();
for(size_t i = 0; i < spec_scen_g.numSheets; i++) {
sf::Image sheet = spec_scen_g.sheets[i].copyToImage();
sf::Image sheet = spec_scen_g.sheets[i]->copyToImage();
fs::path tempPath = tempDir/"temp.png";
sheet.saveToFile(tempPath.string());
std::ostream& pic_out = scen_file.newFile("scenario/graphics/sheet" + std::to_string(i) + ".png");