| 2916 | } |
| 2917 | |
| 2918 | bool CScriptBind_AI::GetSignalExtraData(IFunctionHandler* pH, int iParam, IAISignalExtraData*& pEData) |
| 2919 | { |
| 2920 | bool bDataFound = false; |
| 2921 | SmartScriptTable theObj; |
| 2922 | int iNumberValues = 0; |
| 2923 | |
| 2924 | int iValue = 0; |
| 2925 | float fValue = 0.0f; |
| 2926 | ScriptHandle nID(0); |
| 2927 | const char* sObjectName = 0; |
| 2928 | Vec3 point(ZERO); |
| 2929 | |
| 2930 | for (int i = iParam; i <= iParam + 3 && i <= pH->GetParamCount(); i++) |
| 2931 | { |
| 2932 | //int iType = pH->GetParamType(i); |
| 2933 | if (pH->GetParamType(i) == svtNumber) |
| 2934 | { |
| 2935 | //entity ID or whatever |
| 2936 | |
| 2937 | if (++iNumberValues == 1) |
| 2938 | pH->GetParam(i, iValue);//convention: first parameter is always an integer. if you want to send |
| 2939 | // a float, always send an integer first |
| 2940 | else |
| 2941 | pH->GetParam(i, fValue); |
| 2942 | |
| 2943 | bDataFound = true; |
| 2944 | } |
| 2945 | else if (pH->GetParamType(i) == svtPointer) |
| 2946 | { |
| 2947 | pH->GetParam(i, nID); |
| 2948 | bDataFound = true; |
| 2949 | } |
| 2950 | else if (pH->GetParamType(i) == svtString) |
| 2951 | { |
| 2952 | pH->GetParam(i, sObjectName); |
| 2953 | bDataFound = true; |
| 2954 | } |
| 2955 | else if (pH->GetParamType(i) == svtObject)//supposed table |
| 2956 | { |
| 2957 | pH->GetParam(i, theObj); |
| 2958 | |
| 2959 | if (theObj.GetPtr()) |
| 2960 | { |
| 2961 | // a vector is passed |
| 2962 | if (theObj->GetValue("x", point.x)) |
| 2963 | { |
| 2964 | theObj->GetValue("y", point.y); |
| 2965 | theObj->GetValue("z", point.z); |
| 2966 | bDataFound = true; |
| 2967 | } |
| 2968 | else if (theObj->HaveValue("point")) |
| 2969 | { |
| 2970 | // the entire Extra data structure (nID, fValue,point, pObject) is passed |
| 2971 | pEData = GetAISystem()->CreateSignalExtraData(); |
| 2972 | pEData->FromScriptTable(theObj); |
| 2973 | return true; |
| 2974 | } |
| 2975 | else |
nothing calls this directly
no test coverage detected