mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Fix so rules not replaced when updated
This commit is contained in:
@@ -349,12 +349,14 @@ public final class CardDb implements ICardDatabase {
|
||||
public CardRules putCard(CardRules rules) { return putCard(rules, null); /* will use data from editions folder */ }
|
||||
public CardRules putCard(CardRules rules, List<Pair<String, CardRarity>> whenItWasPrinted){ // works similarly to Map<K,V>, returning prev. value
|
||||
String cardName = rules.getName();
|
||||
CardRules result = rulesByName.put(cardName, rules);
|
||||
|
||||
if(result.getName().equals(cardName)){ // change properties only
|
||||
|
||||
CardRules result = rulesByName.get(cardName);
|
||||
if (result != null && result.getName().equals(cardName)){ // change properties only
|
||||
result.reinitializeFromRules(rules);
|
||||
return result;
|
||||
}
|
||||
|
||||
result = rulesByName.put(cardName, rules);
|
||||
|
||||
// 1. generate all paper cards from edition data we have (either explicit, or found in res/editions, or add to unknown edition)
|
||||
List<PaperCard> paperCards = new ArrayList<PaperCard>();
|
||||
|
||||
@@ -121,7 +121,7 @@ public enum CCardScript implements ICDoc {
|
||||
|
||||
updateDirtyFlag();
|
||||
CardRules newRules = CardRules.fromScript(Arrays.asList(text.split("\n")));
|
||||
Singletons.getMagicDb().getCommonCards().getEditor().putCard(newRules);
|
||||
newRules = Singletons.getMagicDb().getCommonCards().getEditor().putCard(newRules);
|
||||
this.currentCard = Singletons.getMagicDb().getCommonCards().getCard(newRules.getName());
|
||||
|
||||
VWorkshopCatalog.SINGLETON_INSTANCE.getCardManager().repaint();
|
||||
|
||||
Reference in New Issue
Block a user