Jump to content

Search the Community

Showing results for tags 'recursion'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Add-on Store (https://store.unigine.com/)
    • Showcase
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 2 results

  1. Hello Short example: class T { string a; T(string value) { a = value; } }; class My { int _flag = 0; int _test[0]; T _test2 = new T("old"); void test() { log.message("before:\t" + string(_test.size()) + "\t" + _test2.a + "\n"); int local[] = (1); T local2 = new T("temp"); log.message("after:\t" + string(_test.size()) + "\t" + _test2.a + "\n"); local.append(10); _test = local; local2 = new T("new"); _test2 = local2; if (_flag == 0) { _flag = 1; test(); } } } Expected: before: 0 old after: 0 old before: 2 new after: 2 new Real result: before: 0 old after: 0 old before: 2 new after: 1 new
  2. So, I have a recursive class function with a map, a vector, and a problem Say the function looks like void foo(MyObject bar) { *do stuff with bar* MyObject childObjectMap[]; bar.getChildren(childObjectMap); // clears childObjectMap then copies all of the child objects into it foreach(MyObject obj; childObjectMap) { foo(obj); } } The expected result is that this will traverse each MyObject, do things with it, then get all it's children objects and repeat recursively. What actually happens is that it only does this with the first child. So, even if each MyObject has five children this will only recurse on the first child of the first child. What I found is happening is that each time the ID of ChildObjectMap remains the same so, in essense, it is static. Everytime I call MyObject::getChildren I'm clobbering it so on the return it has the data from the child. So, the question becomes, how do I create a new map or vector to keep a function from treating a map or vector like a static?
×
×
  • Create New...