When connecting entities, don't reuse the target field to name the entity
[xonotic/netradiant.git] / plugins / entity / entity.cpp
index 16dd77494aa99ef5f9346830e0c5c8fe33b97fff..36d7e919e2325a018d42749c234275a08ce1ddc7 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);
@@ -235,10 +234,6 @@ public:
     {
       ConnectEntities connector(e1, e2, index);
       const char* value = e2->getKeyValue("targetname");
-      if(string_empty(value))
-      {
-        value = e1->getKeyValue(connector.keyname());
-      }
       if(!string_empty(value))
       {
         connector.connect(value);