From dcbe7c4871bfa6ce393a23834aaea3db6e63d928 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 1 Mar 2015 18:42:02 -0400 Subject: [PATCH] Added a static assert to make sure type IDs always have a corresponding type name. --HG-- branch : minor --- src/common/types.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/types.cpp b/src/common/types.cpp index a36bd8127..66c4b28db 100644 --- a/src/common/types.cpp +++ b/src/common/types.cpp @@ -202,6 +202,8 @@ StringMap::Entry typeEntries[] = StringMap 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) { return types.find(in, out);