| 826 | */ |
| 827 | |
| 828 | int CSequencer::ParseTask( CBlock *block, bstream_t *bstream , CIcarus* icarus) |
| 829 | { |
| 830 | IGameInterface* game = icarus->GetGame(); |
| 831 | CSequence *sequence; |
| 832 | CTaskGroup *group; |
| 833 | const char *taskName; |
| 834 | |
| 835 | //Setup the container sequence |
| 836 | sequence = AddSequence( m_curSequence, m_curSequence, CSequence::SQ_TASK | CSequence::SQ_RETAIN, icarus); |
| 837 | m_curSequence->AddChild( sequence ); |
| 838 | |
| 839 | //Get the name of this task for reference later |
| 840 | taskName = (const char *) block->GetMemberData( 0 ); |
| 841 | |
| 842 | //Get a new task group from the task manager |
| 843 | group = m_taskManager->AddTaskGroup( taskName, icarus ); |
| 844 | |
| 845 | if ( group == NULL ) |
| 846 | { |
| 847 | game->DebugPrint(IGameInterface::WL_ERROR, "error : unable to allocate a new task group" ); |
| 848 | block->Free(icarus); |
| 849 | delete block; |
| 850 | block = NULL; |
| 851 | return SEQ_FAILED; |
| 852 | } |
| 853 | |
| 854 | //The current group is set to this group, all subsequent commands (until a block end) will fall into this task group |
| 855 | group->SetParent( m_curGroup ); |
| 856 | m_curGroup = group; |
| 857 | |
| 858 | //Keep an association between this task and the container sequence |
| 859 | AddTaskSequence( sequence, group ); |
| 860 | |
| 861 | //PushCommand( block, PUSH_FRONT ); |
| 862 | block->Free(icarus); |
| 863 | delete block; |
| 864 | block = NULL; |
| 865 | |
| 866 | //Recursively obtain the loop |
| 867 | Route( sequence, bstream, icarus ); |
| 868 | |
| 869 | return SEQ_OK; |
| 870 | } |
| 871 | |
| 872 | /* |
| 873 | ======================== |
nothing calls this directly
no test coverage detected