mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 18:06:26 -07:00
[Card] Pass localized card names and texts into CardInfo construction
Address review: instead of constructing the card and then calling setLocalizedName/setLocalizedText (which emit a cardInfoChanged signal per language), both constructors, both newInstance overloads and their callers (cards.xml v4 parser and the binary cache reader) now pass the localized maps as constructor arguments.
This commit is contained in:
parent
8bb2337117
commit
c35aff8b7f
4 changed files with 44 additions and 29 deletions
|
|
@ -439,14 +439,9 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
|||
.landscapeOrientation = landscapeOrientation,
|
||||
.tableRow = tableRow,
|
||||
.upsideDownArt = upsideDown};
|
||||
CardInfoPtr newCard = CardInfo::newInstance(name, text, isToken, properties, relatedCards,
|
||||
reverseRelatedCards, _sets, attributes);
|
||||
for (auto it = localizedNames.constBegin(); it != localizedNames.constEnd(); ++it) {
|
||||
newCard->setLocalizedName(it.key(), it.value());
|
||||
}
|
||||
for (auto it = localizedTexts.constBegin(); it != localizedTexts.constEnd(); ++it) {
|
||||
newCard->setLocalizedText(it.key(), it.value());
|
||||
}
|
||||
CardInfoPtr newCard =
|
||||
CardInfo::newInstance(name, text, isToken, properties, relatedCards, reverseRelatedCards, _sets,
|
||||
attributes, std::move(localizedNames), std::move(localizedTexts));
|
||||
if (targetData) {
|
||||
// Mirror CardDatabase::addCard: if a card with this name already
|
||||
// exists, merge the new printings into it instead of replacing.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue