Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. const char *C_BaseEntity::GetClassname( void )
  2. {
  3. static char outstr[ 256 ];
  4. outstr[ 0 ] = 0;
  5. bool gotname = false;
  6. #ifndef NO_ENTITY_PREDICTION
  7. if ( GetPredDescMap() )
  8. {
  9. const char *mapname = GetClassMap().Lookup( GetPredDescMap()->dataClassName );
  10. if ( mapname && mapname[ 0 ] )
  11. {
  12. Q_strncpy( outstr, mapname, sizeof( outstr ) );
  13. gotname = true;
  14. }
  15. }
  16. #endif
  17.  
  18. if ( !gotname )
  19. {
  20. Q_strncpy( outstr, typeid( *this ).name(), sizeof( outstr ) );
  21. }
  22.  
  23. return outstr;
  24. }
  25.  
  26. const char *C_BaseEntity::GetDebugName( void )
  27. {
  28. return GetClassname();
  29. }
  30.  
  31. //-----------------------------------------------------------------------------
  32. // Purpose: Creates an entity by string name, but does not spawn it
  33. // Input : *className -
  34. // Output : C_BaseEntity
  35. //-----------------------------------------------------------------------------
  36. C_BaseEntity *CreateEntityByName( const char *className )
  37. {
  38. C_BaseEntity *ent = GetClassMap().CreateEntity( className );
  39. if ( ent )
  40. {
  41. return ent;
  42. }
  43.  
  44. Warning( "Can't find factory for entity: %s\n", className );
  45. return NULL;
  46. }
  47.  
  48. #ifdef _DEBUG
  49. CON_COMMAND( cl_sizeof, "Determines the size of the specified client class." )
  50. {
  51. if ( args.ArgC() != 2 )
  52. {
  53. Msg( "cl_sizeof <gameclassname>\n" );
  54. return;
  55. }
  56.  
  57. int size = GetClassMap().GetClassSize( args[ 1 ] );
  58.  
  59. Msg( "%s is %i bytes\n", args[ 1 ], size );
  60. }
  61. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement