MQ2ItemDisplay.cpp

Moderator: MacroQuest Developers

Lacky
a hill giant
a hill giant
Posts: 174
Joined: Mon Nov 22, 2004 4:02 pm

MQ2ItemDisplay.cpp

Post by Lacky » Fri Jun 17, 2005 12:19 am

There is an error with the /inote stuff in MQ2ItemDisplay when compiling ISXEQ. To get around it either delete them before building ISXEQItemDisplay or do....

Code: Select all

#ifndef ISXEQ
void Comment(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   CHAR Arg[MAX_STRING] = {0}; 
   CHAR ItemNo[MAX_STRING] = {0}; 
.....CodeBlahBlah..Old Ifndef was before this line....
// Called once, when the plugin is to initialize
.....moreblah....
	RemoveCommand("/inote");
}
#endif
That code is at the bottom of the file. You are just moving the #ifndef ISXEQ up about 20 lines.

The next code is around line 149

Code: Select all

#ifndef ISXEQ
	 GetPrivateProfileString("Notes",temp,"",temp2,MAX_STRING,INIFileName); 
     if (strlen(temp2)>0) 
     { 
        sprintf(temp,"Note: %s<br>",temp2); 
        strcat(out, temp); 
     }
#endif
Just add the ifndef and endif around that code.
Ok I guess that was it thought there was a third for some reason :}

Thanks to dont_know_at_all for the help and telling me what to fix and stuff.
So I am wrong, Sue me.

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 » Fri Jun 17, 2005 12:50 am

The was a third spot -- remove these lines:

Code: Select all

AddCommand("/inote",Comment);

Code: Select all

RemoveCommand("/inote");
--
<Thedude> I have to say your there retarded one.

Lacky
a hill giant
a hill giant
Posts: 174
Joined: Mon Nov 22, 2004 4:02 pm

Post by Lacky » Fri Jun 17, 2005 1:01 am

Actually with the #ifndef ISXEQ on the last chunk of code moved up 20 or so lines it fixes that problem with out removing it.
So I am wrong, Sue me.

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 » Fri Jun 17, 2005 1:06 am

Oh, I see. They already out. Never mind.
--
<Thedude> I have to say your there retarded one.

Lacky
a hill giant
a hill giant
Posts: 174
Joined: Mon Nov 22, 2004 4:02 pm

Hmm

Post by Lacky » Wed Jul 06, 2005 12:18 am

Looking at this I think I took too much out when I first did it. Might explain some wierdthings.
So I am wrong, Sue me.

Lacky
a hill giant
a hill giant
Posts: 174
Joined: Mon Nov 22, 2004 4:02 pm

Post by Lacky » Wed Jul 06, 2005 12:42 am

line 350 on should look like this in the mq2itemdisplay

Code: Select all

#ifndef ISXEQ 
void Comment(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   CHAR Arg[MAX_STRING] = {0}; 
 CHAR ItemNo[MAX_STRING] = {0}; 
   CHAR Comment[MAX_STRING] = {0}; 
   CHAR szTemp[MAX_STRING] = {0}; 
   GetArg(Arg,szLine,1); 
   GetArg(ItemNo,szLine,2); 
   GetArg(szTemp,szLine,3); 
   for(int i=4;strlen(szTemp);i++){ 
      strcat(Comment,szTemp); 
      strcat(Comment," "); 
      GetArg(szTemp,szLine,i); 
   } 
   int itemno = atoi(ItemNo); 
 
   if (stricmp(Arg,"add") && stricmp(Arg,"del")) 
   { 
      WriteChatColor("Use: /inote <add|del> <itemno> \"Comment\"",CONCOLOR_YELLOW); 
      return; 
   } 
   if (itemno <= 0) 
   { 
      WriteChatColor("Invalid item number"); 
      WriteChatColor("Use: /inote <add|del> <itemno> \"Comment\"",CONCOLOR_YELLOW); 
      return; 
   } 
   if (strlen(Comment)==0 || !stricmp(Arg,"del")) 
   { 
      sprintf(szTemp,"%07d",itemno); 
      WritePrivateProfileString("Notes",szTemp,"",INIFileName); 
      return; 
   } 
 
   if (!stricmp(Arg,"add")) 
   { 
      sprintf(szTemp,"%07d",itemno); 
      WritePrivateProfileString("Notes",szTemp,Comment,INIFileName); 
      return; 
   } 
} 
#endif


// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2ItemDisplay");

	// Add commands, macro parameters, hooks, etc.

//   EasyClassDetour(CItemDisplayWnd__SetItem,ItemDisplayHook,SetItem_Detour,void,(class EQ_Item *, bool),SetItem_Trampoline);
	EzDetour(CItemDisplayWnd__SetItem,ItemDisplayHook::SetItem_Detour,ItemDisplayHook::SetItem_Trampoline);
//   EasyClassDetour(CItemDisplayWnd__SetSpell,ItemDisplayHook,SetSpell_Detour,void,(int SpellID,bool HasSpellDescr,int),SetSpell_Trampoline);
	EzDetour(CItemDisplayWnd__SetSpell,ItemDisplayHook::SetSpell_Detour,ItemDisplayHook::SetSpell_Trampoline);
    #ifndef ISXEQ 
	AddCommand("/inote",Comment); 
    #endif
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2ItemDisplay");

	// Remove commands, macro parameters, hooks, etc.
	RemoveDetour(CItemDisplayWnd__SetItem);
	RemoveDetour(CItemDisplayWnd__SetSpell);
    #ifndef ISXEQ 
	RemoveCommand("/inote");
    #endif
}
And Line 149-156 will become this

Code: Select all

     #ifndef ISXEQ 
	 GetPrivateProfileString("Notes",temp,"",temp2,MAX_STRING,INIFileName); 
     if (strlen(temp2)>0) 
     { 
        sprintf(temp,"Note: %s<br>",temp2); 
        strcat(out, temp); 
     }  
     #endif
This compiled with 0 errors for me. Will actually check to see if its working now :)
So I am wrong, Sue me.

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 10:05 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 11:18 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 11:19 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 11:56 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 11:57 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 11:58 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: MQ2ItemDisplay.cpp

Post by xyilla » Sun May 25, 2025 11:59 pm