MCPcopy Create free account
hub / github.com/JACoders/OpenJK / AddTaskGroup

Method AddTaskGroup

code/icarus/TaskManager.cpp:264–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262*/
263
264CTaskGroup *CTaskManager::AddTaskGroup( const char *name, CIcarus* icarus )
265{
266 CTaskGroup *group;
267
268 //Collect any garbage
269 taskGroupName_m::iterator tgni;
270 tgni = m_taskGroupNameMap.find( name );
271
272 if ( tgni != m_taskGroupNameMap.end() )
273 {
274 group = (*tgni).second;
275
276 //Clear it and just move on
277 group->Init();
278
279 return group;
280 }
281
282 //Allocate a new one
283 group = new CTaskGroup;
284
285 //TODO: Emit warning
286 assert( group );
287 if ( group == NULL )
288 {
289 icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Unable to allocate task group \"%s\"\n", name );
290 return NULL;
291 }
292
293 //Setup the internal information
294 group->SetGUID( m_GUID++ );
295
296 //Add it to the list and associate it for retrieval later
297 m_taskGroups.insert( m_taskGroups.end(), group );
298 m_taskGroupNameMap[ name ] = group;
299 m_taskGroupIDMap[ group->GetGUID() ] = group;
300
301 return group;
302}
303
304/*
305-------------------------

Callers 1

ParseTaskMethod · 0.45

Calls 8

DebugPrintMethod · 0.80
findMethod · 0.45
endMethod · 0.45
InitMethod · 0.45
GetGameMethod · 0.45
SetGUIDMethod · 0.45
insertMethod · 0.45
GetGUIDMethod · 0.45

Tested by

no test coverage detected