Improve handling of KeyValueData in FM and make it compatible with Ham

- KVD_Wrapper compatibility with Ham by making |&kvdw == &kvdw.kvd|
- Replaces g_kvd_hook with a generic g_kvd_ext to support raw KVD from Ham
- Adds create_kvd() and free_kvd() so plugins have something to feed Ham with
This commit is contained in:
Valentin Grünbacher
2015-04-14 14:34:18 +02:00
parent 0bfc04bb14
commit 8172519389
6 changed files with 93 additions and 26 deletions

View File

@ -29,13 +29,16 @@ void OnAmxxAttach()
MF_AddNatives(glb_natives);
MF_AddNatives(ext2_natives);
MF_AddNatives(misc_natives);
g_kvd_2.szClassName = "";
g_kvd_2.szKeyName = "";
g_kvd_2.szValue = "";
g_kvd_glb.kvd = &g_kvd_2;
g_kvd_glb.kvd.szClassName = const_cast<char *>(g_kvd_glb.cls.chars());
g_kvd_glb.kvd.szKeyName = const_cast<char *>(g_kvd_glb.key.chars());
g_kvd_glb.kvd.szValue = const_cast<char *>(g_kvd_glb.val.chars());
g_kvd_glb.kvd.fHandled = 0;
}
extern CStack<TraceResult *> g_FreeTRs;
extern ke::Vector<KVD_Wrapper *> g_KVDWs;
extern ke::Vector<KVD_Wrapper *> g_FreeKVDWs;
void OnAmxxDetach()
{
while (!g_FreeTRs.empty())
@ -43,6 +46,12 @@ void OnAmxxDetach()
delete g_FreeTRs.front();
g_FreeTRs.pop();
}
while (!g_KVDWs.empty())
delete g_KVDWs.popCopy();
while (!g_FreeKVDWs.empty())
delete g_FreeKVDWs.popCopy();
}
int GetHullBounds(int hullnumber, float *mins, float *maxs);