The problem is that old-style enumerations are unscoped. You can avoid this problem (provided your compiler has the relevant C++11 support) by using scoped enumerations:
enum class GameObjectType { NINJA_PLAYER };
enum class GameObjectTypeLocation { NONE, MASSAGE_ALL, NINJA_PLAYER };
Alternatively, you can put your old-school enumerations in namespaces:
namespace foo
{
enum GameObjectType { NINJA_PLAYER };
} // namespace foo
namespace bar
{
enum GameObjectTypeLocation { NONE, MASSAGE_ALL, NINJA_PLAYER };
} // namespace bar
Then your enum values will be foo::NINJA_PLAYER
, bar::NINJA_PLAYER
etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…