282 lines
12 KiB
C
282 lines
12 KiB
C
/*///////////////////////////////////////////////////////////*/
|
|
/* //*/
|
|
/* Management of the Module : AI (Intelligence) //*/
|
|
/* //*/
|
|
/*///////////////////////////////////////////////////////////*/
|
|
/* //*/
|
|
/* abbreviation of the module-name. Used in macro is 'AI' //*/
|
|
/* //*/
|
|
/*///////////////////////////////////////////////////////////*/
|
|
#ifndef __ERRAI_H__
|
|
#define __ERRAI_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
#define C_szAIVersion "AI V5.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
|
|
#define C_szAIFullName "Artificial Intelligence"/* the complete and clear name of the module */
|
|
#define C_szAIDate "Dec 5 1997" /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
|
|
|
|
#ifndef __ERM_H__
|
|
#include "ERM.h"
|
|
#endif /*__ERM_H__*/
|
|
|
|
/*----------*/
|
|
/* Constant*/
|
|
/*----------*/
|
|
/* error of the AI Module*/
|
|
typedef enum e_uwAIErrNumber_{
|
|
E_uwAIFatalErr = 0,
|
|
#ifdef __FATAL_ERR_AI__
|
|
/* -----------------*/
|
|
E_uwAIFatalNotAFatalError,
|
|
E_uwAIFatalTooMuchCond,
|
|
E_uwAIFatalTooMuchAction,
|
|
E_uwAIFatalTooMuchParamCond,
|
|
E_uwAIFatalTooMuchParamAction,
|
|
E_uwAIFatalNoEltInStackCond,
|
|
E_uwAIFatalTooMuchEltInStackCond,
|
|
E_uwAIFatalWrongParamCond,
|
|
E_uwAIFatalWrongParamAction,
|
|
E_uwAIFatalNotValidField,
|
|
E_uwAIFatalInvalidAction,
|
|
E_uwAIFatalFailedAllocationMem,
|
|
E_uwAIFatalWrongTypeVar,
|
|
E_uwAIFatalPersoListFull,
|
|
E_uwAIFatalPbPersoListInsert,
|
|
E_uwAIFatalPbDeleteInPersoList,
|
|
E_uwAIFatalUnknownFieldName,
|
|
E_uwAIFatalUnknownFunc,
|
|
/*E_uwAIFatalUnknownFuncList,*/
|
|
E_uwAIFatalUnknownProcedure,
|
|
E_uwAIFatalUnknownCond,
|
|
E_uwAIFatalNotValidPriority,
|
|
E_uwAIFatalUnknownKeyWord,
|
|
E_uwAIFatalTooMuchNode,
|
|
E_uwAIActionTableTooSmall,
|
|
E_uwAIBadLeftInAffectation,
|
|
E_uwAIFatalBadComportNumber,
|
|
E_uwAIFatalBadNodeNumber,
|
|
E_uwAIFatalBadRuleNumber,
|
|
E_uwAIFatalNodeNotInRule,
|
|
E_uwAIFatalRuleNotInComport,
|
|
E_uwAIFatalComportNotInIntelligence,
|
|
E_uwAIFatalCantFindPerso,
|
|
E_uwAIFatalUnknownNode,
|
|
E_uwAIFatalInvalidAccessToField,
|
|
E_uwAIFatalInvalidAccessToDsgVar,
|
|
E_uwAIFatalInvalidAccessToFieldOrDsgVar,
|
|
E_uwAIFatalNotAGoodAction,
|
|
E_uwAIFatalWrongTypeParamAction,
|
|
E_uwAIFatalNotValidFunction,
|
|
E_uwAIFatalNotValidProcedure,
|
|
E_uwAIFatalNotValidDsgVarId,
|
|
E_uwAIFatalNotValidOperator,
|
|
E_uwAIFatalNotValidCondition,
|
|
E_uwAIFatalUnknownOperator,
|
|
E_uwAIFatalInvalidParameter,
|
|
E_uwAIFatalInvalidWPValue,
|
|
E_uwAIFatalArrayAlreadyFull,
|
|
E_uwAIFatalArrayEmpty,
|
|
E_uwAIFatalAssertionFailure,
|
|
E_uwAIFatalTypeLinkInvalid,
|
|
E_uwAIFatalDynTypeLinkInvalid,
|
|
E_uwAIFatalWayPositionInvalid,
|
|
E_uwAIFatalWayFirstLinkMustBeLine,
|
|
E_uwAIFatalNullVectorNotAllowed,
|
|
E_uwAIFatalBadEntryAIModel,
|
|
E_uwAIWrongOperatorInLeftAffect,
|
|
E_uwAIDivisionByZero,
|
|
E_uwAIFatalNoDynamics,
|
|
E_uwAIFatalUnknownButton,
|
|
E_uwAIFatalReferenceNotLoaded,
|
|
E_uwAIFatalScriptError,
|
|
E_uwAIFatalNotMSCamera,
|
|
E_uwAIFatalInvalidUseOfUltraOperator,
|
|
E_uwAIFatalInvalidModelCast,
|
|
E_uwAIFatalInvalidDsgvarSaveType,
|
|
|
|
#endif /*__FATAL_ERR_AI__*/
|
|
E_uwAIStartOfWarning,/* important constant, it allows to recognize if an error is fatal or not.*/
|
|
#ifdef __WARNING_ERR_AI__
|
|
/* -------------------*/
|
|
E_uwAIWarningCanNotFree,/*!!y*/
|
|
E_uwAIWarningTruncateAffectation,/*!!y*/
|
|
E_uwAIWarningBadType,
|
|
E_uwAIWarningChangeToCurrentComport,
|
|
E_uwAIWarningCycleComport,
|
|
E_uwAIWarningArrayCyclingComportTooSmall,
|
|
E_uwAIWarningExecuteActionInt,
|
|
E_uwAIWarningComportOfAnotherPerso,
|
|
E_uwAIDebugDynamicAllocation,
|
|
E_uwAIWarningScriptError,
|
|
E_uwAIWarningEngineGoto,
|
|
E_uwAIWarningChannelNotControlled, /*ANNECY BBB: is fatal for engine, but not in editor mode*/
|
|
#if defined(ACTIVE_EDITOR)
|
|
E_uwAIWarningUnknownCond,
|
|
E_uwAIWarningUnknownFieldName,
|
|
E_uwAIWarningUnknownOperator,
|
|
E_uwAIWarningUnknownFunc,
|
|
E_uwAIWarningUnknownProcedure,
|
|
E_uwAIWarningUnknownKeyWord,
|
|
E_uwAIWarningInvalidAction,
|
|
E_uwAIWarningUnknownNode,
|
|
E_uwAIWarningReferenceNotLoaded,
|
|
E_uwAIWarningWrongParamAction,
|
|
E_uwAIWarningInvalidUseOfUltraOperator,
|
|
E_uwAIWarningWrongTypeVar,
|
|
#endif
|
|
|
|
#endif /*__WARNING_ERR_AI__*/
|
|
E_uwAIErrNumber
|
|
} e_uwAIErrNumber;
|
|
|
|
/*------------------*/
|
|
/* Global Variables*/
|
|
/*------------------*/
|
|
#undef EXTERN_ERRAI
|
|
#undef extern
|
|
#ifndef __DeclareGlobalVariableErrAI_h__
|
|
#define EXTERN_ERRAI extern /*external declaration*/
|
|
#else /*__DeclareGlobalVariableErrAI_h__*/
|
|
#define EXTERN_ERRAI /*replace by nothing : we have to declare*/
|
|
#endif /*__DeclareGlobalVariableErrAI_h__*/
|
|
|
|
EXTERN_ERRAI unsigned char g_ucAIModuleId /*number of identification of the Erm module*/
|
|
#ifdef __DeclareGlobalVariableErrAI_h__
|
|
= C_ucModuleNotInitialized
|
|
#endif /*__DeclareGlobalVariableErrAI_h__*/
|
|
;
|
|
|
|
#ifdef __ERROR_STRINGS__
|
|
|
|
EXTERN_ERRAI char * g_a_szAIInformationModule []
|
|
#if defined(__DeclareGlobalVariableErrAI_h__) && !defined(CPA_WANTS_IMPORT)
|
|
= {C_szAIVersion, C_szAIFullName, C_szAIDate}
|
|
#endif /*__DeclareGlobalVariableErrAI_h__ && CPA_WANTS_IMPORT*/
|
|
;
|
|
|
|
|
|
EXTERN_ERRAI char * g_szAIModuleName /* Obliged syntax 'g_sz'+[Abbreviation of ModuleName]+'ModuleName'*/
|
|
#ifdef __DeclareGlobalVariableErrAI_h__
|
|
= "Module AI"
|
|
#endif /*__DeclareGlobalVariableErrAI_h__*/
|
|
;
|
|
|
|
EXTERN_ERRAI /*struct!!y!!*/ tdstErrorMsg/*_!!y!!*/ g_a_stAITabErr [] /* Obliged syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
|
|
#ifdef __DeclareGlobalVariableErrAI_h__/*Call from main program*/
|
|
={
|
|
#ifdef __FATAL_ERR_AI__
|
|
/* -------------*/
|
|
E_uwAIFatalNotAFatalError, "This is not a valide AI fatal error",
|
|
E_uwAIFatalTooMuchCond, "Too much Conditions Loaded",
|
|
E_uwAIFatalTooMuchAction, "Too much Actions Loaded",
|
|
E_uwAIFatalTooMuchParamCond, "Too much parameters for the Condition",
|
|
E_uwAIFatalTooMuchParamAction, "Too much parameters for the Action",
|
|
E_uwAIFatalNoEltInStackCond, "There is no element in condition stack",
|
|
E_uwAIFatalTooMuchEltInStackCond, "Too much elements in condition stack",
|
|
E_uwAIFatalWrongParamCond, "Wrong number of parameter in the Condition",
|
|
E_uwAIFatalWrongParamAction, "Wrong number of parameter",
|
|
E_uwAIFatalNotValidField, "Wrong field in perso struct",
|
|
E_uwAIFatalInvalidAction, "Invalid action",
|
|
E_uwAIFatalFailedAllocationMem, "Problem during an allocation memory",
|
|
E_uwAIFatalWrongTypeVar, "Script Read Problem: The type of the variable is not valid",
|
|
E_uwAIFatalPersoListFull, "The Perso List is Full",
|
|
E_uwAIFatalPbPersoListInsert, "The insert position in the Perso List is not available",
|
|
E_uwAIFatalPbDeleteInPersoList, "Wrong specified position in the Perso list! Can not delete the perso",
|
|
E_uwAIFatalUnknownFieldName, "Unknown Field Name",
|
|
E_uwAIFatalUnknownFunc, "Unknown Function Name",
|
|
E_uwAIFatalUnknownProcedure, "Unknown Procedure name",
|
|
E_uwAIFatalUnknownCond, "Unknown Condition Name",
|
|
E_uwAIFatalNotValidPriority, "Priority of rule must be greater than 0",
|
|
E_uwAIFatalUnknownKeyWord, "Unknown KeyWord Name",
|
|
E_uwAIFatalTooMuchNode, "Too much Node Interpret Loaded",
|
|
E_uwAIActionTableTooSmall, "Action table is too small",
|
|
E_uwAIBadLeftInAffectation, "Bad Type for left operand in affectation",
|
|
E_uwAIFatalBadComportNumber,"Bad comportment number",
|
|
E_uwAIFatalBadNodeNumber,"Bad node number",
|
|
E_uwAIFatalBadRuleNumber,"Bad rule number",
|
|
E_uwAIFatalNodeNotInRule,"CreateNode section not in CreateRule section",
|
|
E_uwAIFatalRuleNotInComport,"CreateRule section not in CreateComport section",
|
|
E_uwAIFatalComportNotInIntelligence,"CreateComport section not in CreateIntelligence section",
|
|
E_uwAIFatalCantFindPerso, "Can't find perso",
|
|
E_uwAIFatalUnknownNode,"Unknown node",
|
|
E_uwAIFatalInvalidAccessToField, "Invalid access to field",
|
|
E_uwAIFatalInvalidAccessToDsgVar,"Invalid access to dsgvar",
|
|
E_uwAIFatalInvalidAccessToFieldOrDsgVar,"Invalid access to dsgvar or field",
|
|
E_uwAIFatalNotAGoodAction, "Not a good action to change to",
|
|
E_uwAIFatalWrongTypeParamAction, "Wrong type for action's parameter",
|
|
E_uwAIFatalNotValidFunction, "This is not a valid Function",
|
|
E_uwAIFatalNotValidProcedure, "This is not a valid Procedure",
|
|
E_uwAIFatalNotValidDsgVarId, "Wrong Variable Designer ID",
|
|
E_uwAIFatalNotValidOperator, "This is not a valid operator",
|
|
E_uwAIFatalNotValidCondition, "This is not a valid condition",
|
|
E_uwAIFatalUnknownOperator, "Unknown operator",
|
|
E_uwAIFatalInvalidParameter,"A function parameter is invalid",
|
|
E_uwAIFatalInvalidWPValue, "WP handle is invalid",
|
|
E_uwAIFatalArrayAlreadyFull,"Attempt to add an element to the array though it is already full",
|
|
E_uwAIFatalArrayEmpty,"Attempt to access to an element in the array though it is empty",
|
|
E_uwAIFatalAssertionFailure,"Assertion failure",
|
|
E_uwAIFatalTypeLinkInvalid,"The type of the link is invalid",
|
|
E_uwAIFatalDynTypeLinkInvalid,"The dynamic type of the link is invalid",
|
|
E_uwAIFatalWayPositionInvalid,"The position specified for the access of a WP or a link in the way is invalid",
|
|
E_uwAIFatalWayFirstLinkMustBeLine,"The first link must be a line (only for mode NbrOfLink = NbrOf WP)",
|
|
E_uwAIFatalNullVectorNotAllowed,"Null vector is not allowed for this function",
|
|
E_uwAIFatalBadEntryAIModel, "Bad entry in AIModel Script",
|
|
E_uwAIWrongOperatorInLeftAffect, "Wrong operator in left parameter of affect function",
|
|
E_uwAIDivisionByZero,"Division by zero",
|
|
E_uwAIFatalNoDynamics, "No Dynamics found",
|
|
E_uwAIFatalUnknownButton, "Button not defined",
|
|
E_uwAIFatalReferenceNotLoaded,"Reference not loaded",
|
|
E_uwAIFatalScriptError, "There was an error in the script",
|
|
E_uwAIFatalNotMSCamera, "Super Object is not a camera",
|
|
E_uwAIFatalInvalidUseOfUltraOperator, "Invalid use of Ultra operator",
|
|
E_uwAIFatalInvalidModelCast,"Invalid model cast",
|
|
E_uwAIFatalInvalidDsgvarSaveType,"Invalid save type for designer variable",
|
|
#endif /*__FATAL_ERR_AI__*/
|
|
#ifdef __WARNING_ERR_AI__
|
|
/* ----------------*/
|
|
E_uwAIWarningCanNotFree, "Memory problem for free",
|
|
E_uwAIWarningTruncateAffectation, "Strange a (out of range) designer variable has been truncated ",
|
|
E_uwAIWarningBadType,"Field or variable designer have not correct type to store the passed value",
|
|
E_uwAIWarningChangeToCurrentComport, "Change comport to the same comport",
|
|
E_uwAIWarningCycleComport, "Cycle in comportement changing",
|
|
E_uwAIWarningArrayCyclingComportTooSmall, "The array for cycling comport is too small",
|
|
E_uwAIWarningExecuteActionInt, "The execute action has interrupted",
|
|
E_uwAIWarningComportOfAnotherPerso,"This comport doesn't belong to perso",
|
|
E_uwAIDebugDynamicAllocation,"Debug version : dynamic allocation in bloc AI (don't forget to increase the bloc)",
|
|
E_uwAIWarningScriptError ,"This is a warning about AI script",
|
|
E_uwAIWarningEngineGoto,"Wrong use of EngineGoto",
|
|
E_uwAIWarningChannelNotControlled, "Call of a repositionning procedure on an uncontrolled channel",
|
|
#if defined(ACTIVE_EDITOR) /* usefull for ACTIVE_1STPASS_CHECKING*/
|
|
E_uwAIWarningUnknownCond ,"Unknown Condition Name",
|
|
E_uwAIWarningUnknownFieldName ,"Unknown Field Name",
|
|
E_uwAIWarningUnknownOperator ,"Unknown Operator Name",
|
|
E_uwAIWarningUnknownFunc ,"Unknown Function Name",
|
|
E_uwAIWarningUnknownProcedure ,"Unknown Procedure name",
|
|
E_uwAIWarningUnknownKeyWord ,"Unknown Keyword name",
|
|
E_uwAIWarningInvalidAction ,"Unknown Action name",
|
|
E_uwAIWarningUnknownNode ,"Unknown Node",
|
|
E_uwAIWarningReferenceNotLoaded,"Reference not loaded",
|
|
E_uwAIWarningWrongParamAction ,"Wrong number of parameter",
|
|
E_uwAIWarningInvalidUseOfUltraOperator,"Invalid use of Ultra operator",
|
|
E_uwAIWarningWrongTypeVar ,"Script Read Problem: The type of the variable is not valid",
|
|
#endif
|
|
|
|
#endif /*__WARNING_ERR_AI__*/
|
|
0xFFFF, "\0"/*fin*/
|
|
};
|
|
#endif /*__DeclareGlobalVariableErrAI_h__*/
|
|
;
|
|
|
|
#undef extern
|
|
|
|
#endif /*__ERROR_STRINGS__*/
|
|
|
|
#ifdef __cplusplus
|
|
};
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /*__ERRAI_H__*/
|