18.01.2008, 20:12:09
No. This is actually easing up your work - PD would define a function format for each specific event, and you would be responsible for following that format in your functions. E.g. As a replacement for asm blocks, this is very welcome.
However, I would use a "yrpp_dllName.dll" + "yrpp_dllName.ini" instead of a global ini file. Because you just know lusers are going to delete a DLL without unregistering its entries sooner or later, although your code should be able to handle that gracefully in either case. There's also the issue of multiple DLLs hooking up to the same address, which is ew, not to mention the Windows standard INI parsing routine doesn't distinguish between multiple lines with the same address as a key.
Code:
// type definition in PD's headers
typedef void BuildingEnteredCallback(cObject *, cInfantry *);
// function in your source, note the format has to match
void BuildingEntered_tryFreeCapture(cBuilding *target, cInfantry *infiltrator) {
if(target->regurgitates) {
cInfantry::spawn(infiltrator->ID, infiltrator->owningHouse, target->exitCoord); // sample code to spawn a clone of the entering infantry belonging to the infiltrator's house, basically making the building capture free
}
}
However, I would use a "yrpp_dllName.dll" + "yrpp_dllName.ini" instead of a global ini file. Because you just know lusers are going to delete a DLL without unregistering its entries sooner or later, although your code should be able to handle that gracefully in either case. There's also the issue of multiple DLLs hooking up to the same address, which is ew, not to mention the Windows standard INI parsing routine doesn't distinguish between multiple lines with the same address as a key.