mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Fix so rules not replaced when updated
This commit is contained in:
@@ -349,13 +349,15 @@ 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) { 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
|
public CardRules putCard(CardRules rules, List<Pair<String, CardRarity>> whenItWasPrinted){ // works similarly to Map<K,V>, returning prev. value
|
||||||
String cardName = rules.getName();
|
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);
|
result.reinitializeFromRules(rules);
|
||||||
return result;
|
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)
|
// 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>();
|
List<PaperCard> paperCards = new ArrayList<PaperCard>();
|
||||||
if (null == whenItWasPrinted || whenItWasPrinted.isEmpty()) {
|
if (null == whenItWasPrinted || whenItWasPrinted.isEmpty()) {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public enum CCardScript implements ICDoc {
|
|||||||
|
|
||||||
updateDirtyFlag();
|
updateDirtyFlag();
|
||||||
CardRules newRules = CardRules.fromScript(Arrays.asList(text.split("\n")));
|
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());
|
this.currentCard = Singletons.getMagicDb().getCommonCards().getCard(newRules.getName());
|
||||||
|
|
||||||
VWorkshopCatalog.SINGLETON_INSTANCE.getCardManager().repaint();
|
VWorkshopCatalog.SINGLETON_INSTANCE.getCardManager().repaint();
|
||||||
|
|||||||
Reference in New Issue
Block a user