Extend MQ2DataTypes.h to support all class /declares in macros

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

PeteSampras
a snow griffon
a snow griffon
Posts: 322
Joined: Sat Dec 15, 2007 8:56 pm

Extend MQ2DataTypes.h to support all class /declares in macros

Post by PeteSampras » 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:

Code: Select all

	bool FromString(MQ2VARPTR &VarPtr, PCHAR Source)
	{
		return false;
	}
to:

Code: Select all

    bool FromString(MQ2VARPTR &VarPtr, PCHAR Source)
    {
        if (PSPELL pSpell = GetSpellByName(Source))
        {
            memcpy(VarPtr.Ptr, pSpell, sizeof(SPELL));
            return true;
        }
        return false;
    }
 
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.