本文整理汇总了C++中PClass::InsertIntoHash方法的典型用法代码示例。如果您正苦于以下问题:C++ PClass::InsertIntoHash方法的具体用法?C++ PClass::InsertIntoHash怎么用?C++ PClass::InsertIntoHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PClass
的用法示例。
在下文中一共展示了PClass::InsertIntoHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// Like FindClass but creates a placeholder if no class
// is found. CreateDerivedClass will automatically fill
// in the placeholder when the actual class is defined.
const PClass *PClass::FindClassTentative (FName name)
{
if (name == NAME_None)
{
return NULL;
}
PClass *cls = TypeHash[name % HASH_SIZE];
while (cls != 0)
{
int lexx = int(name) - int(cls->TypeName);
if (lexx > 0)
{
cls = cls->HashNext;
}
else if (lexx == 0)
{
return cls;
}
else
{
break;
}
}
PClass *type = new PClass;
DPrintf("Creating placeholder class %s : %s\n", name.GetChars(), TypeName.GetChars());
type->TypeName = name;
type->ParentClass = this;
type->Size = -1;
type->Pointers = NULL;
type->ConstructNative = NULL;
type->ClassIndex = m_Types.Push (type);
type->Defaults = NULL;
type->FlatPointers = NULL;
type->bRuntimeClass = true;
type->ActorInfo = NULL;
type->InsertIntoHash();
return type;
}
示例2: FindClass
// Create a new class based on an existing class
PClass *PClass::CreateDerivedClass (FName name, unsigned int size)
{
assert (size >= Size);
PClass *type;
bool notnew;
const PClass *existclass = FindClass(name);
// This is a placeholder so fill it in
if (existclass != NULL && existclass->Size == (unsigned)-1)
{
type = const_cast<PClass*>(existclass);
if (!IsDescendantOf(type->ParentClass))
{
I_Error("%s must inherit from %s but doesn't.", name.GetChars(), type->ParentClass->TypeName.GetChars());
}
DPrintf("Defining placeholder class %s\n", name.GetChars());
notnew = true;
}
else
{
type = new PClass;
notnew = false;
}
type->TypeName = name;
type->ParentClass = this;
type->Size = size;
type->Pointers = NULL;
type->ConstructNative = ConstructNative;
if (!notnew)
{
type->ClassIndex = m_Types.Push (type);
}
type->Meta = Meta;
// Set up default instance of the new class.
type->Defaults = new BYTE[size];
memcpy (type->Defaults, Defaults, Size);
if (size > Size)
{
memset (type->Defaults + Size, 0, size - Size);
}
type->FlatPointers = NULL;
type->bRuntimeClass = true;
type->ActorInfo = NULL;
type->Symbols.SetParentTable (&this->Symbols);
if (!notnew) type->InsertIntoHash();
// If this class has an actor info, then any classes derived from it
// also need an actor info.
if (this->ActorInfo != NULL)
{
FActorInfo *info = type->ActorInfo = new FActorInfo;
info->Class = type;
info->GameFilter = GAME_Any;
info->SpawnID = 0;
info->DoomEdNum = -1;
info->OwnedStates = NULL;
info->NumOwnedStates = 0;
info->Replacement = NULL;
info->Replacee = NULL;
info->StateList = NULL;
info->DamageFactors = NULL;
info->PainChances = NULL;
m_RuntimeActors.Push (type);
}
return type;
}