Jump to content

possible bug re: saving forest objects


chriscalef

Recommended Posts

Just started messing around with a forest in my current T3D build (haven't updated in a couple of weeks, sorry if it's been fixed) and I noticed I could place a forest and add a few trees, but on save and reload my forest would be gone.


On further investigation it turned out to be what looks like a bug, easily solved. When you initially create the forest, it gets saved, empty, to a new .forest file. However, when you save the mission, in tools/forestEditor/main.cs it calls "theForest.saveDataFile()" with no argument.


Unfortunately, in forest.cpp, the saveDataFile console method expects a path, and if it finds none it apparently sends an empty string rather than a null on to the saveDataFile engine function, which then resets its mDataFileName to "" instead of the useful path it had before.


I fixed this locally by the following change to the console method.


Instead of this:

 

DefineConsoleMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" )
{   
   object->saveDataFile( path );
}

 

I made it this:

 

DefineConsoleMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" )
{   
  if (strlen(path)>0)
   object->saveDataFile( path );
  else
   object->saveDataFile();
}

 

Which seems to work fine.

Link to comment
Share on other sites

  • 4 weeks later...

I was toying with the forest editor and don't have "bugs". I tested in a clean 3.6.3 and development version. I add a forest and mixes trees from the library/meshes, save and the forest still there.


What version do you have, development or 3.6.3? Are you using default models or custom one?

can you create a new project with the same template you used? and check if you still have the bug.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...