Changeset 27135
- Timestamp:
- Oct 8, 2022, 2:46:11 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/gamesettings/attributes/VictoryConditions.js
r26933 r27135 18 18 this.conditions[cond.Name] = cond; 19 19 20 20 21 for (let cond in this.conditions) 21 22 if (this.conditions[cond].Default) 22 this._add(this.conditions[cond].Name); 23 defaults.push(this.conditions[cond].Name); 24 this._add(this.active, this.disabled, defaults); 23 25 } 24 26 … … 51 53 return; 52 54 53 this.disabled = new Set(); 54 this.active = new Set(); 55 // TODO: could be optimised. 56 for (const cond of conditionList) 57 this._add(cond); 55 this._add(new Set(), new Set(), conditionList); 58 56 } 59 57 … … 68 66 } 69 67 70 _add( name)68 _add() 71 69 { 72 if (this.disabled.has(name)) 73 return; 74 let active = clone(this.active); 75 active.add(name); 76 // Assume we want to remove incompatible ones. 77 if (this.conditions[name].DisabledWhenChecked) 78 this.conditions[name].DisabledWhenChecked.forEach(x => active.delete(x)); 70 let active = clone(currentActive); 71 for (const name of names) { 72 if (currentDisabled.has(name)) 73 continue; 74 active.add(name); 75 // Assume we want to remove incompatible ones. 76 if (this.conditions[name].DisabledWhenChecked) 77 this.conditions[name].DisabledWhenChecked.forEach(x => active.delete(x)); 78 } 79 79 // TODO: sanity check 80 80 this.disabled = this._reconstructDisabled(active); … … 82 82 } 83 83 84 _delete(name )84 _delete(name) 85 85 { 86 86 let active = clone(this.active); 87 active.delete(name); 87 for (const name of names) 88 active.delete(name); 88 89 // TODO: sanity check 89 90 this.disabled = this._reconstructDisabled(active); … … 94 95 { 95 96 if (enabled) 96 this._add( name);97 this._add(); 97 98 else 98 this._delete( name);99 this._delete(); 99 100 } 100 101 };
Note:
See TracChangeset
for help on using the changeset viewer.