The online racing simulator
Making TINY & SMALL Sub Type's Directly Bindable from the registerPacket method.
As I have said, I'm making TINY & SMALL sub types bind-able directly from the registerPacket method. But this requires me to do something strange because the TINY_* & SMALL_* namespace is already taken by the numeric defines. So I was thinking of making a TINY and SMALL object, and for the sake of consistancey making an ISP object as well. So instead of doing this ...

$this->registerPacket('onVoteStatus', ISP_VTN, ISP_TINY, ISP_SMALL);

// And then checking the SubT for the TINY & SMALL,
// packet to make sure it's the type we want.

We could do this ...

$this->registerPacket('onVoteStatus', ISP::VTN, TINY::VTC, SMALL::VTA);

This way it leaves the current name spaces in tact for their intended targets, and we can directly bind to these packet subtypes without having to worry about getting a TINY or SMALL that we did not want.

How I plan on doing this is also simple. Where ISP are the whole packet, TINY and SMALL have subtypes and as such could be looked at as fractions of the whole picture. So we define them as such fractions ... In terms a floating point numbers.

class ISP {
const NONE = 0;
const ISI = 1;
const VER = 2;
const TINY = 3;
const SMALL = 4;
// ect.
};

class TINY {
const NONE = 3.0;
const VER = 3.1;
const CLOSE = 3.2;
const PING = 3.3;
const REPLY = 3.4;
// ect.
};

class SMALL {
const NONE = 4.0;
const SSP = 4.1;
const SSG = 4.2;
const VTA = 4.3;
const TMS = 4.4;
// ect.
};

So when the registerPacket function sees a float, it knows that we are talking about the subtype of a particular packet. Thus that function will only get that registered subtype of that packet, not every TINY or every SMALL.

---

My question to you guys is, do you think you would use it?
Propably we will use it. It's very good for binding VTA. Syntax is very good idea too.
With any luck, this will only add about 100 lines of code to PRISM to keep it nice and simple. I just hope this is not too confusing for new programmers to deal with.
It doesn't change anything in binding packets so it shouldn't be confusing. You only add new functionality. You are not modyfing anything.
Kinda true, you can still use ISP_TINY if you want too ... or ISP::TINY for that matter to get all tiny packets. But you will need to use TINY::WHATEVER to get that particular subtype. So I really do recomend that people move away from the ISP_WHATEVER syntax and go over to the ISP::WHATEVER syntax so that it's consistent throughout.
Changing _ to :: is not so painful so it's no problem.
I guess it's a moot point anyway, when this whole system becomes obsolete in a few versions.

FGED GREDG RDFGDR GSFDG