Bug with deities/deity[#n] when an item is usable by tunare

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

plure
orc pawn
orc pawn
Posts: 16
Joined: Tue Mar 15, 2016 8:24 am

Bug with deities/deity[#n] when an item is usable by tunare

Post by plure » Wed Jan 17, 2018 12:07 am

on line 6864 the code in MQ2DataTypes.cpp:

Code: Select all

case Deities:
        Dest.DWord = 0;
        // count bits
        cmp = GetItemFromContents(pItem)->Diety;
        for (N = 0; N < 15; N++)
        {
            if (cmp&(1 << N))
                Dest.DWord++;
        }
        Dest.Type = pIntType;
        return true;
    case Deity:
        if (ISINDEX())
        {
            if (ISNUMBER())
            {
                DWORD Count = GETNUMBER();
                if (!Count)
                    return false;
                cmp = GetItemFromContents(pItem)->Diety;
                for (N = 0; N < 15; N++)
                {
                    if (cmp&(1 << N))
                    {
                        Count--;
                        if (Count == 0)
                        {
                            Dest.DWord = N + 200;
                            Dest.Type = pDeityType;
                            return true;
                        }
                    }
                }
            }
            else
            {
                // by name
                cmp = GetItemFromContents(pItem)->Diety;
                for (N = 0; N < 16; N++) {
                    if (cmp&(1 << N)) {
                        if (!_stricmp(GETFIRST(), pEverQuest->GetDeityDesc(N + 200))) {
                            Dest.DWord = N + 200;
                            Dest.Type = pDeityType;
                            return true;
                        }
                    }
                }
                return false;
            }
        }
        return false;
needs to be changed to:

Code: Select all

	case Deities:
		Dest.DWord = 0;
		// count bits
		cmp = GetItemFromContents(pItem)->Diety;
		for (N = 0; N < 16; N++)
		{
			if (cmp&(1 << N))
				Dest.DWord++;
		}
		Dest.Type = pIntType;
		return true;
	case Deity:
		if (ISINDEX())
		{
			if (ISNUMBER())
			{
				DWORD Count = GETNUMBER();
				if (!Count)
					return false;
				cmp = GetItemFromContents(pItem)->Diety;
				for (N = 0; N < 16; N++)
				{
					if (cmp&(1 << N))
					{
						Count--;
						if (Count == 0)
						{
							Dest.DWord = N + 200;
							Dest.Type = pDeityType;
							return true;
						}
					}
				}
			}
			else
			{
				// by name
				cmp = GetItemFromContents(pItem)->Diety;
				for (N = 0; N < 16; N++) {
					if (cmp&(1 << N)) {
						if (!_stricmp(GETFIRST(), pEverQuest->GetDeityDesc(N + 200))) {
							Dest.DWord = N + 200;
							Dest.Type = pDeityType;
							return true;
						}
					}
				}
				return false;
			}
		}
		return false;
Tunare is the last deity and was getting missed.

SwiftyMUSE
Developer
Developer
Posts: 1205
Joined: Tue Sep 23, 2003 10:52 pm

Re: Bug with deities/deity[#n] when an item is usable by tunare

Post by SwiftyMUSE » Wed Jan 17, 2018 1:48 am

I've sent the merged code to EqMule for next zip (hopefully tomorrow's patch).
PayPal: Donate to SwiftyMUSE
Bitcoin: 1LuQ6YcEAWxF3fm9yWMiro4K582je7364V
Krono: PM me

dont_know_at_all wrote:Gee, if only there was a way to correctly report a crash...