瀏覽代碼

Code/comment cleanup

master
achmizs 4 年之前
父節點
當前提交
348c26aa7d
共有 1 個檔案被更改,包括 10 行新增7 行删除
  1. 10
    7
      SA_DiceFormatter.m

+ 10
- 7
SA_DiceFormatter.m 查看文件

@@ -145,9 +145,11 @@ static NSDictionary *_stringFormatRules;
// only if error reporting is enabled.
if (expression.result != nil) {
[formattedString appendFormat:@" = %@", expression.result];
} else if (_legacyModeErrorReportingEnabled == YES &&
expression.errorBitMask != 0) {
[formattedString appendFormat:((__builtin_popcountl(expression.errorBitMask) == 1) ? @" [ERROR: %@]" : @" [ERRORS: %@]"),
} else if ( _legacyModeErrorReportingEnabled == YES
&& expression.errorBitMask != 0) {
[formattedString appendFormat:((__builtin_popcountl(expression.errorBitMask) == 1)
? @" [ERROR: %@]"
: @" [ERRORS: %@]"),
[SA_DiceFormatter descriptionForErrors:expression.errorBitMask]];
}
@@ -167,7 +169,7 @@ static NSDictionary *_stringFormatRules;
is printed along with the rolls.
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) {
@@ -352,9 +354,10 @@ static NSDictionary *_stringFormatRules;
}

NSMutableArray <NSString *> *errorDescriptions = [NSMutableArray array];
for (int i = 0; i <= 18; i++) {
if ((errorBitMask & 1 << i) == 0) continue;
NSString *errorName = NSStringFromSA_DiceExpressionError((SA_DiceExpressionError) 1 << i);
for (int i = 0; i <= 19; i++) {
if ((errorBitMask & (1 << i)) == 0)
continue;
NSString *errorName = NSStringFromSA_DiceExpressionError((SA_DiceExpressionError) (1 << i));
[errorDescriptions addObject:(_errorDescriptions[errorName] ?: errorName)];
}


Loading…
取消
儲存