• Welcome to Valhalla Legends Archive.
 

[VB] ParseBNCS Stub Class

Started by Joe[x86], December 10, 2005, 03:00 PM

Previous topic - Next topic

Joe[x86]

Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

shout

*pokes Joe in the eye*

Why would you do something like this?

Joe[x86]

Quote from: Topaz on December 10, 2005, 04:09 PM
So... ugly...

Go die in agony. ..!..

Quote from: Shout on December 10, 2005, 04:19 PM
*pokes Joe in the eye*

Why would you do something like this?
Because my old one was ugly! =p
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

dxoigmn

You should be using a Buffer class, not strings to pass contents of packets around. Talk about eww:


Select Case Asc(Mid(sPacket, 2, 1))

shout

#4
Which is uglier, Joe's weird stubby thing or this from my bot I will never finish:


#pragma warning(disable:4996) //strcat is depreciated... works fine for me!
LPCSTR CheckRevision::GetNextFile()
{
PSTR ret = (PSTR)malloc(4000);
memset(ret, 0, 4000);
strcpy(ret, this->path);
switch (this->client)
{
case SEXP:
case STAR:
switch (this->currentfile)
{
case 0:
strcat(ret, "starcraft.exe");
break;
case 1:
strcat(ret, "storm.dll");
break;
case 2:
strcat(ret, "battle.snp");
break;
}
return ret;



case D2DS:
case D2XP:
switch (this->currentfile)
{
case 0:
strcat(ret, "game.exe");
break;
case 1:
strcat(ret, "bnclient.dll");
break;
case 2:
strcat(ret, "d2client.dll");
break;
}
return ret;



case W2BN:
switch (this->currentfile)
{
case 0:
strcat(ret, "Warcraft II BNE.exe");
break;
case 1:
strcat(ret, "storm.dll");
break;
case 2:
strcat(ret, "battle.snp");
break;
}
return ret;



case W3XP:
case WAR3:
switch (currentfile)
{
case 0:
strcat(ret, "war3.exe");
break;
case 1:
strcat(ret, "storm.dll");
break;
case 2:
strcat(ret, "game.dll");
break;
}
return ret;
}
}
#pragma warning(default:4669)

Networks

Quote from: dxoigmn on December 10, 2005, 04:24 PM
You should be using a Buffer class, not strings to pass contents of packets around. Talk about eww:


Select Case Asc(Mid(sPacket, 2, 1))


I agree, it's fine to create functions for each packet for handling them and sending them. I did this in 'Vanquish Chat' and it worked out very well as far as organization.

Joe[x86]

Yeah, I should be using a packet UDT. The point of creating this was so that they don't have to go through the agonizing pain of writing it themselves. If they want to use a packet UDT, find and replace String with udtPacket.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

shadypalm88

Quote from: Joe on December 10, 2005, 06:02 PM
Yeah, I should be using a packet UDT. The point of creating this was so that they don't have to go through the agonizing pain of writing it themselves. If they want to use a packet UDT, find and replace String with udtPacket.
This is why you use a real text editor and learn to use regular expressions.  Suddenly, armed with the packet ID macros or constants from BnetDocs, creating your stubs is painless.

Also using a buffer, after processing the header, you can just pass the buffer object directly to your specific packet handlers.

UserLoser.

Just to remove some ungliness, you should use names like "OnPing" instead of "Handle_SID_PING"

rabbit

Just to make it better, you should add in specific chat event throwers (Events in VB).
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

QwertyMonster