Quote:
Originally Posted by XAD
THIS is what I mean with back-compatible, that you can use the previous version of the mod implemented interface...
. . .
So Valve doesn't have to update HL2DM to version 2 as it will still work. Updating CSS was probably the reasons to why they updated the interface to version 2, due to all request by plugin developers and maybee because they don't want us to make to ugly hacks directly in the data structures (as "we" did for CS1.6 to change health and other stuff).
|
First: the mods are backward compatible, but the interfacing system is poorly implemented, not in the sense that it's a poor choice/idea, but rather, how we get interfaces is poorly implemented. I'm given one interface version, and if that doesn't work, I can't use it. But what if I need that interface?
Then, in that case, I have to specifically go through every version from the latest to the first and try to load each one. Isn't that a bit counter productive? I mean, I have redesigned my interface class so that it automatically will run through every possible version number until it gets a valid pointer, but, this shouldn't be done by every plugin: it should be done by the mod/engine.
I think Valve is ignoring their interfaces, and you say they aren't, but, why should I have to take control of the versioning system of source because a mod author didn't upgrade the API? Or if the mod is out of development?
If I want to run it in that mod, I either have to build my plugin from an older set of headers, or waste cpu cycles on a useless function that could be optimized properly inside somewhere else (not a plugin):
Code:
private:
void CreateVersionSet( char *szVersion )
{
std::string *pString = new std::string;
std::string InterfaceName;
std::string VersionNumber;
pString->assign(szVersion);
InterfaceName = pString->substr(0, pString->size() - 3);
VersionNumber = pString->substr(pString->size() - 3, 3);
vec.push_back(pString);
unsigned int uVersion = (unsigned int) atoi( VersionNumber.c_str() );
if (uVersion != 1)
{
while ((--uVersion) > 0)
{
std::string NewVersion = std::string(3, ' ');
NewVersion[3] = 0;
NewVersion[2] = '0' + (uVersion % 10);
NewVersion[1] = (uVersion > 9) ? ((((uVersion - (uVersion % 10)) % 100) / 10) + '0') : '0';
NewVersion[0] = (uVersion > 99) ? (((uVersion - (((uVersion - (uVersion % 10)) % 100) / 10)) / 100) + '0') : '0';
pString = new std::string;
pString->insert(0, InterfaceName);
pString->insert(InterfaceName.size(), NewVersion);
vec.push_back(pString);
}
}
}
std::vector<std::string*> vec;
//I will post the macro that accompanies this code if people want it, in fact, I'll post my entire header in a separate topic if necessary
That's a huge waste of cycles (probably more than someone who has a faster way of returning a list like this) when you consider how many interfaces I have to check. (And yes, this should be optimized more, like, trying to load an interface before building the list, and maybe other things, but I've been so caught up in other work that this is what I threw together real fast.)
Honestly, I love the idea with the interface system, but it's ugly right now. It is backward compatible, but only if you force it to be compatible: CSS works in both plugin versions, HL2DM only works with older plugin versions, unless you use a hack like mine.