mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
add ImageLocator::toString
This commit is contained in:
parent
2d08e18f6a
commit
66a2c8dc37
@ -90,3 +90,37 @@ ImageLocator ImageLocator::copyFileTransformScale() const
|
|||||||
{
|
{
|
||||||
return *this; // full copy
|
return *this; // full copy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ImageLocator::toString() const
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
if (empty())
|
||||||
|
return "invalid";
|
||||||
|
|
||||||
|
if (image)
|
||||||
|
result += image->getOriginalName();
|
||||||
|
|
||||||
|
if (defFile)
|
||||||
|
{
|
||||||
|
result += defFile->getOriginalName();
|
||||||
|
result += "-" + std::to_string(defGroup);
|
||||||
|
result += "-" + std::to_string(defFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verticalFlip)
|
||||||
|
result += "-vflip";
|
||||||
|
|
||||||
|
if (horizontalFlip)
|
||||||
|
result += "-hflip";
|
||||||
|
|
||||||
|
if (scalingFactor > 1)
|
||||||
|
result += "-scale" + std::to_string(scalingFactor);
|
||||||
|
|
||||||
|
if (playerColored.isValidPlayer())
|
||||||
|
result += "-player" + playerColored.toString();
|
||||||
|
|
||||||
|
if (layer != EImageLayer::ALL)
|
||||||
|
result =+ "-layer" + std::to_string(static_cast<int>(layer));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -46,4 +46,9 @@ struct ImageLocator
|
|||||||
ImageLocator copyFile() const;
|
ImageLocator copyFile() const;
|
||||||
ImageLocator copyFileTransform() const;
|
ImageLocator copyFileTransform() const;
|
||||||
ImageLocator copyFileTransformScale() const;
|
ImageLocator copyFileTransformScale() const;
|
||||||
|
|
||||||
|
// generates string representation of this image locator
|
||||||
|
// guaranteed to be a valid file path with no extension
|
||||||
|
// but may contain '/' if source file is in directory
|
||||||
|
std::string toString() const;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user