1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Merge pull request #4261 from kaja47/shrinkage

Reduce size of Bonus struct from 320 bytes to 296 bytes.
This commit is contained in:
Ivan Savenko
2024-07-22 17:12:08 +03:00
committed by GitHub
5 changed files with 50 additions and 42 deletions

View File

@@ -119,7 +119,7 @@ std::string Bonus::Description(std::optional<si32> customValue) const
if(descriptionHelper.empty())
{
// still no description - try to generate one based on duration
if ((duration & BonusDuration::ONE_BATTLE).any())
if ((duration & BonusDuration::ONE_BATTLE) != 0)
{
if (val > 0)
descriptionHelper.appendTextID("core.arraytxt.110"); //+%d Temporary until next battle"
@@ -248,7 +248,7 @@ DLL_LINKAGE std::ostream & operator<<(std::ostream &out, const Bonus &bonus)
#define printField(field) out << "\t" #field ": " << (int)bonus.field << "\n"
printField(val);
out << "\tSubtype: " << bonus.subtype.toString() << "\n";
printField(duration.to_ulong());
printField(duration);
printField(source);
out << "\tSource ID: " << bonus.sid.toString() << "\n";
if(bonus.additionalInfo != CAddInfo::NONE)