MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Get

Method Get

code/icarus/TaskManager.cpp:548–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546}
547
548int CTaskManager::Get( int entID, CBlock *block, int &memberNum, char **value, CIcarus* icarus )
549{
550 static char tempBuffer[128]; //FIXME: EEEK!
551 vec3_t vector;
552 char *name, *tagName;
553 float tagLookup;
554 int type;
555
556 //Look for a get() inline call
557 if ( Check( CIcarus::ID_GET, block, memberNum ) )
558 {
559 //Update the member past the header id
560 memberNum++;
561
562 //get( TYPE, NAME )
563 type = (int) (*(float *) block->GetMemberData( memberNum++ ));
564 name = (char *) block->GetMemberData( memberNum++ );
565
566 //Format the return properly
567 //FIXME: This is probably doing double formatting in certain cases...
568 //FIXME: STRING MANAGEMENT NEEDS TO BE IMPLEMENTED, MY CURRENT SOLUTION IS NOT ACCEPTABLE!!
569 switch ( type )
570 {
571 case CIcarus::TK_STRING:
572 if ( icarus->GetGame()->GetString( entID, name, value ) == false )
573 {
574 icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Get() parameter \"%s\" could not be found!\n", name );
575 return false;
576 }
577
578 return true;
579 break;
580
581 case CIcarus::TK_FLOAT:
582 {
583 float temp;
584
585 if ( icarus->GetGame()->GetFloat( entID, name, &temp ) == false )
586 {
587 icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Get() parameter \"%s\" could not be found!\n", name );
588 return false;
589 }
590
591 Com_sprintf( tempBuffer, sizeof(tempBuffer), "%f", temp );
592 *value = (char *) tempBuffer;
593 }
594
595 return true;
596 break;
597
598 case CIcarus::TK_VECTOR:
599 {
600 vec3_t vval;
601
602 if ( icarus->GetGame()->GetVector( entID, name, vval ) == false )
603 {
604 icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Get() parameter \"%s\" could not be found!\n", name );
605 return false;

Callers 1

CGhoul2Info_vClass · 0.45

Calls 11

DebugPrintMethod · 0.80
RandomMethod · 0.80
Com_sprintfFunction · 0.50
GetMemberDataMethod · 0.45
GetStringMethod · 0.45
GetGameMethod · 0.45
GetFloatMethod · 0.45
GetVectorMethod · 0.45
GetTagMethod · 0.45
GetMemberMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected