comment more parts of copy_graphic() and fix a logic error

This commit is contained in:
2025-05-17 18:27:41 -05:00
parent 0bc13148bf
commit a1adaa3e48
2 changed files with 5 additions and 1 deletions

View File

@@ -74,11 +74,14 @@ void cCustomGraphics::copy_graphic(pic_num_t dest, pic_num_t src, size_t numSlot
party_sheet.reset(new sf::Texture(sheet));
numSheets = 1;
}
size_t havePics = count();
// Check if a texture exists to hold the needed slots
size_t havePics = count(true);
if(havePics < dest + numSlots) {
// Count how many rows need to be in the new texture
int addRows = 1;
while(havePics + 10 * addRows < dest + numSlots)
addRows++;
// Create the new texture
sf::RenderTexture temp;
temp.create(280, party_sheet->getSize().y + 36 * addRows);
temp.clear(sf::Color::Transparent);

View File

@@ -39,6 +39,7 @@ struct cCustomGraphics {
return !bool(*this);
}
void convert_sheets();
// Copy a graphic from custom scenario graphics into custom PARTY graphics so it can go between scenarios
void copy_graphic(pic_num_t dest, pic_num_t src, size_t numSlots);
graf_pos find_graphic(pic_num_t pic, bool party = false);
size_t count(bool party = false);