MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / GetType

Method GetType

neo/game/script/Script_Program.cpp:1160–1176  ·  view source on GitHub ↗

============ idProgram::GetType Returns a preexisting complex type that matches the parm, or allocates a new one and copies it out. ============ */

Source from the content-addressed store, hash-verified

1158============
1159*/
1160idTypeDef *idProgram::GetType( idTypeDef &type, bool allocate ) {
1161 int i;
1162
1163 //FIXME: linear search == slow
1164 for( i = types.Num() - 1; i >= 0; i-- ) {
1165 if ( types[ i ]->MatchesType( type ) && !strcmp( types[ i ]->Name(), type.Name() ) ) {
1166 return types[ i ];
1167 }
1168 }
1169
1170 if ( !allocate ) {
1171 return NULL;
1172 }
1173
1174 // allocate a new one
1175 return AllocType( type );
1176}
1177
1178/*
1179============

Callers 2

ParseObjectDefMethod · 0.45
ParseFunctionMethod · 0.45

Calls 3

NumMethod · 0.45
MatchesTypeMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected