CProperty* CEntityFactory::AttachProperty(CEntity& Entity, const nString& TypeName) const { CPropertyInfo PropInfo; nString Type = TypeName; if (!PropertyMeta.Get(Type.Get(), PropInfo)) { Type = StrPropPrefix + TypeName; if (!PropertyMeta.Get(Type.Get(), PropInfo)) n_error("No such property \"%s\"", TypeName.Get()); } n_assert(PropInfo.pStorage); if (PropInfo.ActivePools & Entity.GetEntityPool()) { PProperty Prop; if (!PropInfo.pStorage->Get(Entity.GetUniqueID(), Prop)) { Prop = (CProperty*)CoreFct->Create(Type); PropInfo.pStorage->Add(Entity.GetUniqueID(), Prop); Prop->SetEntity(&Entity); } return Prop.get_unsafe(); } return NULL; }