| 682 | */ |
| 683 | |
| 684 | int CSequencer::ParseAffect( CBlock *block, bstream_t *bstream, CIcarus* icarus ) |
| 685 | { |
| 686 | IGameInterface* game = icarus->GetGame(); |
| 687 | CSequencer *stream_sequencer = NULL; |
| 688 | char *entname = NULL; |
| 689 | int ret; |
| 690 | int ent = -1; |
| 691 | |
| 692 | entname = (char*) block->GetMemberData( 0 ); |
| 693 | ent = game->GetByName( entname ); |
| 694 | |
| 695 | if( ent < 0 ) // if there wasn't a valid entname in the affect, we need to check if it's a get command |
| 696 | { |
| 697 | //try to parse a 'get' command that is embeded in this 'affect' |
| 698 | |
| 699 | int id; |
| 700 | char *p1 = NULL; |
| 701 | char *name = 0; |
| 702 | CBlockMember *bm = NULL; |
| 703 | // |
| 704 | // Get the first parameter (this should be the get) |
| 705 | // |
| 706 | bm = block->GetMember( 0 ); |
| 707 | id = bm->GetID(); |
| 708 | |
| 709 | switch ( id ) |
| 710 | { |
| 711 | // these 3 cases probably aren't necessary |
| 712 | case CIcarus::TK_STRING: |
| 713 | case CIcarus::TK_IDENTIFIER: |
| 714 | case CIcarus::TK_CHAR: |
| 715 | p1 = (char *) bm->GetData(); |
| 716 | break; |
| 717 | |
| 718 | case CIcarus::ID_GET: |
| 719 | { |
| 720 | int type; |
| 721 | |
| 722 | //get( TYPE, NAME ) |
| 723 | type = (int) (*(float *) block->GetMemberData( 1 )); |
| 724 | name = (char *) block->GetMemberData( 2 ); |
| 725 | |
| 726 | switch ( type ) // what type are they attempting to get |
| 727 | { |
| 728 | |
| 729 | case CIcarus::TK_STRING: |
| 730 | //only string is acceptable for affect, store result in p1 |
| 731 | if ( game->GetString( m_ownerID, name, &p1 ) == false) |
| 732 | { |
| 733 | block->Free(icarus); |
| 734 | delete block; |
| 735 | block = NULL; |
| 736 | return false; |
| 737 | } |
| 738 | break; |
| 739 | default: |
| 740 | //FIXME: Make an enum id for the error... |
| 741 | game->DebugPrint(IGameInterface::WL_ERROR, "Invalid parameter type on affect _1" ); |
nothing calls this directly
no test coverage detected