| 49 | } |
| 50 | |
| 51 | void SimConsoleEvent::process(SimObject* object) |
| 52 | { |
| 53 | // #ifdef DEBUG |
| 54 | // Con::printf("Executing schedule: %d", sequenceCount); |
| 55 | // #endif |
| 56 | if(mOnObject) |
| 57 | Con::execute(object, mArgc, mArgv ); |
| 58 | else |
| 59 | { |
| 60 | // Grab the function name. If '::' doesn't exist, then the schedule is |
| 61 | // on a global function. |
| 62 | char funcName[256]; |
| 63 | dStrncpy(funcName, mArgv[0].getString(), 256); |
| 64 | char* func = dStrstr( funcName, (char*)"::" ); |
| 65 | if( func ) |
| 66 | { |
| 67 | // Set the first colon to NULL, so we can reference the namespace. |
| 68 | // This is okay because events are deleted immediately after |
| 69 | // processing. Maybe a bad idea anyway? |
| 70 | func[0] = '\0'; |
| 71 | |
| 72 | // Move the pointer forward to the function name. |
| 73 | func += 2; |
| 74 | |
| 75 | // Lookup the namespace and function entry. |
| 76 | Namespace* ns = Namespace::find( StringTable->insert( funcName ) ); |
| 77 | if( ns ) |
| 78 | { |
| 79 | Namespace::Entry* nse = ns->lookup( StringTable->insert( func ) ); |
| 80 | if( nse ) |
| 81 | // Execute. |
| 82 | nse->execute( mArgc, mArgv, &gEvalState ); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | else |
| 87 | Con::execute(mArgc, mArgv ); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | void SimConsoleEvent::populateArgs(ConsoleValue *argv) |
| 92 | { |
no test coverage detected