|
UFO: Alien Invasion
|
Handles definition of entities, parsing them from entities.ufo. More...

Go to the source code of this file.
Data Structures | |
| union | int_float_tu |
| struct | entityKeyRange_t |
| struct | entityKeyDef_t |
| struct | entityDef_t |
Macros | |
| #define | ED_MAX_DEFS 64 |
| #define | ED_ERROR -1 |
| #define | ED_OK 1 |
| #define | ED_OPTIONAL (1<<0) |
| #define | ED_MANDATORY (1<<1) |
| #define | ED_ABSTRACT (1<<2) |
| #define | ED_TYPE_FLOAT (1<<3) |
| #define | ED_TYPE_INT (1<<4) |
| #define | ED_TYPE_STRING (1<<5) |
| #define | ED_DEFAULT (1<<6) |
| #define | ED_MODE_TYPE (1<<7) |
| #define | ED_RANGE (1<<8) |
| #define | ED_INSIST_POSITIVE (1<<9) |
| #define | ED_TYPE_BOOL (1<<10) |
| #define | ED_CONCRETE (ED_OPTIONAL | ED_MANDATORY) |
| #define | ED_KEY_TYPE (ED_TYPE_FLOAT | ED_TYPE_INT | ED_TYPE_STRING | ED_TYPE_BOOL) |
Functions | |
| int | ED_GetIntVector (const entityKeyDef_t *kd, int v[], const int n) |
| parses a value from the definition | |
| int | ED_Check (const char *classname, const char *key, const char *value) |
| tests if a value string matches the type for this key. Also checks the value against the range, if one was defined. | |
| int | ED_CheckKey (const entityKeyDef_t *kd, const char *value) |
| as ED_Check, but where the entity and key are known, so takes different arguments. | |
| const entityDef_t * | ED_GetEntityDef (const char *classname) |
| searches for the parsed entity def by classname | |
| const entityKeyDef_t * | ED_GetKeyDef (const char *classname, const char *keyname, const int abstract) |
| searches for the parsed key def | |
| const entityKeyDef_t * | ED_GetKeyDefEntity (const entityDef_t *ed, const char *keyname, const int abstract) |
| searches for the parsed key def, when the entity def is known | |
| int | ED_Parse (const char *data_p) |
| const char * | ED_GetLastError (void) |
| void | ED_Free (void) |
Variables | |
| int | numEntityDefs |
| entityDef_t | entityDefs [ED_MAX_DEFS+1] |
Handles definition of entities, parsing them from entities.ufo.
Definition in file entitiesdef.h.
| #define ED_ABSTRACT (1<<2) |
flag and parse mode, radiant use exclusively, should not be in .map file as a key
Definition at line 37 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), ED_FindKeyDefInArray(), ED_GetKeyDefEntity(), ED_PairParsed(), and ED_ParseEntities().
| #define ED_CONCRETE (ED_OPTIONAL | ED_MANDATORY) |
flags indicating that this is a real key for use in a map file
Definition at line 47 of file entitiesdef.h.
| #define ED_DEFAULT (1<<6) |
Definition at line 41 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
| #define ED_ERROR -1 |
Definition at line 32 of file entitiesdef.h.
Referenced by Check_InfoStartAligned(), Check_InitEntityDefs(), CheckEntities(), ED_Check(), ED_ParseEntities(), and ED_ParseType().
| #define ED_INSIST_POSITIVE (1<<9) |
the type insists that the values are unsigned
Definition at line 44 of file entitiesdef.h.
Referenced by ED_CheckNumericType(), ED_ParseType(), and ED_ProcessRanges().
| #define ED_KEY_TYPE (ED_TYPE_FLOAT | ED_TYPE_INT | ED_TYPE_STRING | ED_TYPE_BOOL) |
Definition at line 48 of file entitiesdef.h.
Referenced by ED_CheckKey(), and ED_ProcessRanges().
| #define ED_MANDATORY (1<<1) |
flag and parse mode. for entityKeyDef_t flags. entities of this type are not valid without this key. also a parse mode
Definition at line 36 of file entitiesdef.h.
Referenced by CheckEntities(), ED_Block2Constant(), ED_Constant2Block(), ED_PairParsed(), and ED_ParseEntities().
| #define ED_MAX_DEFS 64 |
Definition at line 30 of file entitiesdef.h.
Referenced by ED_ParseEntities().
| #define ED_MODE_TYPE (1<<7) |
flag parse mode indicating that a type is being parsed
Definition at line 42 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
| #define ED_OK 1 |
Definition at line 33 of file entitiesdef.h.
Referenced by ED_AllocEntityDef(), ED_AllocRange(), ED_CheckDefaultTypes(), ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_GetIntVector(), ED_GetIntVectorFromString(), ED_PairParsed(), ED_Parse(), ED_ParseEntities(), ED_ParseType(), ED_ProcessRanges(), and TEST_F().
| #define ED_OPTIONAL (1<<0) |
flag and parse mode
Definition at line 35 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
| #define ED_RANGE (1<<8) |
Definition at line 43 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
| #define ED_TYPE_BOOL (1<<10) |
Definition at line 45 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_Constant2Type(), ED_ProcessRanges(), and ED_Type2Constant().
| #define ED_TYPE_FLOAT (1<<3) |
Definition at line 38 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_Constant2Type(), ED_ProcessRanges(), and ED_Type2Constant().
| #define ED_TYPE_INT (1<<4) |
Definition at line 39 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_Constant2Type(), ED_ParseType(), ED_ProcessRanges(), and ED_Type2Constant().
| #define ED_TYPE_STRING (1<<5) |
Definition at line 40 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_Constant2Type(), ED_ParseType(), ED_ProcessRanges(), and ED_Type2Constant().
| int ED_Check | ( | const char * | classname, |
| const char * | key, | ||
| const char * | value ) |
tests if a value string matches the type for this key. Also checks the value against the range, if one was defined.
Definition at line 357 of file entitiesdef.cpp.
References ED_CheckKey(), ED_ERROR, ED_GetKeyDef(), and key.
| int ED_CheckKey | ( | const entityKeyDef_t * | kd, |
| const char * | value ) |
as ED_Check, but where the entity and key are known, so takes different arguments.
Definition at line 372 of file entitiesdef.cpp.
References ED_CheckNumericType(), ED_KEY_TYPE, ED_OK, ED_RETURN_ERROR, ED_TEST_RETURN_ERROR, ED_TYPE_BOOL, ED_TYPE_FLOAT, ED_TYPE_INT, ED_TYPE_STRING, and entityKeyDef_t::flags.
Referenced by CheckEntities(), ED_Check(), and ED_CheckDefaultTypes().
Definition at line 827 of file entitiesdef.cpp.
References entityDefs, entityKeyRange_t::fArr, i, entityKeyRange_t::iArr, entityKeyDef_t::name, numEntityDefs, and entityKeyRange_t::str.
Referenced by Check_Free(), and TEST_F().
| const entityDef_t * ED_GetEntityDef | ( | const char * | classname | ) |
searches for the parsed entity def by classname
Definition at line 815 of file entitiesdef.cpp.
References entityDef_t::classname, entityDefs, lastErr, entityDef_t::numKeyDefs, and Q_streq.
Referenced by CheckEntities(), ED_GetKeyDef(), and ED_ParseEntities().
| int ED_GetIntVector | ( | const entityKeyDef_t * | kd, |
| int | v[], | ||
| const int | n ) |
parses a value from the definition
| kd | the key definition to parse from | |
| [out] | v | the array of int to put the answer in it must have enough space for n elements. |
| n | the number of elements expected in the vector |
Definition at line 208 of file entitiesdef.cpp.
References entityKeyDef_t::desc, ED_GetIntVectorFromString(), ED_OK, ED_PASS_ERROR, and v.
Referenced by Check_InfoStartAligned().
| const entityKeyDef_t * ED_GetKeyDef | ( | const char * | classname, |
| const char * | keyname, | ||
| const int | abstract ) |
searches for the parsed key def
| classname | The name, eg. "func_door" |
| keyname | The key we are looking for |
| abstract | send abstract to find an abstract key with this name |
Definition at line 775 of file entitiesdef.cpp.
References ED_GetEntityDef(), and ED_GetKeyDefEntity().
Referenced by ED_Check().
| const entityKeyDef_t * ED_GetKeyDefEntity | ( | const entityDef_t * | ed, |
| const char * | keyname, | ||
| const int | abstract ) |
searches for the parsed key def, when the entity def is known
| ed | The list of keys for the entity |
| keyname | The key we are looking for |
| abstract | send a nonzero value if the abstract (radiant - not in any block) version of the key is required |
Definition at line 789 of file entitiesdef.cpp.
References entityDef_t::classname, ED_ABSTRACT, entityKeyDef_t::flags, entityDef_t::keyDefs, lastErr, entityKeyDef_t::name, and Q_streq.
Referenced by Check_InfoStartAligned(), CheckEntities(), and ED_GetKeyDef().
| const char * ED_GetLastError | ( | void | ) |
Definition at line 763 of file entitiesdef.cpp.
References lastErr.
Referenced by Check_InfoStartAligned(), Check_InitEntityDefs(), and CheckEntities().
| int ED_Parse | ( | const char * | data_p | ) |
parses entity definitions from entities.ufo
Definition at line 738 of file entitiesdef.cpp.
References ED_CheckDefaultTypes(), ED_OK, ED_ParseEntities(), ED_PASS_ERROR, ED_ProcessRanges(), ED_TEST_RETURN_ERROR, entityDefs, lastErr, numEntityDefs, and OBJZERO.
Referenced by Check_InitEntityDefs(), and TEST_F().
|
extern |
Definition at line 46 of file entitiesdef.cpp.
Referenced by Check_Stats(), ED_AllocEntityDef(), ED_CheckDefaultTypes(), ED_Free(), ED_GetEntityDef(), ED_Parse(), ED_ProcessRanges(), and TEST_F().
|
extern |
Definition at line 45 of file entitiesdef.cpp.
Referenced by Check_InitEntityDefs(), Check_Stats(), ED_Free(), ED_Parse(), ED_ParseEntities(), and TEST_F().