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

Method deleteObjectsFromFile

Engine/source/console/persistenceManager.cpp:2159–2191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2157}
2158
2159void PersistenceManager::deleteObjectsFromFile(const char* fileName)
2160{
2161 if ( mCurrentFile )
2162 {
2163 Con::errorf( "PersistenceManager::deleteObjectsFromFile(): Cannot process while file while another is currently open." );
2164 return;
2165 }
2166
2167 // Expand Script File.
2168 char buffer[1024];
2169 Con::expandScriptFilename( buffer, 1024, fileName );
2170
2171 // Parse File.
2172 if ( !parseFile( StringTable->insert(buffer) ) )
2173 {
2174 // Invalid.
2175 return;
2176 }
2177
2178 // Iterate over the objects.
2179 for ( Vector<ParsedObject*>::iterator itr = mObjectBuffer.begin(); itr != mObjectBuffer.end(); itr++ )
2180 {
2181 SimObject *object;
2182 if ( Sim::findObject( ( *itr )->name, object ) )
2183 {
2184 // Delete the Object.
2185 object->deleteObject();
2186 }
2187 }
2188
2189 // Clear.
2190 clearAll();
2191}
2192
2193DefineConsoleMethod( PersistenceManager, deleteObjectsFromFile, void, ( const char * fileName ), , "( fileName )"
2194 "Delete all of the objects that are created from the given file." )

Callers 1

Calls 7

errorfFunction · 0.85
expandScriptFilenameFunction · 0.85
findObjectFunction · 0.70
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
deleteObjectMethod · 0.45

Tested by

no test coverage detected