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

Method createNewFile

Engine/source/forest/forest.cpp:328–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void Forest::createNewFile()
329{
330 // Release the current file if we have one.
331 mData = NULL;
332
333 // We need to construct a default file name
334 String missionName( Con::getVariable( "$Client::MissionFile" ) );
335 String levelDirectory( Con::getVariable( "$pref::Directories::Level" ) );
336 if ( levelDirectory.isEmpty() )
337 {
338 levelDirectory = "levels";
339 }
340 missionName.replace( "tools/levels", levelDirectory );
341 missionName = Platform::makeRelativePathName(missionName, Platform::getMainDotCsDir());
342
343 Torque::Path basePath( missionName );
344 String fileName = Torque::FS::MakeUniquePath( basePath.getPath(), basePath.getFileName(), "forest" );
345 mDataFileName = StringTable->insert( fileName );
346
347 ForestData *file = new ForestData;
348 file->write( mDataFileName );
349 delete file;
350
351 mData = ResourceManager::get().load( mDataFileName );
352 mZoningDirty = true;
353}
354
355void Forest::saveDataFile( const char *path )
356{

Callers

nothing calls this directly

Calls 10

getVariableFunction · 0.85
MakeUniquePathFunction · 0.85
replaceMethod · 0.80
getFileNameMethod · 0.80
getFunction · 0.50
isEmptyMethod · 0.45
getPathMethod · 0.45
insertMethod · 0.45
writeMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected