• Welcome to Valhalla Legends Archive.
 

[C++] SID_AUTH_INFO problem

Started by Okee, July 10, 2005, 05:56 PM

Previous topic - Next topic

Okee

I've never had a problem with SID_AUTH_INFO before, but now I am and am not sure what's wrong with it. It's the same as it is in some of my other projects and they work. Anyways, here's my code...


void SendAuthInfo(SOCKET sckBNET)
{
if(szLocalAccountInfo.Connected) {
Print(hBNChat, WHITE, "Sending authentication info for %s\n", szLocalAccountInfo.szGameAbbr);
dBuf.add((int)0);
dBuf.add((int)'IX86');
dBuf.add(szLocalAccountInfo.szGameAbbr);
dBuf.add((int)szLocalAccountInfo.lVerByte);
dBuf.add((int)0);
dBuf.add((int)0);
dBuf.add((int)480);
dBuf.add((int)1033);
dBuf.add((int)1033);
dBuf.add("USA");
dBuf.add("United States");

SendPacket(sckBNET, SID_AUTH_INFO);
} else {
Print(hBNChat, RED, "Error while connecting\n");
}
}


and here's a packet log of the same function being sent to asia.battle.net -

Quote
1  Hide  Hide  1  Send 
0000  01                                                 .

2  Hide  Hide  59  Send 
0000  FF 50 3B 00 00 00 00 00 36 38 58 49 52 41 54 53    .P;.....68XIRATS
0010  00 CD 00 00 00 00 00 00 00 00 00 00 00 E0 01 00    ................
0020  00 09 04 00 00 09 04 00 00 55 53 41 00 55 6E 69    .........USA.Uni
0030  74 65 64 20 53 74 61 74 65 73 00                   ted States.


Anyone able to tell what's not being formed right by the packet log, or the function itself? Maybe the version byte? I'm unsure.

UserLoser.

szLocalAccountInfo.szGameAbbr is a string. add is taking in the string and adding it to the outgoing buffer, but also adding a null terminator.   Store the game tag in an integer, not a string.

Okee

Thanks that fixed it. I made a simple function for it. Here it is..


int LocalAccountInfo::iGameAbbr(void) {
int iAbbr = 'STAR';

if(!strcmp(szLocalAccountInfo.szGameAbbr, "RATS"))
int iAbbr = 'STAR';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "PXES"))
int iAbbr = 'SEXP';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "NB2W"))
int iAbbr = 'W2BN';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "VD2D"))
int iAbbr = 'D2DV';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "PX2D"))
int iAbbr = 'D2XP';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "3RAW"))
int iAbbr = 'WAR3';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "PX3W"))
int iAbbr = 'W3XP';

return iAbbr;
}

Eric

... or you could just, as UserLoser said, store them properly to begin with and eliminate the need for such a pointless procedure.

Okee

I could, except that hours of work on my bots UI revolve around that variable. I'd have to change a lot to fix that. I'm really just trying to get it functional before I begin to work on the efficeincy of it.

Kp

There's something seriously wrong with your design if it'd take you hours to update all the code associated with a version checking variable.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Okee

Probably - but then again, I am dealing with my first ever UI for a bot written in C++.

MyndFyre

Quote from: Okee on July 10, 2005, 08:10 PM
Probably - but then again, I am dealing with my first ever UI for a bot written in C++.
What does a user interface have to do with version checking code?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Okee

Well, I have quite a bit of functions and procedures that print certain things to list boxes, or drop down menus pertaining to the current product selected. A large portion of them revolve around my char variable that contains the product abbreviation. I know I could probably change it all the work with an int variable in less than 'hours', but I was just blowing it out of proportion. I'm just saying that quick fix worked faster than going back and making all my strcmp's, and other things dealing with char's, compatible with an int.

Looking back on it I do realize I did it in a sort of non-efficient manner - but it's just how it happened. :-\

Anywho, I appreciate any and all help I've received so far, no matter how strange and far from the norm it might have seemed.