support misc_*model as misc_model in the radiant editor (way more convenient)
authorRudolf Polzer <divverent@alientrap.org>
Fri, 4 Jun 2010 18:56:24 +0000 (20:56 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 4 Jun 2010 18:57:00 +0000 (20:57 +0200)
plugins/entity/entity.cpp
radiant/entity.cpp

index 16dd774..ec02abd 100644 (file)
@@ -50,8 +50,7 @@ EGameType g_gameType;
 
 inline scene::Node& entity_for_eclass(EntityClass* eclass)
 {
-  if(classname_equal(eclass->name(), "misc_model")
-  || classname_equal(eclass->name(), "misc_gamemodel")
+  if((string_compare_nocase_n(eclass->name(), "misc_", 5) == 0 && string_equal_nocase(eclass->name() + string_length(eclass->name()) - 5, "model")) // misc_*model (also misc_model) // TODO make classname_* wrapper functions for this
   || classname_equal(eclass->name(), "model_static"))
   {
     return New_MiscModel(eclass);
index a572539..055de63 100644 (file)
@@ -328,8 +328,7 @@ void Entity_createFromSelection(const char* name, const Vector3& origin)
 
   EntityClass* entityClass = GlobalEntityClassManager().findOrInsert(name, true);
 
-  bool isModel = string_equal_nocase(name, "misc_model")
-    || string_equal_nocase(name, "misc_gamemodel")
+  bool isModel = (string_compare_nocase_n(name, "misc_", 5) == 0 && string_equal_nocase(name + string_length(name) - 5, "model")) // misc_*model (also misc_model)
     || string_equal_nocase(name, "model_static")
     || (GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase(name, "func_static"));