Skip to content

Commit 492a9a9

Browse files
committed
update to commit bbd1fea24cebc095b66a6ceb19895fcd73771767 files
1 parent b956a6f commit 492a9a9

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

achievements.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ class CodeNote
317317
note = "";
318318
author = "";
319319
enum = null;
320+
assetCount = 0;
320321

321322
constructor(addr, note, author)
322323
{
@@ -809,4 +810,4 @@ class RichPresence
809810
}))];
810811
return richp;
811812
}
812-
}
813+
}

feedback.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// title case helpers
22
const TITLE_CASE_MINORS = new Set([
33
'a', 'an', 'and', 'as', 'at', 'but', 'by', 'en', 'for', 'from', 'how', 'if', 'in', "n'", "'n'",
4-
'neither', 'nor', 'of', 'on', 'only', 'onto', 'out', 'or', 'over', 'per', 'so', 'than', 'that',
4+
'neither', 'nor', 'of', 'on', 'only', 'onto', 'out', 'or', 'over', 'per', 'so', 'than',
55
'the', 'to', 'until', 'up', 'upon', 'v', 'v.', 'versus', 'vs', 'vs.', 'via', 'when',
66
'with', 'without', 'yet',
77
]);
@@ -394,8 +394,21 @@ function generate_code_note_stats(notes)
394394
}
395395

396396
stats.notes_count = notes.length;
397-
let all_addresses = current.set.getAchievements().reduce((a, e) => a.concat(e.logic.getAddresses()), []);
398-
let used_notes = notes.filter(x => all_addresses.some(y => x.contains(y)));
397+
let asset_addresses = [...current.set.getAchievements().map(e => e.logic.getAddresses()),
398+
...current.set.getLeaderboards().map(e => e.components).flatMap(cmps => Object.values(cmps)).map(cmp => cmp.getAddresses())
399+
];
400+
401+
if (current.rp) {
402+
const display_cond_addrs = current.rp.display.map(display => display.condition).filter(cond => cond !== null).flatMap(cond => cond.getAddresses());
403+
const lookup_addrs = current.rp.display.flatMap(display => display.lookups).flatMap(lookup => lookup.calc.getAddresses());
404+
asset_addresses.push([...display_cond_addrs, ...lookup_addrs]);
405+
}
406+
407+
notes.forEach(note => {
408+
note.assetCount = asset_addresses.filter(addrs => addrs.includes(note.addr)).length;
409+
});
410+
411+
let used_notes = notes.filter(x => x.assetCount > 0);
399412

400413
stats.notes_used = used_notes.length;
401414
stats.notes_unused = stats.notes_count - stats.notes_used;
@@ -684,11 +697,7 @@ function* check_pointers(logic)
684697
if (!note) continue;
685698

686699
if (note.isProbablePointer() && req.isComparisonOperator() && req.rhs.type == ReqType.VALUE && req.rhs.value != 0)
687-
yield new Issue(Feedback.POINTER_COMPARISON, req,
688-
<ul>
689-
<li>Accessing <code>{toDisplayHex(operand.value)}</code> as <code>{operand.size.name}</code></li>
690-
<li>Matching code note at <code>{toDisplayHex(note.addr)}</code> is marked as <code>{note.type.name}</code></li>
691-
</ul>);
700+
yield new Issue(Feedback.POINTER_COMPARISON, req); // TODO: provide better feedback
692701
}
693702
}
694703
}
@@ -957,7 +966,7 @@ function* check_title_case(asset)
957966
<li><a href={`https://titlecaseconverter.com/?style=CMOS&showExplanations=1&keepAllCaps=1&multiLine=1&highlightChanges=1&convertOnPaste=1&straightQuotes=1&title=${q}`}>titlecaseconverter.com</a></li>
958967
<li><a href={`https://capitalizemytitle.com/style/Chicago/?title=${q}`}>capitalizemytitle.com</a></li>
959968
</ul>
960-
<li><em>Warning: automated suggestions don't handle hyphenated or otherwise-separated words gracefully.</em></li>
969+
<li><em>Warning: automated suggestions don't handle hyphenated or otherwise-separated words gracefully. When in doubt, please rely on the sites linked above.</em></li>
961970
</ul>);
962971
}
963972
}
@@ -1282,6 +1291,7 @@ function get_leaderboard_issues(lb)
12821291

12831292
function assess_achievement(ach)
12841293
{
1294+
console.log('assessing', ach);
12851295
let res = new Assessment();
12861296

12871297
res.stats = generate_logic_stats(ach.logic);
@@ -1342,4 +1352,4 @@ function assess_set(set)
13421352

13431353
// attach feedback to the asset
13441354
return set.feedback = res;
1345-
}
1355+
}

scripts/update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

33
export URL="https://raw.githubusercontent.com/authorblues/retroachievements"
4-
export OLD_SHA="33769938f9ad3b5dd1afebaaa7d83744803172e9"
5-
export NEW_SHA="9fc8b755d60369a484475376b84c486be7d31a0f"
4+
export OLD_SHA="9fc8b755d60369a484475376b84c486be7d31a0f"
5+
export NEW_SHA="bbd1fea24cebc095b66a6ceb19895fcd73771767"
66

77
export MSG=$(git log -1 --pretty=%B)
88
if [[ $MSG != "update to commit $OLD_SHA files" ]]; then

0 commit comments

Comments
 (0)