| 331 | } |
| 332 | |
| 333 | void 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 | |
| 365 | void Forest::saveDataFile( const char *path ) |
| 366 | { |
nothing calls this directly
no test coverage detected