Skip to content
Permalink
Browse files

craftdef.cpp: Return 0 after assert to make Clang happy

  • Loading branch information...
nerzhul committed Apr 5, 2015
1 parent 4235f67 commit ed3ebd633d23184c65128fae72f2b6c10c932e73
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/craftdef.cpp
@@ -531,6 +531,7 @@ u64 CraftDefinitionShaped::getHash(CraftHashType type) const
} else {
//illegal hash type for this CraftDefinition (pre-condition)
assert(false);
return 0;
}
}

@@ -676,6 +677,7 @@ u64 CraftDefinitionShapeless::getHash(CraftHashType type) const
} else {
//illegal hash type for this CraftDefinition (pre-condition)
assert(false);
return 0;
}
}

@@ -902,6 +904,7 @@ u64 CraftDefinitionCooking::getHash(CraftHashType type) const
} else {
//illegal hash type for this CraftDefinition (pre-condition)
assert(false);
return 0;
}
}

@@ -1011,6 +1014,7 @@ u64 CraftDefinitionFuel::getHash(CraftHashType type) const
} else {
//illegal hash type for this CraftDefinition (pre-condition)
assert(false);
return 0;
}
}

3 comments on commit ed3ebd6

@est31

This comment has been minimized.

Copy link
Contributor

est31 replied Apr 5, 2015

Thanks.

@ShadowNinja

This comment has been minimized.

Copy link
Member

ShadowNinja replied Apr 19, 2015

These should be restructured into something like (eg, for getHash)

assert(hash_inited); // Pre-condition
// Illegal hash type for this CraftDefinition (pre-condition)
assert(type == CRAFT_HASH_TYPE_ITEM_NAMES || type == CRAFT_HASH_TYPE_COUNT);
std::vector<std::string> rec_names = recipe_names;
std::sort(rec_names.begin(), rec_names.end());
return getHashForGrid(type, rec_names);
@est31

This comment has been minimized.

Copy link
Contributor

est31 replied Apr 19, 2015

I agree.

Please sign in to comment.
You can’t perform that action at this time.