mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 01:25:10 -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
|
|
@ -301,9 +301,6 @@ CardInfoPtr readCard(QDataStream &in, const SetNameMap &sets)
|
|||
reverse.append(readRelation(in));
|
||||
}
|
||||
|
||||
CardInfoPtr card = CardInfo::newInstance(name, text, isToken, propertiesBlob, related, reverse, cardSets, ui,
|
||||
simpleName, altNames, false);
|
||||
|
||||
const QMap<QString, QString> localizedNames = readStringMap(in);
|
||||
if (in.status() != QDataStream::Ok) {
|
||||
return nullptr;
|
||||
|
|
@ -312,12 +309,9 @@ CardInfoPtr readCard(QDataStream &in, const SetNameMap &sets)
|
|||
if (in.status() != QDataStream::Ok) {
|
||||
return nullptr;
|
||||
}
|
||||
for (auto it = localizedNames.constBegin(); it != localizedNames.constEnd(); ++it) {
|
||||
card->setLocalizedName(it.key(), it.value());
|
||||
}
|
||||
for (auto it = localizedTexts.constBegin(); it != localizedTexts.constEnd(); ++it) {
|
||||
card->setLocalizedText(it.key(), it.value());
|
||||
}
|
||||
|
||||
CardInfoPtr card = CardInfo::newInstance(name, text, isToken, propertiesBlob, related, reverse, cardSets, ui,
|
||||
simpleName, altNames, false, localizedNames, localizedTexts);
|
||||
|
||||
return card;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue