MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / createNewFile

Method createNewFile

Engine/source/forest/forest.cpp:333–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333void Forest::createNewFile()
334{
335 // Release the current file if we have one.
336 mData = NULL;
337
338 // We need to construct a default file name
339 String levelAssetId(Con::getVariable("$Client::LevelAsset"));
340
341 LevelAsset* levelAsset;
342 if (!Sim::findObject(levelAssetId.c_str(), levelAsset))
343 {
344 Con::errorf("Forest::createNewFile() - Unable to find current level's LevelAsset. Unable to construct forest filePath");
345 return;
346 }
347
348 Torque::Path basePath(levelAsset->getForestPath() );
349
350 //If we didn't already define a forestfile to work with, just base it off our filename
351 if (basePath.isEmpty())
352 basePath = (Torque::Path)(levelAsset->getLevelPath());
353
354 String fileName = Torque::FS::MakeUniquePath( basePath.getPath(), basePath.getFileName(), "forest" );
355 mDataFileName = StringTable->insert( fileName.c_str() );
356
357 ForestData *file = new ForestData;
358 file->write( mDataFileName );
359 delete file;
360
361 mData = ResourceManager::get().load( mDataFileName );
362 mZoningDirty = true;
363}
364
365void Forest::saveDataFile( const char *path )
366{

Callers

nothing calls this directly

Calls 14

getVariableFunction · 0.85
MakeUniquePathFunction · 0.85
getForestPathMethod · 0.80
getLevelPathMethod · 0.80
getFileNameMethod · 0.80
findObjectFunction · 0.50
errorfFunction · 0.50
getFunction · 0.50
c_strMethod · 0.45
isEmptyMethod · 0.45
getPathMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected