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

Method GetImmediate

neo/d3xp/script/Script_Compiler.cpp:464–481  ·  view source on GitHub ↗

============ idCompiler::GetImmediate returns an existing immediate with the same value, or allocates a new one ============ */

Source from the content-addressed store, hash-verified

462============
463*/
464idVarDef *idCompiler::GetImmediate( idTypeDef *type, const eval_t *eval, const char *string ) {
465 idVarDef *def;
466
467 def = FindImmediate( type, eval, string );
468 if ( def ) {
469 def->numUsers++;
470 } else {
471 // allocate a new def
472 def = gameLocal.program.AllocDef( type, "<IMMEDIATE>", &def_namespace, true );
473 if ( type->Type() == ev_string ) {
474 def->SetString( string, true );
475 } else {
476 def->SetValue( *eval, true );
477 }
478 }
479
480 return def;
481}
482
483/*
484============

Callers

nothing calls this directly

Calls 4

AllocDefMethod · 0.45
TypeMethod · 0.45
SetStringMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected