Skip to content

Commit

Permalink
craftdef.cpp: Return 0 after assert to make Clang happy
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzhul committed Apr 5, 2015
1 parent 4235f67 commit ed3ebd6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/craftdef.cpp
Expand Up @@ -531,6 +531,7 @@ u64 CraftDefinitionShaped::getHash(CraftHashType type) const
} else {
//illegal hash type for this CraftDefinition (pre-condition)
assert(false);
return 0;
}
}

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

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

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

Expand Down

3 comments on commit ed3ebd6

@est31
Copy link
Contributor

@est31 est31 commented on ed3ebd6 Apr 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@ShadowNinja
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

@est31 est31 commented on ed3ebd6 Apr 19, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

Please sign in to comment.