BUG: /itemtarget CTD

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

Moderator: MacroQuest Developers

User avatar
FreQuency
a hill giant
a hill giant
Posts: 215
Joined: Tue Sep 23, 2003 6:03 pm

BUG: /itemtarget CTD

Post by FreQuency » Wed Nov 05, 2003 3:14 am

/itemtarget works fine a long as it recieves an item
Ex: /itemtarget *Green
will target a groundspawn if there are spawns
if there are none with matching *green i get a CTD

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Nov 05, 2003 4:13 am

Confirmed that this is a bug sometimes. Chasing it down...

The crash is somewhere in eqgame. EQADDR_TARGET was dereferenced and the ACTORINFO pointer is loaded. EQADDR_TARGET points to EnviroTarget and we just zeroed it out in ItemTarget(). Guess what happens when the ACTORINFO pointer is dereferenced?

CVSed. Too lazy to zip:

Code: Select all

diff -w -u -r1.51 -r1.52
--- EQLib_Commands.cpp  5 Nov 2003 01:06:39 -0000       1.51
+++ EQLib_Commands.cpp  5 Nov 2003 09:51:33 -0000       1.52
@@ -246,6 +246,8 @@
         WriteChatBuffer(szBuffer,USERCOLOR_DEFAULT);
                if (stricmp(Arg2,"notarget") && EQADDR_TARGET) *EQADDR_TARGET =
&EnviroTarget;
     } else {
+        if (EQADDR_TARGET && (*EQADDR_TARGET == &Enviroarget))
+            *EQADDR_TARGET = NULL;
         sprintf(szBuffer,"Couldn't find '%s'.",szLine);
         strcpy(gLastError,"ITEM_NOTFOUND");
         WriteChatBuffer(szBuffer,CONCOLOR_RED);

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Wed Nov 05, 2003 8:38 am

and to lazy to testcompile? ;)

gives errors, but I fixed in cvs, and updated zip as well

&Enviroarget)) missed a "T"

But great job on finding the bug! ;) I was looking for that ctd myself, but couldnt figure out why.
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.