BugInTheSYS

DebugConsole::ChangeVariable

Oct 2nd, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. void DebugConsole::ChangeVariable( std::string command ) {
  2.   char *name = new char(), *buf = new char();
  3.   std::vector< DcVariableInformation >::iterator itr;
  4.   sscanf( command.c_str(), "#%s %s", name, buf );
  5.   for( itr = Variables.begin(); itr != Variables.end(); ++itr ) {
  6.     if( std::string( ( *itr ).name ) == std::string( name ) ) {
  7.       switch( ( *itr ).type ) {
  8.         case DC_BYTE:
  9.           *( char* )( ( *itr ).variable ) = BCL::Typecasting::PcToInt( buf );
  10.         case DC_INT:
  11.           *( int* )( ( *itr ).variable ) = BCL::Typecasting::PcToInt( buf );
  12.         case DC_FLOAT:
  13.           *( float* )( ( *itr ).variable ) = BCL::Typecasting::PcToFlt( buf );
  14.         case DC_PCHAR:
  15.           ( *itr ).variable = ( void * )buf;
  16.       }
  17.     }
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment