the changes purposed in there hare aimed to the 0.7x version, as to leave us some time to prepare beforehand (I can't access cvs, for example)
the quick and dirty bits:
adding a
Code: Select all
cons tvoid *extendedRequest(int request ID, const void *data);
to have a two way extensible model.
those functions can be used to extend the request adding new possibility without breaking code compatibility, and then addnig the function back into the interface at a major release (for example, at the 0.8x)
example:
ai extension for get a unit position (I know it's already there, it's just an example)
Code: Select all
#define REQ_UNITPOS
...
const void *extendedRequest(int request ID, const void *data) {
switch(requestID) {
case REQ_UNITPOS:
int unitid=*((int *)data);
float3 pos=somefunctiontogetpos(unitid);
return *pos;
break;
default: return NULL;
}
}
in the ai:
Code: Select all
float3 pos=*extendedRequest(REQ_UNITPOS,&unitid);
it's not the cleanest implementation, but the easyest to build. at the next major release, you can just put the swich function in the interface and prune out unnecessaries one, restarting te process so you can put only stable code in the interface and keep a way to add on the fly functionality without breaking dll compatibility.
As for a major release, we could cope easily with the addition mapping the extended request on the functions itself.
or you can leave the request as extended request, or take an entire different direction applaing this metodology to all functions (undesiderable, also known as the big switch of death) or extend it furter to use a tree request structure, using a pair of id in the interface ex:
Code: Select all
float3 pos=*extendedRequest(DOMAIN_UNIT, REQ_POSITION, &unitid)