void AbstractClassRep::initialize() { AssertFatal(!initialized, "Duplicate call to AbstractClassRep::initialize()!"); Vector<AbstractClassRep *> dynamicTable(__FILE__, __LINE__); AbstractClassRep *walk; // Initialize namespace references... for (walk = classLinkList; walk; walk = walk->nextClass) { walk->mNamespace = Con::lookupNamespace(StringTable->insert(walk->getClassName())); walk->mNamespace->mUsage = walk->getDocString(); walk->mNamespace->mClassRep = walk; } // Initialize field lists... (and perform other console registration). for (walk = classLinkList; walk; walk = walk->nextClass) { // sg_tempFieldList is used as a staging area for field lists // (see addField, addGroup, etc.) sg_tempFieldList.setSize(0); walk->init(); // So if we have things in it, copy it over... if (sg_tempFieldList.size() != 0) walk->mFieldList = sg_tempFieldList; // And of course delete it every round. sg_tempFieldList.clear(); } // Calculate counts and bit sizes for the various NetClasses. for (U32 group = 0; group < NetClassGroupsCount; group++) { U32 groupMask = 1 << group; // Specifically, for each NetClass of each NetGroup... for(U32 type = 0; type < NetClassTypesCount; type++) { // Go through all the classes and find matches... for (walk = classLinkList; walk; walk = walk->nextClass) { if(walk->mClassType == type && walk->mClassGroupMask & groupMask) dynamicTable.push_back(walk); } // Set the count for this NetGroup and NetClass NetClassCount[group][type] = dynamicTable.size(); if(!NetClassCount[group][type]) continue; // If no classes matched, skip to next. // Sort by type and then by name. dQsort((void *) &dynamicTable[0], dynamicTable.size(), sizeof(AbstractClassRep *), ACRCompare); // Allocate storage in the classTable classTable[group][type] = new AbstractClassRep*[NetClassCount[group][type]]; // Fill this in and assign class ids for this group. for(U32 i = 0; i < NetClassCount[group][type];i++) { classTable[group][type][i] = dynamicTable[i]; dynamicTable[i]->mClassId[group] = i; } // And calculate the size of bitfields for this group and type. NetClassBitSize[group][type] = getBinLog2(getNextPow2(NetClassCount[group][type] + 1)); AssertFatal(NetClassCount[group][type] < (1 << NetClassBitSize[group][type]), "NetClassBitSize too small!"); dynamicTable.clear(); } } // Ok, we're golden! initialized = true; }