Extend MQ2DataTypes.h to support all class /declares in macros
Posted: Tue Dec 25, 2018 2:15 am
We should be able to effectively /declare any valid MQ2 type in macros by changing the FromString in most the classes.
That way /declare This spell outer Complete Heal would actually be referencing the Complete Heal spelltype and you can This.Mana, This.Range, etc.
Per Renji, code change should look something like (using MQ2SpellType as an example):
from:
to:
then effectively repeated with the proper returns for all other classes in MQ2DataTypes.h
Brainiac thinks this should probably happen in base macroquest rather than in the mmobugs version, and I am inclined to agree so i am sharing here.
That way /declare This spell outer Complete Heal would actually be referencing the Complete Heal spelltype and you can This.Mana, This.Range, etc.
Per Renji, code change should look something like (using MQ2SpellType as an example):
from:
Code: Select all
bool FromString(MQ2VARPTR &VarPtr, PCHAR Source)
{
return false;
}
Code: Select all
bool FromString(MQ2VARPTR &VarPtr, PCHAR Source)
{
if (PSPELL pSpell = GetSpellByName(Source))
{
memcpy(VarPtr.Ptr, pSpell, sizeof(SPELL));
return true;
}
return false;
}
Brainiac thinks this should probably happen in base macroquest rather than in the mmobugs version, and I am inclined to agree so i am sharing here.