===================== idActor::UpdateScript ===================== */
| 1330 | ===================== |
| 1331 | */ |
| 1332 | void idActor::UpdateScript( void ) { |
| 1333 | int i; |
| 1334 | |
| 1335 | if ( ai_debugScript.GetInteger() == entityNumber ) { |
| 1336 | scriptThread->EnableDebugInfo(); |
| 1337 | } else { |
| 1338 | scriptThread->DisableDebugInfo(); |
| 1339 | } |
| 1340 | |
| 1341 | // a series of state changes can happen in a single frame. |
| 1342 | // this loop limits them in case we've entered an infinite loop. |
| 1343 | for( i = 0; i < 20; i++ ) { |
| 1344 | if ( idealState != state ) { |
| 1345 | SetState( idealState ); |
| 1346 | } |
| 1347 | |
| 1348 | // don't call script until it's done waiting |
| 1349 | if ( scriptThread->IsWaiting() ) { |
| 1350 | break; |
| 1351 | } |
| 1352 | |
| 1353 | scriptThread->Execute(); |
| 1354 | if ( idealState == state ) { |
| 1355 | break; |
| 1356 | } |
| 1357 | } |
| 1358 | |
| 1359 | if ( i == 20 ) { |
| 1360 | scriptThread->Warning( "idActor::UpdateScript: exited loop to prevent lockup" ); |
| 1361 | } |
| 1362 | } |
| 1363 | |
| 1364 | /*********************************************************************** |
| 1365 |
nothing calls this directly
no test coverage detected