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 ...
We could do this ...
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.
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?
$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?