Browse Source

Added a static assert to make sure type IDs always have a corresponding type name.

--HG--
branch : minor
Alex Szpakowski 10 years ago
parent
commit
dcbe7c4871
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/common/types.cpp

+ 2 - 0
src/common/types.cpp

@@ -202,6 +202,8 @@ StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 
 
 StringMap<Type, TYPE_MAX_ENUM> types(typeEntries, sizeof(typeEntries));
 StringMap<Type, TYPE_MAX_ENUM> types(typeEntries, sizeof(typeEntries));
 
 
+static_assert((sizeof(typeEntries) / sizeof(typeEntries[0])) == TYPE_MAX_ENUM, "Type name array size doesn't match the total number of type IDs!");
+
 bool getType(const char *in, love::Type &out)
 bool getType(const char *in, love::Type &out)
 {
 {
 	return types.find(in, out);
 	return types.find(in, out);