============ idCompiler::GetImmediate returns an existing immediate with the same value, or allocates a new one ============ */
| 462 | ============ |
| 463 | */ |
| 464 | idVarDef *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 | ============ |