Results 1 to 3 of 3

Thread: Entities not recognizing name changed

  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default Entities not recognizing name changed

    Heya Seth,

    I noticed that of you explicitly set the "name" variant of an Entity, it doesn't change the cached variable (m_name).

    This will fix the problem.

    Code:
    void Entity::OneTimeInit()
    {
    	m_pPosVarCache = NULL;
    	m_pAlignment = NULL;
    	m_pSizeCache = NULL;
    	m_recursiveFilterReferences = 0;
    	m_bTaggedForDeletion = false;
    	m_pParent = NULL;
    
        GetVar("name")->GetSigOnChanged()->connect(boost::bind(&Entity::OnNameChanged, this, _1));
    	
        
    	GetFunction("OnDelete")->sig_function.connect(1, boost::bind(&Entity::OnDelete, this, _1));
    }
    
    void Entity::OnNameChanged(Variant* v)
    {
        m_name = v->GetString();
    }

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    This is by design - m_name is not a variant, just a standard string settable with SetName(). If someone uses a DB variant of "name", they can safely assume it is for their own use and not connected to an entity name or anything else.

    That said, I guess it could make sense to have it be a variant instead, to make it easy to schedule name changes. I've never had a need to do that before though. Would that help with something you are doing?
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    Ahhh, makes sense.

    I'm working on a set of functions that will allow you to load your Entity/Component layouts via XML (to be shared soon!). Using a Variant makes my parsing functions a little cleaner, but it's really not that big of a deal either way.

Similar Threads

  1. Entities and UI
    By BigBMan in forum Proton SDK
    Replies: 1
    Last Post: 09-28-2011, 10:11 PM
  2. Placing Entities next to each other
    By BigBMan in forum Proton SDK
    Replies: 1
    Last Post: 11-18-2010, 11:30 AM
  3. Real bug to do with entities
    By Uhfgood in forum Novashell Game Creation System
    Replies: 9
    Last Post: 07-17-2008, 03:49 AM
  4. Help with attaching entities
    By Uhfgood in forum Novashell Game Creation System
    Replies: 1
    Last Post: 07-13-2008, 02:02 AM
  5. Getting Entities to discover the Brain State of other entities
    By stellarvector in forum Novashell Game Creation System
    Replies: 1
    Last Post: 06-28-2007, 11:11 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •