| 230 | //----------------------------------------------------------------------------- |
| 231 | |
| 232 | void SimSet::callOnChildren( const String &method, S32 argc, ConsoleValue argv[], bool executeOnChildGroups ) |
| 233 | { |
| 234 | // Prep the arguments for the console exec... |
| 235 | // Make sure and leave args[1] empty. |
| 236 | ConsoleValue args[21] = { }; |
| 237 | args[0].setString(method.c_str()); |
| 238 | |
| 239 | for (S32 i = 0; i < argc; i++) |
| 240 | args[i + 2].setString(argv[i].getString()); |
| 241 | |
| 242 | for( iterator i = begin(); i != end(); i++ ) |
| 243 | { |
| 244 | SimObject *childObj = static_cast<SimObject*>(*i); |
| 245 | |
| 246 | if( childObj->isMethod( method.c_str() ) ) |
| 247 | Con::execute(childObj, argc + 2, args); |
| 248 | |
| 249 | if( executeOnChildGroups ) |
| 250 | { |
| 251 | SimSet* childSet = dynamic_cast<SimSet*>(*i); |
| 252 | if ( childSet ) |
| 253 | childSet->callOnChildren( method, argc, argv, executeOnChildGroups ); |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | //----------------------------------------------------------------------------- |
| 259 | |