===================== idActor::UpdateScript ===================== */
| 1378 | ===================== |
| 1379 | */ |
| 1380 | void idActor::UpdateScript( void ) { |
| 1381 | int i; |
| 1382 | |
| 1383 | if ( ai_debugScript.GetInteger() == entityNumber ) { |
| 1384 | scriptThread->EnableDebugInfo(); |
| 1385 | } else { |
| 1386 | scriptThread->DisableDebugInfo(); |
| 1387 | } |
| 1388 | |
| 1389 | // a series of state changes can happen in a single frame. |
| 1390 | // this loop limits them in case we've entered an infinite loop. |
| 1391 | for( i = 0; i < 20; i++ ) { |
| 1392 | if ( idealState != state ) { |
| 1393 | SetState( idealState ); |
| 1394 | } |
| 1395 | |
| 1396 | // don't call script until it's done waiting |
| 1397 | if ( scriptThread->IsWaiting() ) { |
| 1398 | break; |
| 1399 | } |
| 1400 | |
| 1401 | scriptThread->Execute(); |
| 1402 | if ( idealState == state ) { |
| 1403 | break; |
| 1404 | } |
| 1405 | } |
| 1406 | |
| 1407 | if ( i == 20 ) { |
| 1408 | scriptThread->Warning( "idActor::UpdateScript: exited loop to prevent lockup" ); |
| 1409 | } |
| 1410 | } |
| 1411 | |
| 1412 | /*********************************************************************** |
| 1413 |
nothing calls this directly
no test coverage detected