The data structures part of the API will rely upon two linked lists. The enumerated values and constants will go into a linked list of elements, each element containing a name, a type (integer or string) and the value of the linked constant. Structure definitions will be stored as a list of structures, each structure being defined as a linked list of elements where every element is a name and type. Actual data storage is simply a memory allocation based upon the amount of storage described by that elements structure defintion - strings will be allocated as NULL pointers and if an instance declares the string value then storage for the pointer can be allocated then.
For all of you C/C++ programmers out there, a few structure definitions will help clarify all of this.
Every entry in the list of constants will be an instance of the following data structure:
typedef _constant
{
U8 *name;
union
{
S32 int_constant;
F32 float_constant;
U8 *string_constant;
};
}Constant;
The structure definitions list is slightly more complicated because each entry will be for a structure of unknown length since the user is defining the data structure. The structure def. list will then actually be a list of lists, each data structure actually being a list of elements defined by this data structure:
typedef _struct_ele
{
U8 *ele_name;
U32 data_type;
}StructEle;
Once the definitions file has been read and the above elements have been created then it's time to parse the actual game data. The game data file should just be a series of structures which can be parsed by matching what the data definition should be and then the fields that are actually defined after initializing the structure with the contents of any default definition of that structure that the user has defined.
Well, Big$hot 1.4a has shipped and the Data Lump has more or less been defined... I think it's time to actually get down to implementing. I'll post something after implementing to let y'all know how it went.
Peace-out,
L.
No comments have been provided.
