Code/comment cleanup

This commit is contained in:
achmizs 2021-12-04 19:16:46 -05:00
parent 285b2a9a6b
commit 348c26aa7d

View File

@ -145,9 +145,11 @@ static NSDictionary *_stringFormatRules;
// only if error reporting is enabled. // only if error reporting is enabled.
if (expression.result != nil) { if (expression.result != nil) {
[formattedString appendFormat:@" = %@", expression.result]; [formattedString appendFormat:@" = %@", expression.result];
} else if (_legacyModeErrorReportingEnabled == YES && } else if ( _legacyModeErrorReportingEnabled == YES
expression.errorBitMask != 0) { && expression.errorBitMask != 0) {
[formattedString appendFormat:((__builtin_popcountl(expression.errorBitMask) == 1) ? @" [ERROR: %@]" : @" [ERRORS: %@]"), [formattedString appendFormat:((__builtin_popcountl(expression.errorBitMask) == 1)
? @" [ERROR: %@]"
: @" [ERRORS: %@]"),
[SA_DiceFormatter descriptionForErrors:expression.errorBitMask]]; [SA_DiceFormatter descriptionForErrors:expression.errorBitMask]];
} }
@ -167,7 +169,7 @@ static NSDictionary *_stringFormatRules;
is printed along with the rolls. is printed along with the rolls.
For this reasons, when we recursively retrieve the string representations For this reasons, when we recursively retrieve the string representations
of sub-expressions, we call this method, not legacyStringFromExpression:. of sub-expressions, we call this method, not -[legacyStringFromExpression:].
*/ */
switch (expression.type) { switch (expression.type) {
@ -352,9 +354,10 @@ static NSDictionary *_stringFormatRules;
} }
NSMutableArray <NSString *> *errorDescriptions = [NSMutableArray array]; NSMutableArray <NSString *> *errorDescriptions = [NSMutableArray array];
for (int i = 0; i <= 18; i++) { for (int i = 0; i <= 19; i++) {
if ((errorBitMask & 1 << i) == 0) continue; if ((errorBitMask & (1 << i)) == 0)
NSString *errorName = NSStringFromSA_DiceExpressionError((SA_DiceExpressionError) 1 << i); continue;
NSString *errorName = NSStringFromSA_DiceExpressionError((SA_DiceExpressionError) (1 << i));
[errorDescriptions addObject:(_errorDescriptions[errorName] ?: errorName)]; [errorDescriptions addObject:(_errorDescriptions[errorName] ?: errorName)];
} }