void Forest::createNewFile() { // Release the current file if we have one. mData = NULL; // We need to construct a default file name String missionName( Con::getVariable( "$Client::MissionFile" ) ); String levelDirectory( Con::getVariable( "$pref::Directories::Level" ) ); if ( levelDirectory.isEmpty() ) { levelDirectory = "levels"; } missionName.replace( "tools/levels", levelDirectory ); missionName = Platform::makeRelativePathName(missionName, Platform::getMainDotCsDir()); Torque::Path basePath( missionName ); String fileName = Torque::FS::MakeUniquePath( basePath.getPath(), basePath.getFileName(), "forest" ); mDataFileName = StringTable->insert( fileName ); ForestData *file = new ForestData; file->write( mDataFileName ); delete file; mData = ResourceManager::get().load( mDataFileName ); mZoningDirty = true; }
// // RegisterMissionPack // // Register the given mission pack // const Mission * Group::RegisterMissionPack(const FileIdent &name) { // Copy the name of the pack FileIdent missionName(name); // Find the start of the extension if (char *ptr = Utils::Strchr(missionName.str, '.')) { // And remove it *ptr = '\0'; // Register using the name only return (RegisterMission(missionName.str)); } return (NULL); }